Commit 3a14d58e authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Drop bch2_fsck_inode_nlink()

We've had BCH_FEATURE_atomic_nlink for quite some time, we can drop this
now.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent b6d4f474
...@@ -1468,15 +1468,6 @@ int bch2_fsck_full(struct bch_fs *c) ...@@ -1468,15 +1468,6 @@ int bch2_fsck_full(struct bch_fs *c)
check_inode_nlinks(c, &lostfound_inode); check_inode_nlinks(c, &lostfound_inode);
} }
int bch2_fsck_inode_nlink(struct bch_fs *c)
{
struct bch_inode_unpacked root_inode, lostfound_inode;
return check_root(c, &root_inode) ?:
check_lostfound(c, &root_inode, &lostfound_inode) ?:
check_inode_nlinks(c, &lostfound_inode);
}
int bch2_fsck_walk_inodes_only(struct bch_fs *c) int bch2_fsck_walk_inodes_only(struct bch_fs *c)
{ {
struct btree_trans trans; struct btree_trans trans;
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#define _BCACHEFS_FSCK_H #define _BCACHEFS_FSCK_H
int bch2_fsck_full(struct bch_fs *); int bch2_fsck_full(struct bch_fs *);
int bch2_fsck_inode_nlink(struct bch_fs *);
int bch2_fsck_walk_inodes_only(struct bch_fs *); int bch2_fsck_walk_inodes_only(struct bch_fs *);
#endif /* _BCACHEFS_FSCK_H */ #endif /* _BCACHEFS_FSCK_H */
...@@ -1005,6 +1005,13 @@ int bch2_fs_recovery(struct bch_fs *c) ...@@ -1005,6 +1005,13 @@ int bch2_fs_recovery(struct bch_fs *c)
} }
if (!c->sb.clean &&
!(c->sb.features & (1 << BCH_FEATURE_atomic_nlink))) {
bch_info(c, "BCH_FEATURE_atomic_nlink not set and filesystem dirty, fsck required");
c->opts.fsck = true;
c->opts.fix_errors = FSCK_OPT_YES;
}
if (!(c->sb.features & (1ULL << BCH_FEATURE_alloc_v2))) { if (!(c->sb.features & (1ULL << BCH_FEATURE_alloc_v2))) {
bch_info(c, "alloc_v2 feature bit not set, fsck required"); bch_info(c, "alloc_v2 feature bit not set, fsck required");
c->opts.fsck = true; c->opts.fsck = true;
...@@ -1181,25 +1188,6 @@ int bch2_fs_recovery(struct bch_fs *c) ...@@ -1181,25 +1188,6 @@ int bch2_fs_recovery(struct bch_fs *c)
bch_verbose(c, "alloc write done"); bch_verbose(c, "alloc write done");
} }
if (!c->sb.clean) {
if (!(c->sb.features & (1 << BCH_FEATURE_atomic_nlink))) {
bch_info(c, "checking inode link counts");
err = "error in recovery";
ret = bch2_fsck_inode_nlink(c);
if (ret)
goto err;
bch_verbose(c, "check inodes done");
} else {
bch_verbose(c, "checking for deleted inodes");
err = "error in recovery";
ret = bch2_fsck_walk_inodes_only(c);
if (ret)
goto err;
bch_verbose(c, "check inodes done");
}
}
if (c->opts.fsck) { if (c->opts.fsck) {
bch_info(c, "starting fsck"); bch_info(c, "starting fsck");
err = "error in fsck"; err = "error in fsck";
...@@ -1207,6 +1195,13 @@ int bch2_fs_recovery(struct bch_fs *c) ...@@ -1207,6 +1195,13 @@ int bch2_fs_recovery(struct bch_fs *c)
if (ret) if (ret)
goto err; goto err;
bch_verbose(c, "fsck done"); bch_verbose(c, "fsck done");
} else if (!c->sb.clean) {
bch_verbose(c, "checking for deleted inodes");
err = "error in recovery";
ret = bch2_fsck_walk_inodes_only(c);
if (ret)
goto err;
bch_verbose(c, "check inodes done");
} }
if (enabled_qtypes(c)) { if (enabled_qtypes(c)) {
......
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