public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] btrfs: always return the largest hole possible for btrfs_get_extent()
@ 2025-11-23 23:32 Qu Wenruo
  2025-11-23 23:32 ` [PATCH 1/3] btrfs: return the largest hole between two file extent items Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Qu Wenruo @ 2025-11-23 23:32 UTC (permalink / raw)
  To: linux-btrfs

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(-)

-- 
2.52.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-11-24 20:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-23 23:32 [PATCH 0/3] btrfs: always return the largest hole possible for btrfs_get_extent() Qu Wenruo
2025-11-23 23:32 ` [PATCH 1/3] btrfs: return the largest hole between two file extent items Qu Wenruo
2025-11-24 12:59   ` Filipe Manana
2025-11-24 20:54     ` Qu Wenruo
2025-11-23 23:32 ` [PATCH 2/3] btrfs: refactor hole cases of btrfs_get_extent() Qu Wenruo
2025-11-23 23:32 ` [PATCH 3/3] btrfs: return the largest possible hole for EOF cases Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox