From: Kent Overstreet Date: Mon, 9 Jan 2023 07:25:08 +0000 (-0500) Subject: bcachefs: Inode create no longer needs to probe key cache X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=63a2edce9487b1fcea7257676614456846f9ab09;p=linux.git bcachefs: Inode create no longer needs to probe key cache Now that we have full key cache coherency, we can simplify bch2_inode_create(). Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c index 9214f68f017c9..ee14ba5ee73d0 100644 --- a/fs/bcachefs/inode.c +++ b/fs/bcachefs/inode.c @@ -519,19 +519,8 @@ again: while ((k = bch2_btree_iter_peek(iter)).k && !(ret = bkey_err(k)) && bkey_cmp(k.k->p, POS(0, max)) < 0) { - while (pos < iter->pos.offset) { - if (!bch2_btree_key_cache_find(c, BTREE_ID_inodes, POS(0, pos))) - goto found_slot; - - pos++; - } - - if (k.k->p.snapshot == snapshot && - !bkey_is_inode(k.k) && - !bch2_btree_key_cache_find(c, BTREE_ID_inodes, SPOS(0, pos, snapshot))) { - bch2_btree_iter_advance(iter); - continue; - } + if (pos < iter->pos.offset) + goto found_slot; /* * We don't need to iterate over keys in every snapshot once @@ -541,12 +530,8 @@ again: bch2_btree_iter_set_pos(iter, POS(0, pos)); } - while (!ret && pos < max) { - if (!bch2_btree_key_cache_find(c, BTREE_ID_inodes, POS(0, pos))) - goto found_slot; - - pos++; - } + if (!ret && pos < max) + goto found_slot; if (!ret && start == min) ret = -ENOSPC; @@ -569,11 +554,6 @@ found_slot: return ret; } - /* We may have raced while the iterator wasn't pointing at pos: */ - if (bkey_is_inode(k.k) || - bch2_btree_key_cache_find(c, BTREE_ID_inodes, k.k->p)) - goto again; - *hint = k.k->p.offset; inode_u->bi_inum = k.k->p.offset; inode_u->bi_generation = bkey_generation(k);