From: Jan Kara <jack@suse.cz>
To: Luis Henriques <luis.henriques@linux.dev>
Cc: Jan Kara <jack@suse.cz>, Theodore Ts'o <tytso@mit.edu>,
Andreas Dilger <adilger@dilger.ca>,
Harshad Shirwadkar <harshadshirwadkar@gmail.com>,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ext4: fix fast commit inode enqueueing during a full journal commit
Date: Tue, 28 May 2024 12:36:02 +0200 [thread overview]
Message-ID: <20240528103602.akx2gui5ownj25l3@quack3> (raw)
In-Reply-To: <87msob45o7.fsf@brahms.olymp>
On Mon 27-05-24 16:48:24, Luis Henriques wrote:
> On Mon 27 May 2024 09:29:40 AM +01, Luis Henriques wrote;
> >>> + /*
> >>> + * Used to flag an inode as part of the next fast commit; will be
> >>> + * reset during fast commit clean-up
> >>> + */
> >>> + tid_t i_fc_next;
> >>> +
> >>
> >> Do we really need new tid in the inode? I'd be kind of hoping we could use
> >> EXT4_I(inode)->i_sync_tid for this - I can see we even already set it in
> >> ext4_fc_track_template() and used for similar comparisons in fast commit
> >> code.
> >
> > Ah, true. It looks like it could be used indeed. We'll still need a flag
> > here, but a simple bool should be enough for that.
>
> After looking again at the code, I'm not 100% sure that this is actually
> doable. For example, if I replace the above by
>
> bool i_fc_next;
>
> and set to to 'true' below:
>
> >>> diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
> >>> index 87c009e0c59a..bfdf249f0783 100644
> >>> --- a/fs/ext4/fast_commit.c
> >>> +++ b/fs/ext4/fast_commit.c
> >>> @@ -402,6 +402,8 @@ static int ext4_fc_track_template(
> >>> sbi->s_journal->j_flags & JBD2_FAST_COMMIT_ONGOING) ?
> >>> &sbi->s_fc_q[FC_Q_STAGING] :
> >>> &sbi->s_fc_q[FC_Q_MAIN]);
> >>> + else
> >>> + ei->i_fc_next = tid;
>
> ei->i_fc_next = true;
>
> Then, when we get to the ext4_fc_cleanup(), the value of iter->i_sync_tid
> may have changed in the meantime from, e.g., ext4_do_update_inode() or
> __ext4_iget(). This would cause the clean-up code to be bogus if it still
> implements a the logic below, by comparing the tid with i_sync_tid.
> (Although, to be honest, I couldn't see any visible effect in the quick
> testing I've done.) Or am I missing something, and this is *exactly* the
> behaviour you'd expect?
Yes, this is the behavior I'd expect. The rationale is that if i_sync_tid
points to the running transaction, it means the inode was modified in it,
which means fastcommit needs to write it out. In fact the
ext4_update_inode_fsync_trans() calls usually happen together with
ext4_fc_track_...() calls. This could use some cleanup so that we don't set
i_sync_tid in two places unnecessarily but that's for some other time...
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2024-05-28 10:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-23 11:16 [PATCH v2] ext4: fix fast commit inode enqueueing during a full journal commit Luis Henriques (SUSE)
2024-05-24 16:22 ` Jan Kara
2024-05-27 8:29 ` Luis Henriques
2024-05-27 15:48 ` Luis Henriques
2024-05-28 10:36 ` Jan Kara [this message]
2024-05-28 10:52 ` Jan Kara
2024-05-28 15:50 ` Luis Henriques
2024-05-29 0:01 ` harshad shirwadkar
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=20240528103602.akx2gui5ownj25l3@quack3 \
--to=jack@suse.cz \
--cc=adilger@dilger.ca \
--cc=harshadshirwadkar@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luis.henriques@linux.dev \
--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