bcachefs: Pass device to bch2_alloc_write_key()
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 30 Apr 2024 19:44:24 +0000 (15:44 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 8 May 2024 21:29:22 +0000 (17:29 -0400)
More elimating bch2_dev_bkey_exists()

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

index 133c48c4047da2d1bffe2cb52d4ef6511994f30c..07b343e7ddeb99264bcf98e2805680e18e588a43 100644 (file)
@@ -865,10 +865,10 @@ static inline bool bch2_alloc_v4_cmp(struct bch_alloc_v4 l,
 
 static int bch2_alloc_write_key(struct btree_trans *trans,
                                struct btree_iter *iter,
+                               struct bch_dev *ca,
                                struct bkey_s_c k)
 {
        struct bch_fs *c = trans->c;
-       struct bch_dev *ca = bch2_dev_bkey_exists(c, iter->pos.inode);
        struct bkey_i_alloc_v4 *a;
        struct bch_alloc_v4 old_gc, gc, old_convert, new;
        const struct bch_alloc_v4 *old;
@@ -965,7 +965,7 @@ static int bch2_gc_alloc_done(struct bch_fs *c)
                                        POS(ca->dev_idx, ca->mi.nbuckets - 1),
                                        BTREE_ITER_slots|BTREE_ITER_prefetch, k,
                                        NULL, NULL, BCH_TRANS_COMMIT_lazy_rw,
-                               bch2_alloc_write_key(trans, &iter, k)));
+                               bch2_alloc_write_key(trans, &iter, ca, k)));
                if (ret) {
                        bch2_dev_put(ca);
                        break;