btrfs: send on fully deduped file
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Tue, 19 Jul 2016 02:44:02 +0000 (10:44 +0800)
committerEryu Guan <eguan@redhat.com>
Tue, 19 Jul 2016 04:20:43 +0000 (12:20 +0800)
commita4f0a9bfd6b2217b1b2003d90dec846487b5656f
treed196a6f39b8ef12520054d1bd053d3db026c8389
parentb6594600df9327584bfe81ef065a0482fe6d3237
btrfs: send on fully deduped file

For fully deduped file, whose file extents are all pointing to the
same extent, btrfs backref walk can be very time consuming, long
enough to trigger softlock.

Unfortunately, btrfs send is one of the caller of such backref walk
under an O(n) loop, making the total time complexity to O(n^3) or
more.

And even worse, btrfs send will allocate memory in such loop, to
trigger OOM on system with small memory(<4G).

This test case will check if btrfs send will cause these problems.

Reporeted-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
tests/btrfs/130 [new file with mode: 0755]
tests/btrfs/130.out [new file with mode: 0644]
tests/btrfs/group