Commit 2a1df873 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Add snapshot to bch_inode_unpacked

this allows for various cleanups in fsck
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 40d40c6b
...@@ -320,9 +320,11 @@ static noinline int bch2_inode_unpack_slowpath(struct bkey_s_c k, ...@@ -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, int bch2_inode_unpack(struct bkey_s_c k,
struct bch_inode_unpacked *unpacked) struct bch_inode_unpacked *unpacked)
{ {
if (likely(k.k->type == KEY_TYPE_inode_v3)) unpacked->bi_snapshot = k.k->p.snapshot;
return bch2_inode_unpack_v3(k, unpacked);
return bch2_inode_unpack_slowpath(k, unpacked); 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, int bch2_inode_peek_nowarn(struct btree_trans *trans,
...@@ -557,7 +559,7 @@ static void __bch2_inode_unpacked_to_text(struct printbuf *out, ...@@ -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) 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); __bch2_inode_unpacked_to_text(out, inode);
} }
......
...@@ -69,6 +69,7 @@ typedef u64 u96; ...@@ -69,6 +69,7 @@ typedef u64 u96;
struct bch_inode_unpacked { struct bch_inode_unpacked {
u64 bi_inum; u64 bi_inum;
u32 bi_snapshot;
u64 bi_journal_seq; u64 bi_journal_seq;
__le64 bi_hash_seed; __le64 bi_hash_seed;
u64 bi_size; u64 bi_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment