Re: fiemap is slow on btrfs on files with multiple extents

From: Josef Bacik
Date: Thu Aug 04 2022 - 14:49:48 EST


On Thu, Aug 04, 2022 at 07:30:52PM +0300, Pavel Tikhomirov wrote:
> I ran the below test on Fedora 36 (the test basically creates "very" sparse
> file, with 4k data followed by 4k hole again and again for the specified
> length and uses fiemap to count extents in this file) and face the problem
> that fiemap hangs for too long (for instance comparing to ext4 version).
> Fiemap with 32768 extents takes ~37264 us and with 65536 extents it takes
> ~34123954 us, which is x1000 times more when file only increased twice the
> size:
>

Ah that was helpful, thank you. I think I've spotted the problem, please give
this a whirl to make sure we're seeing the same thing. Thanks,

Josef