diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-02-09 19:45:36 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:15 -0400 |
commit | 6d033aa404e71710de217d63999fade2f2b0491f (patch) | |
tree | 0f1ddeae8444e9e42d12088b0f0c3927a4876b75 /fs/bcachefs/fsck.c | |
parent | 1df42b571535ed3fd8d9d94f674c626746dc0275 (diff) |
bcachefs: Don't need to walk inodes on clean shutdown
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/fsck.c')
-rw-r--r-- | fs/bcachefs/fsck.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c index 810e1c3f4c49..e79846a96f9c 100644 --- a/fs/bcachefs/fsck.c +++ b/fs/bcachefs/fsck.c @@ -1187,6 +1187,11 @@ static int check_inode(struct bch_fs *c, } if (u.bi_flags & BCH_INODE_UNLINKED) { + fsck_err_on(c->sb.clean, c, + "filesystem marked clean, " + "but inode %llu unlinked", + u.bi_inum); + bch_verbose(c, "deleting inode %llu", u.bi_inum); ret = bch2_inode_rm(c, u.bi_inum); @@ -1389,16 +1394,13 @@ static int check_inodes_fast(struct bch_fs *c) (BCH_INODE_I_SIZE_DIRTY| BCH_INODE_I_SECTORS_DIRTY| BCH_INODE_UNLINKED)) { - fsck_err_on(c->sb.clean, c, - "filesystem marked clean but found inode %llu with flags %x", - inode.k->p.inode, inode.v->bi_flags); ret = check_inode(c, NULL, &iter, inode, NULL); BUG_ON(ret == -EINTR); if (ret) break; } } -fsck_err: + return bch2_btree_iter_unlock(&iter) ?: ret; } @@ -1460,9 +1462,10 @@ int bch2_fsck(struct bch_fs *c) if (c->opts.fsck) return bch2_fsck_full(c); - if (!c->sb.clean && - !(c->sb.features & (1 << BCH_FEATURE_ATOMIC_NLINK))) - return bch2_fsck_inode_nlink(c); + if (c->sb.clean) + return 0; - return bch2_fsck_walk_inodes_only(c); + return c->sb.features & (1 << BCH_FEATURE_ATOMIC_NLINK) + ? bch2_fsck_walk_inodes_only(c) + : bch2_fsck_inode_nlink(c); } |