bcachefs: for_each_keylist_key() declares loop iter
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 22 Dec 2023 03:24:46 +0000 (22:24 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 1 Jan 2024 16:47:43 +0000 (11:47 -0500)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_update_interior.c
fs/bcachefs/io_write.c
fs/bcachefs/keylist.c
fs/bcachefs/keylist.h

index f0e3f51..060fe35 100644 (file)
@@ -556,8 +556,6 @@ static void btree_update_add_key(struct btree_update *as,
 static int btree_update_nodes_written_trans(struct btree_trans *trans,
                                            struct btree_update *as)
 {
-       struct bkey_i *k;
-
        struct jset_entry *e = bch2_trans_jset_entry_alloc(trans, as->journal_u64s);
        int ret = PTR_ERR_OR_ZERO(e);
        if (ret)
index 628b3e9..33c0e78 100644 (file)
@@ -1106,15 +1106,14 @@ static bool bch2_extent_is_writeable(struct bch_write_op *op,
 static inline void bch2_nocow_write_unlock(struct bch_write_op *op)
 {
        struct bch_fs *c = op->c;
-       struct bkey_i *k;
 
        for_each_keylist_key(&op->insert_keys, k) {
                struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(bkey_i_to_s_c(k));
 
                bkey_for_each_ptr(ptrs, ptr)
                        bch2_bucket_nocow_unlock(&c->nocow_locks,
-                                              PTR_BUCKET_POS(c, ptr),
-                                              BUCKET_NOCOW_LOCK_UPDATE);
+                                                PTR_BUCKET_POS(c, ptr),
+                                                BUCKET_NOCOW_LOCK_UPDATE);
        }
 }
 
@@ -1158,11 +1157,9 @@ static void bch2_nocow_write_convert_unwritten(struct bch_write_op *op)
 {
        struct bch_fs *c = op->c;
        struct btree_trans *trans = bch2_trans_get(c);
-       struct bkey_i *orig;
-       int ret;
 
        for_each_keylist_key(&op->insert_keys, orig) {
-               ret = for_each_btree_key_upto_commit(trans, iter, BTREE_ID_extents,
+               int ret = for_each_btree_key_upto_commit(trans, iter, BTREE_ID_extents,
                                     bkey_start_pos(&orig->k), orig->k.p,
                                     BTREE_ITER_INTENT, k,
                                     NULL, NULL, BCH_TRANS_COMMIT_no_enospc, ({
index 5699cd4..1b828bd 100644 (file)
@@ -43,8 +43,6 @@ void bch2_keylist_pop_front(struct keylist *l)
 #ifdef CONFIG_BCACHEFS_DEBUG
 void bch2_verify_keylist_sorted(struct keylist *l)
 {
-       struct bkey_i *k;
-
        for_each_keylist_key(l, k)
                BUG_ON(bkey_next(k) != l->top &&
                       bpos_ge(k->k.p, bkey_next(k)->k.p));
index fe759c7..e687e0e 100644 (file)
@@ -50,18 +50,16 @@ static inline struct bkey_i *bch2_keylist_front(struct keylist *l)
 }
 
 #define for_each_keylist_key(_keylist, _k)                     \
-       for (_k = (_keylist)->keys;                             \
+       for (struct bkey_i *_k = (_keylist)->keys;              \
             _k != (_keylist)->top;                             \
             _k = bkey_next(_k))
 
 static inline u64 keylist_sectors(struct keylist *keys)
 {
-       struct bkey_i *k;
        u64 ret = 0;
 
        for_each_keylist_key(keys, k)
                ret += k->k.size;
-
        return ret;
 }