Skip to content

btrfs: always return the largest hole possible for btrfs_get_extent()

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3btrfs: return the largest hole between two file extent itemsfs/btrfs/inode.c+0 -22 replies
2/3btrfs: refactor hole cases of btrfs_get_extent()fs/btrfs/inode.c+30 -190 replies
3/3btrfs: return the largest possible hole for EOF casesfs/btrfs/inode.c+18 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] btrfs: always return the largest hole possible for btrfs_get_extent()

When looking in the call sites of btrfs_get_extent(), I didn't really see the need of @len parameter, as normally btrfs_get_extent() would just return the hole or the regular file extent covering @start.

And it turns out that @len is not really that much used in btrfs_get_extent().

If we find a regular/inline/prealloc file extent, we just return the full extent map from that file extent.

It's only for implied holes (aka, NO-HOLES feature where there is no explicit file extent item for a hole) that @len makes a difference.

But in that case, we can simply return the largest hole possible (either the range between two file extents, or for beyond EOF cases return hole covering the largest possible file size).

Patch 1 is removing a hole size truncation, which in theory can benefit readahead on a large hole (no extra tree search for the hole again and again).

Patch 2 is a refactor to remove a weird code pattern.

Patch 3 is to make beyond EOF cases to return the largest hole possible (covering the max file size), so that we won't really utilize @len for hole extent map creation.

Qu Wenruo (3):
btrfs: return the largest hole between two file extent items
btrfs: refactor hole cases of btrfs_get_extent()
btrfs: return the largest possible hole for EOF cases

 fs/btrfs/inode.c | 66 +++++++++++++++++++++++++++++++++---------------
 1 file changed, 45 insertions(+), 21 deletions(-)
Signature · 1 line
2.52.0