diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-03-11 12:31:52 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:27 -0400 |
commit | 85d8cf161f98993f544c0b2c614873caf7b9c14f (patch) | |
tree | bc6998212112729d53a479dfb3778d5316adf858 /fs/bcachefs/inode.c | |
parent | d4d24a6509548a6457f185fddd927df7d148464a (diff) | |
download | lwn-85d8cf161f98993f544c0b2c614873caf7b9c14f.tar.gz lwn-85d8cf161f98993f544c0b2c614873caf7b9c14f.zip |
bcachefs: bch2_btree_iter_peek_upto()
In BTREE_ITER_FILTER_SNAPHOTS mode, we skip over keys in unrelated
snapshots. When we hit the end of an inode, if the next inode(s) are in
a different subvolume, we could potentially have to skip past many keys
before finding a key we can return to the caller, so they can terminate
the iteration.
This adds a peek_upto() variant to solve this problem, to be used when
we know the range we're searching within.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/inode.c')
-rw-r--r-- | fs/bcachefs/inode.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c index ee14ba5ee73d..3735397ee9c5 100644 --- a/fs/bcachefs/inode.c +++ b/fs/bcachefs/inode.c @@ -586,12 +586,12 @@ static int bch2_inode_delete_keys(struct btree_trans *trans, bch2_btree_iter_set_snapshot(&iter, snapshot); - k = bch2_btree_iter_peek(&iter); + k = bch2_btree_iter_peek_upto(&iter, POS(inum.inum, U64_MAX)); ret = bkey_err(k); if (ret) goto err; - if (!k.k || iter.pos.inode != inum.inum) + if (!k.k) break; bkey_init(&delete.k); |