bcachefs: bch2_dirent_lookup() -> lockrestart_do()
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 17 Dec 2023 08:05:30 +0000 (03:05 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 1 Jan 2024 16:47:42 +0000 (11:47 -0500)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/dirent.c

index 78ce963..51fe04f 100644 (file)
@@ -471,17 +471,11 @@ u64 bch2_dirent_lookup(struct bch_fs *c, subvol_inum dir,
                       const struct qstr *name, subvol_inum *inum)
 {
        struct btree_trans *trans = bch2_trans_get(c);
-       struct btree_iter iter;
-       int ret;
-retry:
-       bch2_trans_begin(trans);
+       struct btree_iter iter = { NULL };
 
-       ret = __bch2_dirent_lookup_trans(trans, &iter, dir, hash_info,
-                                         name, inum, 0);
-       if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
-               goto retry;
-       if (!ret)
-               bch2_trans_iter_exit(trans, &iter);
+       int ret = lockrestart_do(trans,
+               __bch2_dirent_lookup_trans(trans, &iter, dir, hash_info, name, inum, 0));
+       bch2_trans_iter_exit(trans, &iter);
        bch2_trans_put(trans);
        return ret;
 }