From: Ojaswin Mujoo <ojaswin@linux.ibm.com>
To: linux-ext4@vger.kernel.org, "Theodore Ts'o" <tytso@mit.edu>
Cc: Ritesh Harjani <ritesh.list@gmail.com>,
linux-kernel@vger.kernel.org, Jan Kara <jack@suse.cz>
Subject: [PATCH 3/3] ext4: Skip unwritten buffers in __ext4_block_zero_page_range()
Date: Fri, 29 Sep 2023 19:40:45 +0530 [thread overview]
Message-ID: <143d41362a57e453f5a2cb00dc71e38e020c1c20.1695987265.git.ojaswin@linux.ibm.com> (raw)
In-Reply-To: <cover.1695987265.git.ojaswin@linux.ibm.com>
If the buffer is unwritten then the underlying block should already return zero
for reads. Further, if it is not dirty then we can be sure that there is no data
on the folio that might get written back later. Hence we skip zeroing out the
folio and underlying block in this case.
Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
---
fs/ext4/inode.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index de8ea8430d30..75a951ffa3cb 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3659,6 +3659,10 @@ static int __ext4_block_zero_page_range(handle_t *handle,
BUFFER_TRACE(bh, "freed: skip");
goto unlock;
}
+ if (buffer_unwritten(bh) && !buffer_dirty(bh)) {
+ BUFFER_TRACE(bh, "unwritten and non-dirty: skip");
+ goto unlock;
+ }
if (!buffer_mapped(bh)) {
BUFFER_TRACE(bh, "unmapped");
ext4_get_block(inode, iblock, bh, 0);
--
2.39.3
prev parent reply other threads:[~2023-09-29 14:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-29 14:10 [PATCH 0/3] Optimize __ext4_block_zero_page_range() for unwritten buffers Ojaswin Mujoo
2023-09-29 14:10 ` [PATCH 1/3] ext4: treat end of range as exclusive in ext4_zero_range() Ojaswin Mujoo
2023-10-19 15:01 ` Jan Kara
2023-09-29 14:10 ` [PATCH 2/3] ext4: truncate complete range in pagecache before calling ext4_zero_partial_blocks() Ojaswin Mujoo
2023-09-29 16:15 ` Ojaswin Mujoo
2023-10-19 16:55 ` Jan Kara
2023-11-01 15:45 ` Ojaswin Mujoo
2023-09-29 14:10 ` Ojaswin Mujoo [this message]
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=143d41362a57e453f5a2cb00dc71e38e020c1c20.1695987265.git.ojaswin@linux.ibm.com \
--to=ojaswin@linux.ibm.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ritesh.list@gmail.com \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).