From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 1/3] btrfs: remove unnecessary early exits in delalloc folio lock and unlock
Date: Fri, 4 Apr 2025 12:17:40 +1030 [thread overview]
Message-ID: <39d3966f896f04c3003eb9a954ce84ff33d51345.1743731232.git.wqu@suse.com> (raw)
In-Reply-To: <cover.1743731232.git.wqu@suse.com>
Inside function unlock_delalloc_folio() and lock_delalloc_folios(), we
have the following early exist:
if (index == locked_folio->index && end_index == index)
return;
This allows us to exist early if the range are inside the same locked
folio.
But even without the above early check, the existing code can handle it
well, as both __process_folios_contig() and lock_delalloc_folios() will
skip any folio page lock/unlock if it's on the locked folio.
Just remove those unnecessary early exits.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
fs/btrfs/extent_io.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 8b29eeac3884..013268f70621 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -224,12 +224,7 @@ static noinline void unlock_delalloc_folio(const struct inode *inode,
const struct folio *locked_folio,
u64 start, u64 end)
{
- unsigned long index = start >> PAGE_SHIFT;
- unsigned long end_index = end >> PAGE_SHIFT;
-
ASSERT(locked_folio);
- if (index == locked_folio->index && end_index == index)
- return;
__process_folios_contig(inode->i_mapping, locked_folio, start, end,
PAGE_UNLOCK);
@@ -246,9 +241,6 @@ static noinline int lock_delalloc_folios(struct inode *inode,
u64 processed_end = start;
struct folio_batch fbatch;
- if (index == locked_folio->index && index == end_index)
- return 0;
-
folio_batch_init(&fbatch);
while (index <= end_index) {
unsigned int found_folios, i;
--
2.49.0
next prev parent reply other threads:[~2025-04-04 1:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-04 1:47 [PATCH 0/3] btrfs: fsstress hang fix for large data folios Qu Wenruo
2025-04-04 1:47 ` Qu Wenruo [this message]
2025-04-04 16:04 ` [PATCH 1/3] btrfs: remove unnecessary early exits in delalloc folio lock and unlock Filipe Manana
2025-04-04 21:44 ` Qu Wenruo
2025-04-05 17:54 ` Filipe Manana
2025-04-04 1:47 ` [PATCH 2/3] btrfs: use folio_contains() for EOF detection Qu Wenruo
2025-04-04 16:09 ` Filipe Manana
2025-04-07 18:39 ` David Sterba
2025-04-07 21:58 ` Qu Wenruo
2025-04-08 23:12 ` David Sterba
2025-04-08 23:16 ` Qu Wenruo
2025-04-04 1:47 ` [PATCH 3/3] btrfs: get rid of filemap_get_folios_contig() calls Qu Wenruo
2025-04-04 16:38 ` Filipe Manana
2025-04-04 21:51 ` Qu Wenruo
2025-04-04 22:00 ` Qu Wenruo
2025-04-22 22:47 ` 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=39d3966f896f04c3003eb9a954ce84ff33d51345.1743731232.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