Linux EXT4 FS development
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Cc: Jan Kara <jack@suse.cz>,
	linux-ext4@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
	Ritesh Harjani <riteshh@linux.ibm.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ritesh Harjani <ritesh.list@gmail.com>
Subject: Re: [RFC 04/11] ext4: Convert mballoc cr (criteria) to enum
Date: Thu, 20 Apr 2023 16:58:15 +0200	[thread overview]
Message-ID: <20230420145815.rs4amtveq4v3qz6p@quack3> (raw)
In-Reply-To: <ZEDcjKUG3OjK9hg9@li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com>

On Thu 20-04-23 12:02:44, Ojaswin Mujoo wrote:
> On Sat, Mar 25, 2023 at 08:12:36PM +0530, Ojaswin Mujoo wrote:
> > On Thu, Mar 23, 2023 at 11:55:37AM +0100, Jan Kara wrote:
> > > On Fri 17-03-23 15:56:46, Ojaswin Mujoo wrote:
> > > > On Thu, Mar 09, 2023 at 01:11:22PM +0100, Jan Kara wrote:
> > > > > Also when going for symbolic allocator scan names maybe we could actually
> > > > > make names sensible instead of CR[0-4]? Perhaps like CR_ORDER2_ALIGNED,
> > > > > CR_BEST_LENGHT_FAST, CR_BEST_LENGTH_ALL, CR_ANY_FREE. And probably we could
> > > > > deal with ordered comparisons like in:
> > > > I like this idea, it should make the code a bit more easier to
> > > > understand. However just wondering if I should do it as a part of this
> > > > series or a separate patch since we'll be touching code all around and 
> > > > I don't want to confuse people with the noise :) 
> > > 
> > > I guess a mechanical rename should not be really confusing. It just has to
> > > be a separate patch.
> > Alright, got it.
> > > 
> > > > > 
> > > > >                 if (cr < 2 &&
> > > > >                     (!sbi->s_log_groups_per_flex ||
> > > > >                      ((group & ((1 << sbi->s_log_groups_per_flex) - 1)) != 0)) &
> > > > >                     !(ext4_has_group_desc_csum(sb) &&
> > > > >                       (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))))
> > > > >                         return 0;
> > > > > 
> > > > > to declare CR_FAST_SCAN = 2, or something like that. What do you think?
> > > > About this, wont it be better to just use something like
> > > > 
> > > > cr < CR_BEST_LENGTH_ALL 
> > > > 
> > > > instead of defining a new CR_FAST_SCAN = 2.
> > > 
> > > Yeah, that works as well.
> > > 
> > > > The only concern is that if we add a new "fast" CR (say between
> > > > CR_BEST_LENGTH_FAST and CR_BEST_LENGTH_ALL) then we'll need to make
> > > > sure we also update CR_FAST_SCAN to 3 which is easy to miss.
> > > 
> > > Well, you have that problem with any naming scheme (and even with numbers).
> > > So as long as names are all defined together, there's reasonable chance
> > > you'll remember to verify the limits still hold :)
> > haha that's true. Anyways, I'll try a few things and see what looks
> > good. Thanks for the suggestions.
> Hey Jan,
> 
> So I was playing around with this and I prepare a patch to convert CR
> numbers to symbolic names and it looks good as far as things like these
> are concerned:
> 
>   if (cr < CR_POWER2_ALIGNED)
> 		...
> 
> However there's one problem that this numeric naming scheme is used in
> several places like struct member names, function names, traces and
> comments. The issue is that replacing it everywhere is making some of
> the names very long for example:
> 
> 	atomic_read(&sbi->s_bal_cr0_bad_suggestions));
> 
> becomes:
> 
> 	atomic_read(&sbi->s_bal_cr_power2_aligned_bad_suggestions));
> 
> And this is kind of making the code look messy at a lot of places. So
> right now there are a few options we can consider:
> 
> 1. Use symbolic names everywhere at the cost of readability

Can we maybe go with 1b) being: Use symbolic names in variables / members /
...  but shortened? Like s_bal_p2aligned_bad_suggestions? Not sure how many
things are like this but from a quick looks it seems we need to come up
with a sensible shortcut only for cr0 and cr1?

								Honza

-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2023-04-20 14:58 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27 12:37 [RFC 00/11] multiblock allocator improvements Ojaswin Mujoo
2023-01-27 12:37 ` [RFC 01/11] ext4: mballoc: Remove useless setting of ac_criteria Ojaswin Mujoo
2023-03-09 11:36   ` Jan Kara
2023-01-27 12:37 ` [RFC 02/11] ext4: Remove unused extern variables declaration Ojaswin Mujoo
2023-03-09 11:37   ` Jan Kara
2023-01-27 12:37 ` [RFC 03/11] ext4: mballoc: Fix getting the right group desc in ext4_mb_prefetch_fini Ojaswin Mujoo
2023-03-09 11:42   ` Jan Kara
2023-01-27 12:37 ` [RFC 04/11] ext4: Convert mballoc cr (criteria) to enum Ojaswin Mujoo
2023-03-09 12:11   ` Jan Kara
2023-03-17 10:26     ` Ojaswin Mujoo
2023-03-23 10:55       ` Jan Kara
2023-03-25 14:42         ` Ojaswin Mujoo
2023-04-20  6:32           ` Ojaswin Mujoo
2023-04-20 14:58             ` Jan Kara [this message]
2023-01-27 12:37 ` [RFC 05/11] ext4: Add per CR extent scanned counter Ojaswin Mujoo
2023-03-09 12:14   ` Jan Kara
2023-01-27 12:37 ` [RFC 06/11] ext4: Add counter to track successful allocation of goal length Ojaswin Mujoo
2023-03-09 12:17   ` Jan Kara
2023-01-27 12:37 ` [RFC 07/11] ext4: Avoid scanning smaller extents in BG during CR1 Ojaswin Mujoo
2023-03-09 12:20   ` Jan Kara
2023-01-27 12:37 ` [RFC 08/11] ext4: Don't skip prefetching BLOCK_UNINIT groups Ojaswin Mujoo
2023-03-09 14:14   ` Jan Kara
2023-03-17 10:55     ` Ojaswin Mujoo
2023-03-23 10:57       ` Jan Kara
2023-03-25 14:43         ` Ojaswin Mujoo
2023-03-26  3:54       ` Theodore Ts'o
2023-01-27 12:37 ` [RFC 09/11] ext4: Ensure ext4_mb_prefetch_fini() is called for all prefetched BGs Ojaswin Mujoo
2023-03-09 14:23   ` Jan Kara
2023-01-27 12:37 ` [RFC 10/11] ext4: Abstract out logic to search average fragment list Ojaswin Mujoo
2023-03-09 14:25   ` Jan Kara
2023-01-27 12:37 ` [RFC 11/11] ext4: Add allocation criteria 1.5 (CR1_5) Ojaswin Mujoo
2023-03-09 15:06   ` Jan Kara
2023-03-17 11:37     ` Ojaswin Mujoo
2023-03-23 11:05       ` Jan Kara
2023-03-25 14:46         ` 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=20230420145815.rs4amtveq4v3qz6p@quack3 \
    --to=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=riteshh@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