diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-10-21 17:37:42 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:45 -0400 |
commit | 005def8ff16885743b9d711fe19fc039c0254eed (patch) | |
tree | a72fbfe72a2a55a6e643c9e0c1b3b4e73fe55416 /fs/bcachefs/bset.c | |
parent | c81f5836a41fc796f37a5ff2bb39f7c76d07d35d (diff) | |
download | linux-005def8ff16885743b9d711fe19fc039c0254eed.tar.gz linux-005def8ff16885743b9d711fe19fc039c0254eed.tar.bz2 linux-005def8ff16885743b9d711fe19fc039c0254eed.zip |
bcachefs: Optimize __bch2_btree_node_iter_advance()
This replaces an expensive memmove() call with an open-coded version.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bset.c')
-rw-r--r-- | fs/bcachefs/bset.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/bset.c b/fs/bcachefs/bset.c index e92737eb34e6..aa8508efca00 100644 --- a/fs/bcachefs/bset.c +++ b/fs/bcachefs/bset.c @@ -1429,7 +1429,10 @@ static inline void __bch2_btree_node_iter_advance(struct btree_node_iter *iter, EBUG_ON(iter->data->k > iter->data->end); if (unlikely(__btree_node_iter_set_end(iter, 0))) { - bch2_btree_node_iter_set_drop(iter, iter->data); + /* avoid an expensive memmove call: */ + iter->data[0] = iter->data[1]; + iter->data[1] = iter->data[2]; + iter->data[2] = (struct btree_node_iter_set) { 0, 0 }; return; } |