[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241022111059.2566137-17-yi.zhang@huaweicloud.com>
Date: Tue, 22 Oct 2024 19:10:47 +0800
From: Zhang Yi <yi.zhang@...weicloud.com>
To: linux-ext4@...r.kernel.org
Cc: linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
tytso@....edu,
adilger.kernel@...ger.ca,
jack@...e.cz,
ritesh.list@...il.com,
hch@...radead.org,
djwong@...nel.org,
david@...morbit.com,
zokeefe@...gle.com,
yi.zhang@...wei.com,
yi.zhang@...weicloud.com,
chengzhihao1@...wei.com,
yukuai3@...wei.com,
yangerkun@...wei.com
Subject: [PATCH 16/27] ext4: don't order data for inode with EXT4_STATE_BUFFERED_IOMAP
From: Zhang Yi <yi.zhang@...wei.com>
In the iomap buffered I/O path, there is no risk of exposing stale data
because we always allocate unwritten extents for new allocated blocks,
the extent changes to written only when the I/O is completed. Therefore,
we do not need to order data in this mode.
Signed-off-by: Zhang Yi <yi.zhang@...wei.com>
---
fs/ext4/ext4_jbd2.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
index 0c77697d5e90..9dca10027032 100644
--- a/fs/ext4/ext4_jbd2.h
+++ b/fs/ext4/ext4_jbd2.h
@@ -467,6 +467,14 @@ static inline int ext4_should_journal_data(struct inode *inode)
static inline int ext4_should_order_data(struct inode *inode)
{
+ /*
+ * There is no need to order data for inodes with iomap buffered I/O
+ * path since it always allocate unwritten extents for new allocated
+ * blocks and have no risk of stale data.
+ */
+ if (ext4_test_inode_state(inode, EXT4_STATE_BUFFERED_IOMAP))
+ return 0;
+
return ext4_inode_journal_mode(inode) & EXT4_INODE_ORDERED_DATA_MODE;
}
--
2.46.1
Powered by blists - more mailing lists