From: Baokun Li <libaokun1@huawei.com>
To: Zhang Yi <yi.zhang@huaweicloud.com>, <linux-ext4@vger.kernel.org>
Cc: <linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<tytso@mit.edu>, <adilger.kernel@dilger.ca>, <jack@suse.cz>,
<ojaswin@linux.ibm.com>, <ritesh.list@gmail.com>,
<yi.zhang@huawei.com>, <yizhang089@gmail.com>,
<yangerkun@huawei.com>, <yukuai@fnnas.com>
Subject: Re: [PATCH -next v2 1/7] ext4: use reserved metadata blocks when splitting extent on endio
Date: Wed, 31 Dec 2025 15:34:51 +0800 [thread overview]
Message-ID: <c05d7382-27c8-46cb-a008-56c5dc2fde5d@huawei.com> (raw)
In-Reply-To: <20251223011802.31238-2-yi.zhang@huaweicloud.com>
On 2025-12-23 09:17, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@huawei.com>
>
> When performing buffered writes, we may need to split and convert an
> unwritten extent into a written one during the end I/O process. However,
> we do not reserve space specifically for these metadata changes, we only
> reserve 2% of space or 4096 blocks. To address this, we use
> EXT4_GET_BLOCKS_PRE_IO to potentially split extents in advance and
> EXT4_GET_BLOCKS_METADATA_NOFAIL to utilize reserved space if necessary.
>
> These two approaches can reduce the likelihood of running out of space
> and losing data. However, these methods are merely best efforts, we
> could still run out of space, and there is not much difference between
> converting an extent during the writeback process and the end I/O
> process, it won't increase the rick of losing data if we postpone the
> conversion.
>
> Therefore, also use EXT4_GET_BLOCKS_METADATA_NOFAIL in
> ext4_convert_unwritten_extents_endio() to prepare for the buffered I/O
> iomap conversion, which may perform extent conversion during the end I/O
> process.
>
> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
> Reviewed-by: Jan Kara <jack@suse.cz>
Fair point, that is consistent with how
ext4_ext_handle_unwritten_extents() handles it.
Reviewed-by: Baokun Li <libaokun1@huawei.com>
> ---
> fs/ext4/extents.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 27eb2c1df012..e53959120b04 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -3794,6 +3794,8 @@ ext4_convert_unwritten_extents_endio(handle_t *handle, struct inode *inode,
> * illegal.
> */
> if (ee_block != map->m_lblk || ee_len > map->m_len) {
> + int flags = EXT4_GET_BLOCKS_CONVERT |
> + EXT4_GET_BLOCKS_METADATA_NOFAIL;
> #ifdef CONFIG_EXT4_DEBUG
> ext4_warning(inode->i_sb, "Inode (%ld) finished: extent logical block %llu,"
> " len %u; IO logical block %llu, len %u",
> @@ -3801,7 +3803,7 @@ ext4_convert_unwritten_extents_endio(handle_t *handle, struct inode *inode,
> (unsigned long long)map->m_lblk, map->m_len);
> #endif
> path = ext4_split_convert_extents(handle, inode, map, path,
> - EXT4_GET_BLOCKS_CONVERT, NULL);
> + flags, NULL);
> if (IS_ERR(path))
> return path;
>
next prev parent reply other threads:[~2025-12-31 7:34 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 1:17 [PATCH -next v2 0/7] ext4: defer unwritten splitting until I/O completion Zhang Yi
2025-12-23 1:17 ` [PATCH -next v2 1/7] ext4: use reserved metadata blocks when splitting extent on endio Zhang Yi
2025-12-31 7:34 ` Baokun Li [this message]
2026-01-03 13:42 ` Ojaswin Mujoo
2026-01-05 1:17 ` Zhang Yi
2025-12-23 1:17 ` [PATCH -next v2 2/7] ext4: don't split extent before submitting I/O Zhang Yi
2025-12-31 7:35 ` Baokun Li
2026-01-03 13:47 ` Ojaswin Mujoo
2025-12-23 1:17 ` [PATCH -next v2 3/7] ext4: avoid starting handle when dio writing an unwritten extent Zhang Yi
2025-12-31 7:36 ` Baokun Li
2026-01-03 14:06 ` Ojaswin Mujoo
2025-12-23 1:17 ` [PATCH -next v2 4/7] ext4: remove useless ext4_iomap_overwrite_ops Zhang Yi
2025-12-31 7:40 ` Baokun Li
2026-01-03 14:14 ` Ojaswin Mujoo
2025-12-23 1:18 ` [PATCH -next v2 5/7] ext4: remove unused unwritten parameter in ext4_dio_write_iter() Zhang Yi
2025-12-31 7:42 ` Baokun Li
2026-01-03 14:16 ` Ojaswin Mujoo
2025-12-23 1:18 ` [PATCH -next v2 6/7] ext4: simply the mapping query logic in ext4_iomap_begin() Zhang Yi
2025-12-31 7:46 ` Baokun Li
2026-01-03 14:17 ` Ojaswin Mujoo
2026-01-04 13:00 ` Markus Elfring
2026-01-05 1:18 ` Zhang Yi
2025-12-23 1:18 ` [PATCH -next v2 7/7] ext4: remove EXT4_GET_BLOCKS_IO_CREATE_EXT Zhang Yi
2025-12-31 7:55 ` Baokun Li
2026-01-03 14:20 ` Ojaswin Mujoo
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=c05d7382-27c8-46cb-a008-56c5dc2fde5d@huawei.com \
--to=libaokun1@huawei.com \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=tytso@mit.edu \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yi.zhang@huaweicloud.com \
--cc=yizhang089@gmail.com \
--cc=yukuai@fnnas.com \
/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
all inboxes | Powered by JetHome®