Thread (11 messages) 11 messages, 3 authors, 2025-09-22

Re: [PATCH v5 3/4] Manual conversion of ->i_state uses

From: Mateusz Guzik <hidden>
Date: 2025-09-22 11:41:53
Also in: ceph-devel, linux-btrfs, linux-fsdevel, linux-unionfs, linux-xfs, lkml

On Mon, Sep 22, 2025 at 1:31 PM Jan Kara [off-list ref] wrote:
On Fri 19-09-25 17:49:03, Mateusz Guzik wrote:
quoted
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 <redacted>
...
quoted
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
quoted
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 [off-list ref]
SUSE Labs, CR
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help