[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD+ocbxiLYy6fMdcW_WoR6KvXBqE6eu5uyFgZfgUVwVLYBOGMw@mail.gmail.com>
Date: Wed, 4 Nov 2020 13:35:44 -0800
From: harshad shirwadkar <harshadshirwadkar@...il.com>
To: Jan Kara <jack@...e.cz>
Cc: Ext4 Developers List <linux-ext4@...r.kernel.org>,
"Theodore Y. Ts'o" <tytso@....edu>
Subject: Re: [PATCH 06/10] ext4: dedpulicate the code to wait on inode that's
being committed
On Tue, Nov 3, 2020 at 8:42 AM Jan Kara <jack@...e.cz> wrote:
>
> On Sat 31-10-20 13:05:14, Harshad Shirwadkar wrote:
> > This patch removes the deduplicates the code that implements waiting
> > on inode that's being committed. That code is moved into a new
> > function.
> >
> > Suggested-by: Jan Kara <jack@...e.cz>
> > Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@...il.com>
>
> Looks good to me. Just one nit below:
>
> > diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
> > index b1ca55c7d32a..0f2543220d1d 100644
> > --- a/fs/ext4/fast_commit.c
> > +++ b/fs/ext4/fast_commit.c
> > @@ -155,6 +155,28 @@ void ext4_fc_init_inode(struct inode *inode)
> > ei->i_fc_committed_subtid = 0;
> > }
> >
> > +static void ext4_fc_wait_committing_inode(struct inode *inode)
> > +{
> > + wait_queue_head_t *wq;
> > + struct ext4_inode_info *ei = EXT4_I(inode);
> > +
>
> Maybe add lockdep_assert_held(&EXT4_SB(inode->i_sb)->s_fc_lock) here to
> make sure the function is called properly? It's kind of unobvious
> requirement (but hard to avoid)...
Sounds good. I had to add it after the #ifdef and before the
"prepare_to_wait()" call in order to avoid "ISO C90 forbids mixed
declarations and code [-Wd
eclaration-after-statement]" warning.
Thanks,
Harshad
>
> > +#if (BITS_PER_LONG < 64)
> > + DEFINE_WAIT_BIT(wait, &ei->i_state_flags,
> > + EXT4_STATE_FC_COMMITTING);
> > + wq = bit_waitqueue(&ei->i_state_flags,
> > + EXT4_STATE_FC_COMMITTING);
> > +#else
> > + DEFINE_WAIT_BIT(wait, &ei->i_flags,
> > + EXT4_STATE_FC_COMMITTING);
> > + wq = bit_waitqueue(&ei->i_flags,
> > + EXT4_STATE_FC_COMMITTING);
> > +#endif
> > + prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE);
> > + spin_unlock(&EXT4_SB(inode->i_sb)->s_fc_lock);
> > + schedule();
> > + finish_wait(wq, &wait.wq_entry);
> > +}
> > +
>
> Honza
> --
> Jan Kara <jack@...e.com>
> SUSE Labs, CR
Powered by blists - more mailing lists