[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGudoHF6Q4xh=fiRwJ6+qiQSxovj3BeSdZYANAOQ_NnZg3bOXA@mail.gmail.com>
Date: Mon, 22 Sep 2025 13:41:37 +0200
From: Mateusz Guzik <mjguzik@...il.com>
To: Jan Kara <jack@...e.cz>
Cc: brauner@...nel.org, viro@...iv.linux.org.uk, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, josef@...icpanda.com, kernel-team@...com,
amir73il@...il.com, linux-btrfs@...r.kernel.org, linux-ext4@...r.kernel.org,
linux-xfs@...r.kernel.org, ceph-devel@...r.kernel.org,
linux-unionfs@...r.kernel.org
Subject: Re: [PATCH v5 3/4] Manual conversion of ->i_state uses
On Mon, Sep 22, 2025 at 1:31 PM Jan Kara <jack@...e.cz> wrote:
>
> On Fri 19-09-25 17:49:03, Mateusz Guzik wrote:
> > Takes care of spots not converted by coccinelle.
> >
> > Nothing to look at with one exception: smp_store_release and
> > smp_load_acquire pair replaced with a manual store/load +
> > smb_wmb()/smp_rmb(), see I_WB_SWITCH.
> >
> > Signed-off-by: Mateusz Guzik <mjguzik@...il.com>
>
> ...
>
> > diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> > index 0e9e96f10dd4..745df148baaa 100644
> > --- a/fs/fs-writeback.c
> > +++ b/fs/fs-writeback.c
> > @@ -478,8 +478,8 @@ static bool inode_do_switch_wbs(struct inode *inode,
> > * Paired with load_acquire in unlocked_inode_to_wb_begin() and
> > * ensures that the new wb is visible if they see !I_WB_SWITCH.
> > */
> > - smp_store_release(&inode->i_state,
> > - inode_state_read(inode) & ~I_WB_SWITCH);
> > + smp_wmb();
> > + inode_state_del(inode, I_WB_SWITCH);
> >
> > xa_unlock_irq(&mapping->i_pages);
> > spin_unlock(&inode->i_lock);
>
> Comments need updating here and in backing-dev.h...
>
turns out func name in the comment is also outdated
> > diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
> > index e721148c95d0..720e5f8ad782 100644
> > --- a/include/linux/backing-dev.h
> > +++ b/include/linux/backing-dev.h
> > @@ -292,7 +292,8 @@ unlocked_inode_to_wb_begin(struct inode *inode, struct wb_lock_cookie *cookie)
> > * Paired with store_release in inode_switch_wbs_work_fn() and
> > * ensures that we see the new wb if we see cleared I_WB_SWITCH.
> > */
> > - cookie->locked = smp_load_acquire(&inode->i_state) & I_WB_SWITCH;
> > + cookie->locked = inode_state_read(inode) & I_WB_SWITCH;
> > + smp_rmb();
> >
> > if (unlikely(cookie->locked))
> > xa_lock_irqsave(&inode->i_mapping->i_pages, cookie->flags);
>
> Honza
> --
> Jan Kara <jack@...e.com>
> SUSE Labs, CR
Powered by blists - more mailing lists