lkml.org 
[lkml]   [2023]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@linux.ibm.com>
>
> Thanks for this cleanup! Feel free to add:
>
> Reviewed-by: Jan Kara <jack@suse.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@suse.com>
> SUSE Labs, CR

\
 
 \ /
  Last update: 2023-06-29 16:45    [W:0.027 / U:0.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site