btrfs: more optimizations for lseek and fiemap
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest9 patches 6 repliesIn review
Patches in v1 No applies recorded yet
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/9] btrfs: more optimizations for lseek and fiemap
From: Filipe Manana <[email protected]>
Here follows a few more optimizations for lseek and fiemap. Starting with coreutils 9.0, cp no longer uses fiemap to determine where holes are in a file, instead it uses lseek's SEEK_HOLE and SEEK_DATA modes of operation. For very sparse files, or files with lot of delalloc, this can be very slow (when compared to ext4 or xfs). This aims to improve that.
The cp pattern is not specific to cp, it's common to iterate over all allocated regions of a file sequentially with SEEK_HOLE and SEEK_DATA, for either the whole file or just a section. Another popular program that does the same is tar, when using its --sparse / -S command line option (I use it like that for doing vm backups for example).
The details are in the changelogs of each patch, and results are on the changelog of the last patch in the series. There's still much more room for further improvement, but that won't happen too soon as it will require broader changes outside the lseek and fiemap code.
Filipe Manana (9):
btrfs: remove leftover setting of EXTENT_UPTODATE state in an inode's io_tree
btrfs: add an early exit when searching for delalloc range for lseek/fiemap
btrfs: skip unnecessary delalloc searches during lseek/fiemap
btrfs: search for delalloc more efficiently during lseek/fiemap
btrfs: remove no longer used btrfs_next_extent_map()
btrfs: allow passing a cached state record to count_range_bits()
btrfs: update stale comment for count_range_bits()
btrfs: use cached state when looking for delalloc ranges with fiemap
btrfs: use cached state when looking for delalloc ranges with lseek
fs/btrfs/ctree.h | 1 + fs/btrfs/extent-io-tree.c | 73 +++++++++++-- fs/btrfs/extent-io-tree.h | 10 +- fs/btrfs/extent_io.c | 30 +++--- fs/btrfs/extent_map.c | 29 ----- fs/btrfs/extent_map.h | 2 - fs/btrfs/file.c | 221 ++++++++++++++++++-------------------- fs/btrfs/file.h | 1 + fs/btrfs/inode.c | 2 +- 9 files changed, 190 insertions(+), 179 deletions(-)
Signature · 1 line
2.35.1