From: Kemeng Shi <shikemeng@huaweicloud.com>
To: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 03/21] ext4: avoid to use preallocated blocks if EXT4_MB_HINT_GOAL_ONLY is set
Date: Mon, 13 Feb 2023 21:27:03 +0800 [thread overview]
Message-ID: <f967d63b-907e-a495-3ec5-9043c35b9938@huaweicloud.com> (raw)
In-Reply-To: <Y+n2+7pjkeb3vWQ7@li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com>
on 2/13/2023 4:38 PM, Ojaswin Mujoo wrote:
> On Fri, Feb 10, 2023 at 03:48:07AM +0800, Kemeng Shi wrote:
>> ext4_mb_use_preallocated will ignore the demand to alloc at goal block
>> only. Return false if EXT4_MB_HINT_GOAL_ONLY is set before use
>> preallocated blocks in ext4_mb_use_preallocated.
>>
>> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
>> ---
>> fs/ext4/mballoc.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
>> index 375d9655b525..352ac9139fee 100644
>> --- a/fs/ext4/mballoc.c
>> +++ b/fs/ext4/mballoc.c
>> @@ -4368,6 +4368,9 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac)
>> if (!(ac->ac_flags & EXT4_MB_HINT_DATA))
>> return false;
>>
>> + if (unlikely(ac->ac_flags & EXT4_MB_HINT_GOAL_ONLY))
>> + return false;
>> +
>> /* first, try per-file preallocation */
>> rcu_read_lock();
>> list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) {
>> --
>> 2.30.0
>>
> So with the flag, even when we request for a logical/goal block
> combination that can be satisfied by one of the inode PAs in the list,
> we would still exit early and the allocation would eventually fail since
> the goal block would be marked "in-use" in the buddy. This doesn't seem
> to be desirable.
>
> Maybe instead of exiting early we should try to find a PA that satisfies
> the logical block we are asking for and then incase of
> EXT4_MB_HINT_GOAL_ONLY, we can add a check to see if the physical block
> of the PA corresponds to the goal block. Would like to hear your
> thoughts on this.
Yes, this is a more thoughtful, I will improve this in next version.
Besides, maybe we should also test length if EXT4_MB_HINT_MERGE is set
as ext4_mb_find_by_goal do.
> Regards,
> ojaswin
>
--
Best wishes
Kemeng Shi
next prev parent reply other threads:[~2023-02-13 13:27 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-09 19:48 [PATCH 00/21] Some bugfix and cleanup to mballoc Kemeng Shi
2023-02-09 19:48 ` [PATCH 01/21] ext4: set goal start correctly in ext4_mb_normalize_request Kemeng Shi
2023-02-13 6:56 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 02/21] ext4: allow to find by goal if EXT4_MB_HINT_GOAL_ONLY is set Kemeng Shi
2023-02-13 6:57 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 03/21] ext4: avoid to use preallocated blocks " Kemeng Shi
2023-02-13 8:38 ` Ojaswin Mujoo
2023-02-13 13:27 ` Kemeng Shi [this message]
2023-02-09 19:48 ` [PATCH 04/21] ext4: get correct ext4_group_info in ext4_mb_prefetch_fini Kemeng Shi
2023-02-13 7:03 ` Ojaswin Mujoo
2023-02-13 12:27 ` Kemeng Shi
2023-02-13 20:14 ` Ojaswin Mujoo
2023-02-14 1:12 ` Kemeng Shi
2023-02-17 6:46 ` Ritesh Harjani
2023-02-17 7:19 ` Kemeng Shi
2023-02-09 19:48 ` [PATCH 05/21] ext4: correct calculation of s_mb_preallocated Kemeng Shi
2023-02-13 7:04 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 06/21] ext4: correct start of used group pa for debug in ext4_mb_use_group_pa Kemeng Shi
2023-02-13 7:09 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 07/21] ext4: protect pa->pa_free in ext4_discard_allocated_blocks Kemeng Shi
2023-02-13 8:42 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 08/21] ext4: add missed brelse in ext4_free_blocks_simple Kemeng Shi
2023-02-13 19:46 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 09/21] ext4: remove unused return value of ext4_mb_try_best_found and ext4_mb_free_metadata Kemeng Shi
2023-02-13 19:47 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 10/21] ext4: Remove unnecessary release when memory allocation failed in ext4_mb_init_cache Kemeng Shi
2023-02-13 19:48 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 11/21] ext4: remove unnecessary e4b->bd_buddy_page check in ext4_mb_load_buddy_gfp Kemeng Shi
2023-02-13 19:48 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 12/21] ext4: remove unnecessary check in ext4_mb_new_blocks Kemeng Shi
2023-02-13 19:49 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 13/21] ext4: remove dead check in mb_buddy_mark_free Kemeng Shi
2023-02-13 19:50 ` Ojaswin Mujoo
2023-02-17 1:24 ` Kemeng Shi
2023-02-09 19:48 ` [PATCH 14/21] ext4: remove ac->ac_found > sbi->s_mb_min_to_scan dead check in ext4_mb_check_limits Kemeng Shi
2023-02-13 19:51 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 15/21] ext4: use best found when complex scan of group finishs Kemeng Shi
2023-02-13 19:53 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 16/21] ext4: remove unnecessary exit_meta_group_info tag Kemeng Shi
2023-02-13 19:54 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 17/21] ext4: remove unnecessary count2 in ext4_free_data_in_buddy Kemeng Shi
2023-02-13 19:56 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 18/21] ext4: remove unnecessary goto in ext4_mb_mark_diskspace_used Kemeng Shi
2023-02-13 19:58 ` Ojaswin Mujoo
2023-02-17 6:36 ` Ritesh Harjani
2023-02-09 19:48 ` [PATCH 19/21] ext4: remove repeat assignment to ac_f_ex Kemeng Shi
2023-02-13 20:10 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 20/21] ext4: remove comment code ext4_discard_preallocations Kemeng Shi
2023-02-13 20:11 ` Ojaswin Mujoo
2023-02-09 19:48 ` [PATCH 21/21] ext4: simplify calculation of blkoff in ext4_mb_new_blocks_simple Kemeng Shi
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=f967d63b-907e-a495-3ec5-9043c35b9938@huaweicloud.com \
--to=shikemeng@huaweicloud.com \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).