From: Zhang Yi <yi.zhang@huaweicloud.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, tytso@mit.edu,
adilger.kernel@dilger.ca, ritesh.list@gmail.com,
yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com
Subject: Re: [PATCH v2 09/10] ext4: drop ext4_es_is_delonly()
Date: Thu, 8 Aug 2024 19:21:17 +0800 [thread overview]
Message-ID: <d71862a9-aeee-0db1-31de-2883cb32c28e@huaweicloud.com> (raw)
In-Reply-To: <20240807174818.bt6b4qhub7ydy5r5@quack3>
On 2024/8/8 1:48, Jan Kara wrote:
> On Fri 02-08-24 19:51:19, Zhang Yi wrote:
>> From: Zhang Yi <yi.zhang@huawei.com>
>>
>> Since we don't add delayed flag in unwritten extents, so there is no
>> difference between ext4_es_is_delayed() and ext4_es_is_delonly(),
>> just drop ext4_es_is_delonly().
>>
>> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
>
> Looks good. But please also add assertion when inserting extent into status
> tree that only one of EXTENT_STATUS_WRITTEN, EXTENT_STATUS_UNWRITTEN,
> EXTENT_STATUS_DELAYED, and EXTENT_STATUS_HOLE is set.
> Also perhaps add comment to EXTENT_STATUS_DELAYED (and other) definition that
> these states are exclusive. Thanks!
>
Sure, will do. Thanks for the suggestion,
Yi.
>
>> ---
>> fs/ext4/extents_status.c | 18 +++++++++---------
>> fs/ext4/extents_status.h | 5 -----
>> fs/ext4/inode.c | 4 ++--
>> 3 files changed, 11 insertions(+), 16 deletions(-)
>>
>> diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
>> index e482ac818317..5fb0a02405ba 100644
>> --- a/fs/ext4/extents_status.c
>> +++ b/fs/ext4/extents_status.c
>> @@ -563,8 +563,8 @@ static int ext4_es_can_be_merged(struct extent_status *es1,
>> if (ext4_es_is_hole(es1))
>> return 1;
>>
>> - /* we need to check delayed extent is without unwritten status */
>> - if (ext4_es_is_delayed(es1) && !ext4_es_is_unwritten(es1))
>> + /* we need to check delayed extent */
>> + if (ext4_es_is_delayed(es1))
>> return 1;
>>
>> return 0;
>> @@ -1139,7 +1139,7 @@ static void count_rsvd(struct inode *inode, ext4_lblk_t lblk, long len,
>> struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
>> ext4_lblk_t i, end, nclu;
>>
>> - if (!ext4_es_is_delonly(es))
>> + if (!ext4_es_is_delayed(es))
>> return;
>>
>> WARN_ON(len <= 0);
>> @@ -1291,7 +1291,7 @@ static unsigned int get_rsvd(struct inode *inode, ext4_lblk_t end,
>> es = rc->left_es;
>> while (es && ext4_es_end(es) >=
>> EXT4_LBLK_CMASK(sbi, rc->first_do_lblk)) {
>> - if (ext4_es_is_delonly(es)) {
>> + if (ext4_es_is_delayed(es)) {
>> rc->ndelonly_cluster--;
>> left_delonly = true;
>> break;
>> @@ -1311,7 +1311,7 @@ static unsigned int get_rsvd(struct inode *inode, ext4_lblk_t end,
>> }
>> while (es && es->es_lblk <=
>> EXT4_LBLK_CFILL(sbi, rc->last_do_lblk)) {
>> - if (ext4_es_is_delonly(es)) {
>> + if (ext4_es_is_delayed(es)) {
>> rc->ndelonly_cluster--;
>> right_delonly = true;
>> break;
>> @@ -2239,7 +2239,7 @@ static int __revise_pending(struct inode *inode, ext4_lblk_t lblk,
>> if (EXT4_B2C(sbi, lblk) == EXT4_B2C(sbi, end)) {
>> first = EXT4_LBLK_CMASK(sbi, lblk);
>> if (first != lblk)
>> - f_del = __es_scan_range(inode, &ext4_es_is_delonly,
>> + f_del = __es_scan_range(inode, &ext4_es_is_delayed,
>> first, lblk - 1);
>> if (f_del) {
>> ret = __insert_pending(inode, first, prealloc);
>> @@ -2251,7 +2251,7 @@ static int __revise_pending(struct inode *inode, ext4_lblk_t lblk,
>> sbi->s_cluster_ratio - 1;
>> if (last != end)
>> l_del = __es_scan_range(inode,
>> - &ext4_es_is_delonly,
>> + &ext4_es_is_delayed,
>> end + 1, last);
>> if (l_del) {
>> ret = __insert_pending(inode, last, prealloc);
>> @@ -2264,7 +2264,7 @@ static int __revise_pending(struct inode *inode, ext4_lblk_t lblk,
>> } else {
>> first = EXT4_LBLK_CMASK(sbi, lblk);
>> if (first != lblk)
>> - f_del = __es_scan_range(inode, &ext4_es_is_delonly,
>> + f_del = __es_scan_range(inode, &ext4_es_is_delayed,
>> first, lblk - 1);
>> if (f_del) {
>> ret = __insert_pending(inode, first, prealloc);
>> @@ -2276,7 +2276,7 @@ static int __revise_pending(struct inode *inode, ext4_lblk_t lblk,
>>
>> last = EXT4_LBLK_CMASK(sbi, end) + sbi->s_cluster_ratio - 1;
>> if (last != end)
>> - l_del = __es_scan_range(inode, &ext4_es_is_delonly,
>> + l_del = __es_scan_range(inode, &ext4_es_is_delayed,
>> end + 1, last);
>> if (l_del) {
>> ret = __insert_pending(inode, last, prealloc);
>> diff --git a/fs/ext4/extents_status.h b/fs/ext4/extents_status.h
>> index 5b49cb3b9aff..e484c60e55e3 100644
>> --- a/fs/ext4/extents_status.h
>> +++ b/fs/ext4/extents_status.h
>> @@ -184,11 +184,6 @@ static inline int ext4_es_is_mapped(struct extent_status *es)
>> return (ext4_es_is_written(es) || ext4_es_is_unwritten(es));
>> }
>>
>> -static inline int ext4_es_is_delonly(struct extent_status *es)
>> -{
>> - return (ext4_es_is_delayed(es) && !ext4_es_is_unwritten(es));
>> -}
>> -
>> static inline void ext4_es_set_referenced(struct extent_status *es)
>> {
>> es->es_pblk |= ((ext4_fsblk_t)EXTENT_STATUS_REFERENCED) << ES_SHIFT;
>> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
>> index 8bd65a45a26a..2b301c165468 100644
>> --- a/fs/ext4/inode.c
>> +++ b/fs/ext4/inode.c
>> @@ -1645,7 +1645,7 @@ static int ext4_clu_alloc_state(struct inode *inode, ext4_lblk_t lblk)
>> int ret;
>>
>> /* Has delalloc reservation? */
>> - if (ext4_es_scan_clu(inode, &ext4_es_is_delonly, lblk))
>> + if (ext4_es_scan_clu(inode, &ext4_es_is_delayed, lblk))
>> return 1;
>>
>> /* Already been allocated? */
>> @@ -1766,7 +1766,7 @@ static int ext4_da_map_blocks(struct inode *inode, struct ext4_map_blocks *map)
>> * Delayed extent could be allocated by fallocate.
>> * So we need to check it.
>> */
>> - if (ext4_es_is_delonly(&es)) {
>> + if (ext4_es_is_delayed(&es)) {
>> map->m_flags |= EXT4_MAP_DELAYED;
>> return 0;
>> }
>> --
>> 2.39.2
>>
next prev parent reply other threads:[~2024-08-08 11:21 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-02 11:51 [PATCH v2 00/10] ext4: simplify the counting and management of delalloc reserved blocks Zhang Yi
2024-08-02 11:51 ` [PATCH v2 01/10] ext4: factor out ext4_map_create_blocks() to allocate new blocks Zhang Yi
2024-08-06 14:38 ` Jan Kara
2024-08-02 11:51 ` [PATCH v2 02/10] ext4: optimize the EXT4_GET_BLOCKS_DELALLOC_RESERVE flag set Zhang Yi
2024-08-06 14:48 ` Jan Kara
2024-08-02 11:51 ` [PATCH v2 03/10] ext4: don't set EXTENT_STATUS_DELAYED on allocated blocks Zhang Yi
2024-08-06 15:23 ` Jan Kara
2024-08-07 12:18 ` Zhang Yi
2024-08-07 13:37 ` Jan Kara
2024-08-02 11:51 ` [PATCH v2 04/10] ext4: let __revise_pending() return newly inserted pendings Zhang Yi
2024-08-02 11:51 ` [PATCH v2 05/10] ext4: count removed reserved blocks for delalloc only extent entry Zhang Yi
2024-08-02 11:51 ` [PATCH v2 06/10] ext4: update delalloc data reserve spcae in ext4_es_insert_extent() Zhang Yi
2024-08-07 17:41 ` Jan Kara
2024-08-08 11:18 ` Zhang Yi
2024-08-08 18:36 ` Jan Kara
2024-08-09 3:35 ` Zhang Yi
2024-08-09 16:20 ` Jan Kara
2024-08-10 4:01 ` Zhang Yi
2024-08-02 11:51 ` [PATCH v2 07/10] ext4: drop ext4_es_delayed_clu() Zhang Yi
2024-08-02 11:51 ` [PATCH v2 08/10] ext4: use ext4_map_query_blocks() in ext4_map_blocks() Zhang Yi
2024-08-07 17:43 ` Jan Kara
2024-08-02 11:51 ` [PATCH v2 09/10] ext4: drop ext4_es_is_delonly() Zhang Yi
2024-08-07 17:48 ` Jan Kara
2024-08-08 11:21 ` Zhang Yi [this message]
2024-08-02 11:51 ` [PATCH v2 10/10] ext4: drop all delonly descriptions Zhang Yi
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=d71862a9-aeee-0db1-31de-2883cb32c28e@huaweicloud.com \
--to=yi.zhang@huaweicloud.com \
--cc=adilger.kernel@dilger.ca \
--cc=chengzhihao1@huawei.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ritesh.list@gmail.com \
--cc=tytso@mit.edu \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.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