bcachefs: bch2_hash_set_snapshot() -> bch2_hash_set_in_snapshot()
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 26 Jan 2024 00:57:26 +0000 (19:57 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 10 Mar 2024 19:34:08 +0000 (15:34 -0400)
Minor renaming for clarity, bit of refactoring.

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

index 86b3687..3ea98e1 100644 (file)
@@ -219,10 +219,10 @@ int bch2_dirent_create_snapshot(struct btree_trans *trans,
        dirent->k.p.inode       = dir;
        dirent->k.p.snapshot    = snapshot;
 
-       ret = bch2_hash_set_snapshot(trans, bch2_dirent_hash_desc, hash_info,
-                                    zero_inum, snapshot,
-                                    &dirent->k_i, str_hash_flags,
-                                    BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE);
+       ret = bch2_hash_set_in_snapshot(trans, bch2_dirent_hash_desc, hash_info,
+                                       zero_inum, snapshot,
+                                       &dirent->k_i, str_hash_flags,
+                                       BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE);
        *dir_offset = dirent->k.p.offset;
 
        return ret;
index ac4e40a..e92efc9 100644 (file)
@@ -100,8 +100,8 @@ err:
 }
 
 static int lookup_inode(struct btree_trans *trans, u64 inode_nr,
-                         struct bch_inode_unpacked *inode,
-                         u32 *snapshot)
+                       struct bch_inode_unpacked *inode,
+                       u32 *snapshot)
 {
        struct btree_iter iter;
        struct bkey_s_c k;
@@ -722,7 +722,7 @@ static int hash_redo_key(struct btree_trans *trans,
        delete->k.p = k_iter->pos;
        return  bch2_btree_iter_traverse(k_iter) ?:
                bch2_trans_update(trans, k_iter, delete, 0) ?:
-               bch2_hash_set_snapshot(trans, desc, hash_info,
+               bch2_hash_set_in_snapshot(trans, desc, hash_info,
                                       (subvol_inum) { 0, k.k->p.inode },
                                       k.k->p.snapshot, tmp,
                                       BCH_HASH_SET_MUST_CREATE,
@@ -1778,7 +1778,6 @@ static int check_dirent(struct btree_trans *trans, struct btree_iter *iter,
        if (d.v->d_type == DT_DIR)
                for_each_visible_inode(c, s, dir, equiv.snapshot, i)
                        i->count++;
-
 out:
 err:
 fsck_err:
index fcaa5a8..3976f80 100644 (file)
@@ -259,7 +259,7 @@ int bch2_hash_needs_whiteout(struct btree_trans *trans,
 }
 
 static __always_inline
-int bch2_hash_set_snapshot(struct btree_trans *trans,
+int bch2_hash_set_in_snapshot(struct btree_trans *trans,
                           const struct bch_hash_desc desc,
                           const struct bch_hash_info *info,
                           subvol_inum inum, u32 snapshot,
@@ -328,17 +328,12 @@ int bch2_hash_set(struct btree_trans *trans,
                  struct bkey_i *insert,
                  bch_str_hash_flags_t str_hash_flags)
 {
-       u32 snapshot;
-       int ret;
-
-       ret = bch2_subvolume_get_snapshot(trans, inum.subvol, &snapshot);
-       if (ret)
-               return ret;
-
        insert->k.p.inode = inum.inum;
 
-       return bch2_hash_set_snapshot(trans, desc, info, inum,
-                                     snapshot, insert, str_hash_flags, 0);
+       u32 snapshot;
+       return  bch2_subvolume_get_snapshot(trans, inum.subvol, &snapshot) ?:
+               bch2_hash_set_in_snapshot(trans, desc, info, inum,
+                                         snapshot, insert, str_hash_flags, 0);
 }
 
 static __always_inline