bcachefs: delete duplicated checks in check_dirent_to_subvol()
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 7 Feb 2024 05:06:14 +0000 (00:06 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 14 Mar 2024 01:22:24 +0000 (21:22 -0400)
these were already checked in check_subvol()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fsck.c

index fa96f63492d1e4e43212f2de815174561ed420fe..9069701028a9645001b75ba8b20673bbebd4bfe9 100644 (file)
@@ -1713,8 +1713,8 @@ fsck_err:
        return ret;
 }
 
-static int check_subvol_dirent(struct btree_trans *trans, struct btree_iter *iter,
-                              struct bkey_s_c_dirent d)
+static int check_dirent_to_subvol(struct btree_trans *trans, struct btree_iter *iter,
+                                 struct bkey_s_c_dirent d)
 {
        struct bch_fs *c = trans->c;
        struct bch_inode_unpacked subvol_root;
@@ -1724,7 +1724,7 @@ static int check_subvol_dirent(struct btree_trans *trans, struct btree_iter *ite
        int ret = 0;
 
        ret = subvol_lookup(trans, target_subvol,
-                             &target_snapshot, &target_inum);
+                           &target_snapshot, &target_inum);
        if (ret && !bch2_err_matches(ret, ENOENT))
                return ret;
 
@@ -1738,25 +1738,6 @@ static int check_subvol_dirent(struct btree_trans *trans, struct btree_iter *ite
        if (ret && !bch2_err_matches(ret, ENOENT))
                return ret;
 
-       if (fsck_err_on(ret, c, subvol_to_missing_root,
-                       "subvolume %u points to missing subvolume root %llu",
-                       target_subvol,
-                       target_inum)) {
-               bch_err(c, "repair not implemented yet");
-               return -EINVAL;
-       }
-
-       if (fsck_err_on(subvol_root.bi_subvol != target_subvol,
-                       c, subvol_root_wrong_bi_subvol,
-                       "subvol root %llu has wrong bi_subvol field: got %u, should be %u",
-                       target_inum,
-                       subvol_root.bi_subvol, target_subvol)) {
-               subvol_root.bi_subvol = target_subvol;
-               ret = __bch2_fsck_write_inode(trans, &subvol_root, target_snapshot);
-               if (ret)
-                       return ret;
-       }
-
        ret = check_dirent_target(trans, iter, d, &subvol_root,
                                  target_snapshot);
        if (ret)
@@ -1849,7 +1830,7 @@ static int check_dirent(struct btree_trans *trans, struct btree_iter *iter,
        d = bkey_s_c_to_dirent(k);
 
        if (d.v->d_type == DT_SUBVOL) {
-               ret = check_subvol_dirent(trans, iter, d);
+               ret = check_dirent_to_subvol(trans, iter, d);
                if (ret)
                        goto err;
        } else {