Skip to content

Commit 2a1df87

Browse files
author
Kent Overstreet
committed
bcachefs: Add snapshot to bch_inode_unpacked
this allows for various cleanups in fsck Signed-off-by: Kent Overstreet <[email protected]>
1 parent 40d40c6 commit 2a1df87

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

fs/bcachefs/inode.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,11 @@ static noinline int bch2_inode_unpack_slowpath(struct bkey_s_c k,
320320
int bch2_inode_unpack(struct bkey_s_c k,
321321
struct bch_inode_unpacked *unpacked)
322322
{
323-
if (likely(k.k->type == KEY_TYPE_inode_v3))
324-
return bch2_inode_unpack_v3(k, unpacked);
325-
return bch2_inode_unpack_slowpath(k, unpacked);
323+
unpacked->bi_snapshot = k.k->p.snapshot;
324+
325+
return likely(k.k->type == KEY_TYPE_inode_v3)
326+
? bch2_inode_unpack_v3(k, unpacked)
327+
: bch2_inode_unpack_slowpath(k, unpacked);
326328
}
327329

328330
int bch2_inode_peek_nowarn(struct btree_trans *trans,
@@ -557,7 +559,7 @@ static void __bch2_inode_unpacked_to_text(struct printbuf *out,
557559

558560
void bch2_inode_unpacked_to_text(struct printbuf *out, struct bch_inode_unpacked *inode)
559561
{
560-
prt_printf(out, "inum: %llu ", inode->bi_inum);
562+
prt_printf(out, "inum: %llu:%u ", inode->bi_inum, inode->bi_snapshot);
561563
__bch2_inode_unpacked_to_text(out, inode);
562564
}
563565

fs/bcachefs/inode.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ typedef u64 u96;
6969

7070
struct bch_inode_unpacked {
7171
u64 bi_inum;
72+
u32 bi_snapshot;
7273
u64 bi_journal_seq;
7374
__le64 bi_hash_seed;
7475
u64 bi_size;

0 commit comments

Comments
 (0)