Commit 63a2edce authored by Kent Overstreet's avatar Kent Overstreet

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: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 12ce5b7d
......@@ -519,19 +519,8 @@ int bch2_inode_create(struct btree_trans *trans,
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 @@ int bch2_inode_create(struct btree_trans *trans,
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 @@ int bch2_inode_create(struct btree_trans *trans,
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment