[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0600ebcc-d7dd-3586-b855-a94985d3b3da@huawei.com>
Date: Fri, 7 Nov 2025 19:54:02 +0800
From: yangerkun <yangerkun@...wei.com>
To: Jan Kara <jack@...e.cz>
CC: <linux-ext4@...r.kernel.org>, <tytso@....edu>, <adilger.kernel@...ger.ca>,
<yi.zhang@...wei.com>, <libaokun1@...wei.com>, <yangerkun@...weicloud.com>
Subject: Re: [PATCH v2 4/4] ext4: order mode should not take effect for DIO
在 2025/11/4 23:07, Jan Kara 写道:
> On Tue 04-11-25 21:17:50, Yang Erkun wrote:
>> Since the size will be updated after the DIO completes, the data
>> will not be shown to userspace before that.
>>
>> Reviewed-by: Zhang Yi <yi.zhang@...wei.com>
>> Signed-off-by: Yang Erkun <yangerkun@...wei.com>
>
> Hum, is there some measurable performance benefit from this? If yes, it
> would be good to mention it in the changelog. If not, then why bother?
Hi,
I discovered this while debugging. Today, I also conducted some
performance tests on this patch, but it appears that there is no
noticeable improvement. Therefore, I agree with your suggestion and will
remove it in the next version!
Thanks,
Erkun.
>
> Honza
>
>> ---
>> fs/ext4/ext4.h | 2 ++
>> fs/ext4/inode.c | 5 +++--
>> include/trace/events/ext4.h | 1 +
>> 3 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
>> index 96d7d649ccb0..d0331697467d 100644
>> --- a/fs/ext4/ext4.h
>> +++ b/fs/ext4/ext4.h
>> @@ -715,6 +715,8 @@ enum {
>> #define EXT4_GET_BLOCKS_METADATA_NOFAIL 0x0020
>> /* Don't normalize allocation size (used for fallocate) */
>> #define EXT4_GET_BLOCKS_NO_NORMALIZE 0x0040
>> + /* Get blocks from DIO */
>> +#define EXT4_GET_BLOCKS_DIO 0x0080
>> /* Convert written extents to unwritten */
>> #define EXT4_GET_BLOCKS_CONVERT_UNWRITTEN 0x0100
>> /* Write zeros to newly created written extents */
>> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
>> index 3d8ada26d5cd..168dbcc9e921 100644
>> --- a/fs/ext4/inode.c
>> +++ b/fs/ext4/inode.c
>> @@ -818,6 +818,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
>> if (map->m_flags & EXT4_MAP_NEW &&
>> !(map->m_flags & EXT4_MAP_UNWRITTEN) &&
>> !(flags & EXT4_GET_BLOCKS_ZERO) &&
>> + !(flags & EXT4_GET_BLOCKS_DIO) &&
>> !ext4_is_quota_file(inode) &&
>> ext4_should_order_data(inode)) {
>> loff_t start_byte =
>> @@ -3729,9 +3730,9 @@ static int ext4_iomap_alloc(struct inode *inode, struct ext4_map_blocks *map,
>> * happening and thus expose allocated blocks to direct I/O reads.
>> */
>> else if (((loff_t)map->m_lblk << blkbits) >= i_size_read(inode))
>> - m_flags = EXT4_GET_BLOCKS_CREATE;
>> + m_flags = EXT4_GET_BLOCKS_CREATE | EXT4_GET_BLOCKS_DIO;
>> else if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
>> - m_flags = EXT4_GET_BLOCKS_IO_CREATE_EXT;
>> + m_flags = EXT4_GET_BLOCKS_IO_CREATE_EXT | EXT4_GET_BLOCKS_DIO;
>>
>> if (flags & IOMAP_ATOMIC)
>> ret = ext4_map_blocks_atomic_write(handle, inode, map, m_flags,
>> diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
>> index ada2b9223df5..de6d848f2e37 100644
>> --- a/include/trace/events/ext4.h
>> +++ b/include/trace/events/ext4.h
>> @@ -43,6 +43,7 @@ struct partial_cluster;
>> { EXT4_GET_BLOCKS_CONVERT, "CONVERT" }, \
>> { EXT4_GET_BLOCKS_METADATA_NOFAIL, "METADATA_NOFAIL" }, \
>> { EXT4_GET_BLOCKS_NO_NORMALIZE, "NO_NORMALIZE" }, \
>> + { EXT4_GET_BLOCKS_DIO, "DIO" }, \
>> { EXT4_GET_BLOCKS_CONVERT_UNWRITTEN, "CONVERT_UNWRITTEN" }, \
>> { EXT4_GET_BLOCKS_ZERO, "ZERO" }, \
>> { EXT4_GET_BLOCKS_IO_SUBMIT, "IO_SUBMIT" }, \
>> --
>> 2.39.2
>>
Powered by blists - more mailing lists