[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <143d41362a57e453f5a2cb00dc71e38e020c1c20.1695987265.git.ojaswin@linux.ibm.com>
Date: Fri, 29 Sep 2023 19:40:45 +0530
From: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
To: linux-ext4@...r.kernel.org, "Theodore Ts'o" <tytso@....edu>
Cc: Ritesh Harjani <ritesh.list@...il.com>,
linux-kernel@...r.kernel.org, Jan Kara <jack@...e.cz>
Subject: [PATCH 3/3] ext4: Skip unwritten buffers in __ext4_block_zero_page_range()
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@...e.cz>
Signed-off-by: Ojaswin Mujoo <ojaswin@...ux.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
Powered by blists - more mailing lists