common: add helper to count number of exclusive extents in a file
authorFilipe Manana <fdmanana@suse.com>
Tue, 5 Nov 2019 14:56:40 +0000 (14:56 +0000)
committerEryu Guan <guaneryu@gmail.com>
Sun, 10 Nov 2019 13:10:12 +0000 (21:10 +0800)
commit6fb111ab6089922ba94e83b888f57b2fe999fdbf
tree0c1adb1bf15221f7aba1d81a56d0fe006d791e1d
parente1670cce6af9284c58ca8bb8ee7ea84cb255f5dd
common: add helper to count number of exclusive extents in a file

Add a new helper that is similar to _count_extents() except that
extents that are shared several times by the file with itself
(reflinked at different file offsets) are accounted 1 time only,
instead of N times.

This is motivated by a subsequent test for btrfs that will use this
new helper, to verify that send streams are issuing reflink
operations.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/rc