OSDN Git Service

Btrfs: send, skip backreference walking for extents with many references
authorFilipe Manana <fdmanana@suse.com>
Wed, 30 Oct 2019 12:23:01 +0000 (12:23 +0000)
committerDavid Sterba <dsterba@suse.com>
Mon, 18 Nov 2019 16:51:48 +0000 (17:51 +0100)
commitfd0ddbe2509568b00df364156f47561e9f469f15
tree0288cc6b720f8d7bae3950fdcdcaba473f3697ee
parent11f2069c113e02971b8db6fda62f9b9cd31a030f
Btrfs: send, skip backreference walking for extents with many references

Backreference walking, which is used by send to figure if it can issue
clone operations instead of write operations, can be very slow and use
too much memory when extents have many references. This change simply
skips backreference walking when an extent has more than 64 references,
in which case we fallback to a write operation instead of a clone
operation. This limit is conservative and in practice I observed no
signicant slowdown with up to 100 references and still low memory usage
up to that limit.

This is a temporary workaround until there are speedups in the backref
walking code, and as such it does not attempt to add extra interfaces or
knobs to tweak the threshold.

Reported-by: Atemu <atemu.main@gmail.com>
Link: https://lore.kernel.org/linux-btrfs/CAE4GHgkvqVADtS4AzcQJxo0Q1jKQgKaW3JGp3SGdoinVo=C9eQ@mail.gmail.com/T/#me55dc0987f9cc2acaa54372ce0492c65782be3fa
CC: stable@vger.kernel.org # 4.4+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/send.c