diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-11-22 20:15:33 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2022-12-20 20:01:27 -0500 |
commit | b71841e54343e7e7095dd8b66cae1e6e3fa6b8d5 (patch) | |
tree | 15bc25dc97410179810933cdbe5c3f29a2c29f03 /fs/bcachefs/inode.c | |
parent | 113119721d67febf0d7e54bc4fbc8d980d6d0a71 (diff) |
bcachefs: Bring back key cache for inodesbcachefs-v6.0
The btree key cache now works for snapshots btrees, where doing a lookup
requires searching through keys in older snapshots - we can finaly
re-enable it for inodes.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/inode.c')
-rw-r--r-- | fs/bcachefs/inode.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c index 8860301e4af3..b1a0ed13728f 100644 --- a/fs/bcachefs/inode.c +++ b/fs/bcachefs/inode.c @@ -663,19 +663,8 @@ again: while ((k = bch2_btree_iter_peek(iter)).k && !(ret = bkey_err(k)) && bkey_lt(k.k->p, POS(0, max))) { - 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 @@ -685,12 +674,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 = -BCH_ERR_ENOSPC_inode_create; @@ -713,11 +698,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); |