[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZJ2YIr5EVbz4ezIc@li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com>
Date: Thu, 29 Jun 2023 20:11:38 +0530
From: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
To: Jan Kara <jack@...e.cz>
Cc: linux-ext4@...r.kernel.org, "Theodore Ts'o" <tytso@....edu>,
Ritesh Harjani <riteshh@...ux.ibm.com>,
linux-kernel@...r.kernel.org,
Kemeng Shi <shikemeng@...weicloud.com>
Subject: Re: [PATCH] ext4: Replace CR_FAST macro with inline function for
readability
On Thu, Jun 29, 2023 at 04:00:18PM +0200, Jan Kara wrote:
> On Thu 29-06-23 19:17:19, Ojaswin Mujoo wrote:
> > Replace CR_FAST with ext4_mb_cr_expensive() inline function for better
> > readability. This function returns true if the criteria is one of the
> > expensive/slower ones where lots of disk IO/prefetching is acceptable.
> >
> > No functional changes are intended in this patch.
> >
> > Signed-off-by: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
>
> Thanks for this cleanup! Feel free to add:
>
> Reviewed-by: Jan Kara <jack@...e.cz>
>
> Just one suggestion for consideration below:
>
> > @@ -2630,7 +2630,7 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,
> > free = grp->bb_free;
> > if (free == 0)
> > goto out;
> > - if (cr <= CR_FAST && free < ac->ac_g_ex.fe_len)
> > + if (cr <= CR_GOAL_LEN_SLOW && free < ac->ac_g_ex.fe_len)
>
> Maybe this could be (!ext4_mb_cr_expensive(cr) || cr == CR_GOAL_LEN_SLOW)?
> Or maybe more explanatory would be (cr < CR_ANY_FREE) because AFAIU that's
> the only scan where we bother scanning groups that have no chance of
> satisfying the full allocation? Anyway a short comment explaining this
> might be useful. And in either case we can get rid of a bit confusing
> CR_FAST define.
>
> Honza
Thanks for the review Jan! I actually had the same idea since it
felt like (cr <= CR_GOAL_LEN_SLOW) doesnt clearly express the intent of this
check. I think I ultimately decided to leave it untouched to keep things
simple.
However, I like the idea of making it (cr < CR_ANY_FREE) with a comment
to explain the intent behind this condition. If it's fine with everyone I can
address it in v2.
Regards,
ojaswin
> --
> Jan Kara <jack@...e.com>
> SUSE Labs, CR
Powered by blists - more mailing lists