From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/3] btrfs: always return the largest hole possible for btrfs_get_extent()
Date: Mon, 24 Nov 2025 10:02:23 +1030 [thread overview]
Message-ID: <cover.1763939785.git.wqu@suse.com> (raw)
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
next reply other threads:[~2025-11-23 23:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-23 23:32 Qu Wenruo [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1763939785.git.wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox