diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-09-23 22:06:04 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-09-27 21:46:34 -0400 |
commit | 2a1df873463a28fe5a053d6245290f9a907a5a17 (patch) | |
tree | 989b637fe70873fd13c25348c3a9cd4d330a3b6b | |
parent | 40d40c6bea19ff1e40fb3d33b35b354a5b35025f (diff) | |
download | linux-stable-2a1df873463a28fe5a053d6245290f9a907a5a17.tar.gz linux-stable-2a1df873463a28fe5a053d6245290f9a907a5a17.tar.bz2 linux-stable-2a1df873463a28fe5a053d6245290f9a907a5a17.zip |
bcachefs: Add snapshot to bch_inode_unpacked
this allows for various cleanups in fsck
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/inode.c | 10 | ||||
-rw-r--r-- | fs/bcachefs/inode.h | 1 |
2 files changed, 7 insertions, 4 deletions
diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c index 6ac0ff7e074b..1116db239708 100644 --- a/fs/bcachefs/inode.c +++ b/fs/bcachefs/inode.c @@ -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); } diff --git a/fs/bcachefs/inode.h b/fs/bcachefs/inode.h index f1fcb4c58039..695abd707cb6 100644 --- a/fs/bcachefs/inode.h +++ b/fs/bcachefs/inode.h @@ -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; |