]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bcachefs: Add snapshot to bch_inode_unpacked
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 24 Sep 2024 02:06:04 +0000 (22:06 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 28 Sep 2024 01:46:34 +0000 (21:46 -0400)
this allows for various cleanups in fsck

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/inode.c
fs/bcachefs/inode.h

index 6ac0ff7e074ba7dde99c9caa42d8ddf8a6883a75..1116db239708f23f6f907df91cecca6a4e08f6ce 100644 (file)
@@ -320,9 +320,11 @@ static noinline int bch2_inode_unpack_slowpath(struct bkey_s_c k,
 int bch2_inode_unpack(struct bkey_s_c k,
                      struct bch_inode_unpacked *unpacked)
 {
-       if (likely(k.k->type == KEY_TYPE_inode_v3))
-               return bch2_inode_unpack_v3(k, unpacked);
-       return bch2_inode_unpack_slowpath(k, unpacked);
+       unpacked->bi_snapshot = k.k->p.snapshot;
+
+       return likely(k.k->type == KEY_TYPE_inode_v3)
+               ? bch2_inode_unpack_v3(k, unpacked)
+               : bch2_inode_unpack_slowpath(k, unpacked);
 }
 
 int bch2_inode_peek_nowarn(struct btree_trans *trans,
@@ -557,7 +559,7 @@ static void __bch2_inode_unpacked_to_text(struct printbuf *out,
 
 void bch2_inode_unpacked_to_text(struct printbuf *out, struct bch_inode_unpacked *inode)
 {
-       prt_printf(out, "inum: %llu ", inode->bi_inum);
+       prt_printf(out, "inum: %llu:%u ", inode->bi_inum, inode->bi_snapshot);
        __bch2_inode_unpacked_to_text(out, inode);
 }
 
index f1fcb4c58039a5f6ee0a9185a6d3fd8065944399..695abd707cb6a5f508ad491e6ca4d1197bc8df40 100644 (file)
@@ -69,6 +69,7 @@ typedef u64 u96;
 
 struct bch_inode_unpacked {
        u64                     bi_inum;
+       u32                     bi_snapshot;
        u64                     bi_journal_seq;
        __le64                  bi_hash_seed;
        u64                     bi_size;