public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: NeilBrown <neil@brown.name>
Cc: Jan Kara <jack@suse.cz>, Theodore Ts'o <tytso@mit.edu>,
	 Andreas Dilger <adilger.kernel@dilger.ca>,
	linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/3] ext4: add ext4_fc_eligible()
Date: Fri, 20 Mar 2026 11:24:41 +0100	[thread overview]
Message-ID: <swsnaqghu7pkvmxj5tonqera2gplyvpxmpusxlreqpyjg2ea3j@b7g7pabdp74x> (raw)
In-Reply-To: <177396306176.3934327.9167241352093307006@noble.neil.brown.name>

On Fri 20-03-26 10:31:01, NeilBrown wrote:
> On Thu, 19 Mar 2026, Jan Kara wrote:
> > On Wed 18-03-26 09:39:50, NeilBrown wrote:
> > > From: NeilBrown <neil@brown.name>
> > > 
> > > Testing EXT4_MF_FC_INELIGIBLE is almost always combined with testing
> > > ext4_fc_disabled().  The code can be simplified by combining these two
> > > in a new ext4_fc_eligible().
> > > 
> > > In ext4_fc_track_inode() this moves the ext4_fc_disabled() test after
> > > ext4_fc_mark_ineligible(), but as that is a non-op when
> > > ext4_fc_disabled() is true, this is no no consequence.
> > > 
> > > Signed-off-by: NeilBrown <neil@brown.name>
> > 
> > One nit below, otherwise feel free to add:
> > 
> > Reviewed-by: Jan Kara <jack@suse.cz>
> > 
> > > @@ -557,16 +548,13 @@ void ext4_fc_track_inode(handle_t *handle, struct inode *inode)
> > >  	if (S_ISDIR(inode->i_mode))
> > >  		return;
> > >  
> > > -	if (ext4_fc_disabled(inode->i_sb))
> > > -		return;
> > > -
> > >  	if (ext4_should_journal_data(inode)) {
> > >  		ext4_fc_mark_ineligible(inode->i_sb,
> > >  					EXT4_FC_REASON_INODE_JOURNAL_DATA, handle);
> > >  		return;
> > >  	}
> > >  
> > > -	if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE))
> > > +	if (!ext4_fc_eligible(inode->i_sb))
> > >  		return;
> > 
> > Here I think the !ext4_fc_eligible() check could be actually above the
> > ext4_should_journal_data() check - if the fs is not eligible for
> > fastcommit, there's no point in marking it ineligible again...
> 
> Both you and Andreas have questioned that choice - so I should explain
> my reasoning.
> 
> ext4_fc_mark_ineligible() is NOT a no-op when the sb is already marked
> ineligible.  The code updates sb->s_fc_ineligible_tid to the largest tid
> which was ineligible for fc.  Then it only clears the "ineligible" flag
> after that highest numbered transaction has committed.  If we skip
> ext4_fc_mark_ineligible() because EXT4_MF_FC_INELIGIBLE is already set,
> then that flag could be cleared too early.

Oops, you're right. I forgot about this subtlety. Thanks for explanation!

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

  parent reply	other threads:[~2026-03-20 10:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17 22:39 [PATCH 0/3] ext4: remove use of d_alloc() NeilBrown
2026-03-17 22:39 ` [PATCH 1/3] ext4: split __ext4_add_entry() out of ext4_add_entry() NeilBrown
2026-03-18  0:20   ` Andreas Dilger
2026-03-18 17:56   ` Jan Kara
2026-03-17 22:39 ` [PATCH 2/3] ext4: add ext4_fc_eligible() NeilBrown
2026-03-18  0:27   ` Andreas Dilger
2026-03-18 17:57   ` Jan Kara
2026-03-19 23:31     ` NeilBrown
2026-03-20  5:12       ` Andreas Dilger
2026-03-20 10:24       ` Jan Kara [this message]
2026-03-17 22:39 ` [PATCH 3/3] ext4: move dcache manipulation out of __ext4_link() NeilBrown
2026-03-18 18:03   ` Jan Kara

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=swsnaqghu7pkvmxj5tonqera2gplyvpxmpusxlreqpyjg2ea3j@b7g7pabdp74x \
    --to=jack@suse.cz \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=neil@brown.name \
    --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