]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: send: avoid duplicated search for last extent when sending hole
authorFilipe Manana <fdmanana@suse.com>
Sat, 17 Feb 2024 22:23:02 +0000 (22:23 +0000)
committerDavid Sterba <dsterba@suse.com>
Mon, 4 Mar 2024 15:24:52 +0000 (16:24 +0100)
commit0e9e135e7c4bf90e9e5c14fe9fdedbb789df1604
tree1d08470ea4f13ab664990ab5dfb9cf79b2eb3028
parent0478adff0fae7555c10787470ae04390a8b45e12
btrfs: send: avoid duplicated search for last extent when sending hole

During an incremental send, before determining if we need to send a hole
(write operations full of zeroes) we will search for the last extent's
end offset if we are at the first slot of a leaf and the last processed
extent's end offset is smaller then the current extent's start offset.
However we are repeating this search in case we had the last extent's end
offset undefined (set to the (u64)-1 value) when we entered
maybe_send_hole(), wasting time.

So avoid this duplicated search by combining the two conditions that
trigger a search for the last extent's end offset into a single if
statement.

Reviewed-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/send.c