[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240410150313.2820364-5-yi.zhang@huaweicloud.com>
Date: Wed, 10 Apr 2024 23:03:12 +0800
From: Zhang Yi <yi.zhang@...weicloud.com>
To: linux-ext4@...r.kernel.org
Cc: linux-fsdevel@...r.kernel.org,
linux-mm@...ck.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,
willy@...radead.org,
zokeefe@...gle.com,
yi.zhang@...wei.com,
yi.zhang@...weicloud.com,
chengzhihao1@...wei.com,
yukuai3@...wei.com,
wangkefeng.wang@...wei.com
Subject: [RFC PATCH v4 33/34] ext4: don't mark IOMAP_F_DIRTY for buffer write
From: Zhang Yi <yi.zhang@...wei.com>
The data sync dirty check in ext4_inode_datasync_dirty() is expansive
since jbd2_transaction_committed() holds journal->j_state lock when
journal is enabled, it costs a lot in high-concurrency iomap buffered
read/write paths, but we never check IOMAP_F_DIRTY in these cases, so
let's check it only in swap file, dax and direct IO cases. Tested by
Unixbench on 100GB ramdisk:
/Run -c 128 -i 10 fstime fsbuffer fsdisk
== without this patch ==
128 CPUs in system; running 128 parallel copies of tests
File Copy 1024 bufsize 2000 maxblocks 6332521.0 KBps
File Copy 256 bufsize 500 maxblocks 1639726.0 KBps
File Copy 4096 bufsize 8000 maxblocks 24018572.0 KBps
== with this patch ==
128 CPUs in system; running 128 parallel copies of tests
File Copy 1024 bufsize 2000 maxblocks 49229257.0 KBps
File Copy 256 bufsize 500 maxblocks 24057510.0 KBps
File Copy 4096 bufsize 8000 maxblocks 75704437.0 KBps
Signed-off-by: Zhang Yi <yi.zhang@...wei.com>
---
fs/ext4/inode.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 1cb219d347af..269503749ef5 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3281,9 +3281,13 @@ static void ext4_set_iomap(struct inode *inode, struct iomap *iomap,
* there is no other metadata changes being made or are pending.
*/
iomap->flags = 0;
- if (ext4_inode_datasync_dirty(inode) ||
- offset + length > i_size_read(inode))
- iomap->flags |= IOMAP_F_DIRTY;
+ if ((flags & (IOMAP_DAX | IOMAP_REPORT)) ||
+ ((flags & (IOMAP_WRITE | IOMAP_DIRECT)) ==
+ (IOMAP_WRITE | IOMAP_DIRECT))) {
+ if (offset + length > i_size_read(inode) ||
+ ext4_inode_datasync_dirty(inode))
+ iomap->flags |= IOMAP_F_DIRTY;
+ }
if (map->m_flags & EXT4_MAP_NEW)
iomap->flags |= IOMAP_F_NEW;
--
2.39.2
Powered by blists - more mailing lists