All of lore.kernel.org
 help / color / mirror / Atom feed
From: harshad shirwadkar <harshadshirwadkar@gmail.com>
To: Xin Yin <yinxin.x@bytedance.com>
Cc: Ritesh Harjani <riteshh@linux.ibm.com>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>,
	"Theodore Ts'o" <tytso@mit.edu>, Jan Kara <jack@suse.cz>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [External] [RFC 9/9] ext4: fast_commit missing tracking updates to a file
Date: Sun, 27 Feb 2022 12:51:52 -0800	[thread overview]
Message-ID: <CAD+ocbySFC=fzqotCdg5hsNE8D3H_7eoU2QdHE0jmsa+z_x0qw@mail.gmail.com> (raw)
In-Reply-To: <CAK896s7GsY_qGPZpA0KvmfsA7frkP0=nO8Fg3qd-ObmL-g+8AA@mail.gmail.com>

> > So, yes these are few corner cases which I want to take a deeper look at.
> > I vaugely understand that this reset inode is done since we anyway might have
> > done the full commit for previous tid, so we can reset the inode track range.
> >
> > So, yes, we should carefully review this as well that if jbd2 commit happens for
> > an inode which is still part of MAIN_Q, then does it make sense to still
> > call ext4_fc_reset_inode() for that inode in ext4_fc_track_template()?
What this code assumes here is that if tid != ei->i_sync_tid, then the
fast commit information present in the inode cannot be trusted. This
is useful when the inode is added to the fast commit queue for the
first ever or first time during the current transaction. Also note the
"update" parameter, if update is set to false, then the track
functions know that this is the first time the track function is
called since the last (fast / full) commit.

I think the simple invariant that we need to follow is that, once an
inode is committed (either by fast or full commit)
ext4_fc_reset_inode() should be called exactly once before any track
functions get called. So, if we can ensure that reset gets called on
all inodes that were committed by fast commit / full commit exactly
once before any track functions update the fc info, then we don't
really need this reset call here.

> > > > 2. Also is this an expected behavior from the design perspective of
> > > >    fast_commit. i.e.
> > > >    a. the inode can be part of two tids?
From a design perspective, in fast commits, inode updates are not
strictly tied to tids. We reuse i_sync_tid only to detect if the
updates to an inode are committed or not. But at a high level, inode
can be in 3 states from fc perspective - (1) inode is not modified
since last fast commit / full commit (2) inode is modified since last
fast commit / full commit (3) inode is being committed by fast commit.
Well, this makes me think that these states can also be represented by
inode states, and maybe if we do that we can get rid of reliance on
i_sync_tid altogether? This needs a bit more thought.
> > > >    b. And that while a full commit is in progress, the inode can still
> > > >    receive updates but using a new transaction tid.
Yeah, inode can still receive updates if a full commit is ongoing. If
a fast commit is ongoing on a particular update, then the inode will
not receive updates. EXT4_FC_STATE_COMMITTING will protect against it.
In the new patch that I'm working on (sorry for the delay on that),
what I'm doing is that handles that modify inode wait if the inode is
being committed.

- Harshad
> > > >
> > > > Frankly speaking, since I was also working on other things, so I haven't
> > > > yet got the chance to completely analyze the situation yet.
> > > > Once I have those things sorted, I will spend more time on this, to
> > > > understand it more. Meanwhile if you already have some answers to above
> > > > queries/observations, please do share those here.
> > > >
> > > > Links
> > > > =========
> > > > [1] https://raw.githubusercontent.com/riteshharjani/LinuxStudy/master/ext4/fast_commit/fc_inode_missing_updates_ino_979.txt
> > > >
> > > > Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
> > > > ---
> > > >  fs/ext4/fast_commit.c | 2 ++
> > > >  1 file changed, 2 insertions(+)
> > > >
> > > > diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
> > > > index 8803ba087b07..769b584c2552 100644
> > > > --- a/fs/ext4/fast_commit.c
> > > > +++ b/fs/ext4/fast_commit.c
> > > > @@ -1252,6 +1252,8 @@ static void ext4_fc_cleanup(journal_t *journal, int full, tid_t tid)
> > > >         spin_lock(&sbi->s_fc_lock);
> > > >         list_for_each_entry_safe(iter, iter_n, &sbi->s_fc_q[FC_Q_MAIN],
> > > >                                  i_fc_list) {
> > > > +               if (full && iter->i_sync_tid > tid)
> > > > +                       continue;
> > > >                 list_del_init(&iter->i_fc_list);
> > > >                 ext4_clear_inode_state(&iter->vfs_inode,
> > > >                                        EXT4_STATE_FC_COMMITTING);
> > > > --
> > > > 2.31.1
> > > >

  reply	other threads:[~2022-02-27 20:52 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22 20:34 [RFC 0/9] ext4: Improve FC trace events and discuss one FC failure Ritesh Harjani
2022-02-22 20:34 ` [RFC 1/9] ext4: Remove unused enum EXT4_FC_COMMIT_FAILED Ritesh Harjani
2022-02-23  9:37   ` Jan Kara
2022-02-27 18:27     ` harshad shirwadkar
2022-02-22 20:34 ` [RFC 2/9] ext4: Fix ext4_fc_stats trace point Ritesh Harjani
2022-02-22 20:52   ` Steven Rostedt
2022-02-23  9:54   ` Jan Kara
2022-02-27 18:29     ` harshad shirwadkar
2022-02-22 20:34 ` [RFC 3/9] ext4: Add couple of more fast_commit tracepoints Ritesh Harjani
2022-02-23  9:40   ` Jan Kara
2022-02-23 10:11     ` Ritesh Harjani
2022-02-23 11:53       ` Jan Kara
2022-02-23 12:04         ` Ritesh Harjani
2022-02-22 20:34 ` [RFC 4/9] ext4: Do not call FC trace event if FS does not support FC Ritesh Harjani
2022-02-23  9:41   ` Jan Kara
2022-02-27 18:30     ` harshad shirwadkar
2022-02-22 20:34 ` [RFC 5/9] ext4: Add commit_tid info in jbd debug log Ritesh Harjani
2022-02-23  9:42   ` Jan Kara
2022-02-27 18:31     ` harshad shirwadkar
2022-02-22 20:34 ` [RFC 6/9] ext4: Add commit tid info in ext4_fc_commit_start/stop trace events Ritesh Harjani
2022-02-23  9:44   ` Jan Kara
2022-02-27 18:31     ` harshad shirwadkar
2022-02-22 20:34 ` [RFC 7/9] ext4: Fix remaining two trace events to use same printk convention Ritesh Harjani
2022-02-23  9:45   ` Jan Kara
2022-02-27 18:32     ` harshad shirwadkar
2022-02-22 20:34 ` [RFC 8/9] ext4: Convert ext4_fc_track_dentry type events to use event class Ritesh Harjani
2022-02-23  9:49   ` Jan Kara
2022-02-27 18:35     ` harshad shirwadkar
2022-02-22 20:34 ` [RFC 9/9] ext4: fast_commit missing tracking updates to a file Ritesh Harjani
2022-02-23  3:50   ` [External] " Xin Yin
2022-02-23 13:58     ` Ritesh Harjani
2022-02-24 11:43       ` Xin Yin
2022-02-27 20:51         ` harshad shirwadkar [this message]
2022-03-09 17:48 ` [RFC 0/9] ext4: Improve FC trace events and discuss one FC failure Theodore Ts'o
2022-03-10  1:22   ` Ritesh Harjani

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='CAD+ocbySFC=fzqotCdg5hsNE8D3H_7eoU2QdHE0jmsa+z_x0qw@mail.gmail.com' \
    --to=harshadshirwadkar@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riteshh@linux.ibm.com \
    --cc=tytso@mit.edu \
    --cc=yinxin.x@bytedance.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.