diff options
| author | Mateusz Guzik <mjguzik@gmail.com> | 2025-10-11 00:17:36 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-11-25 10:32:39 +0100 |
| commit | a27628f4363435beac84b55c749c41a005054d30 (patch) | |
| tree | 23c7382d96e094039462df3aac506bac125fa588 /fs/dcache.c | |
| parent | 11f2af2a80b5f9dcfc829c64e0ad176e011ddf60 (diff) | |
| download | tip-a27628f4363435beac84b55c749c41a005054d30.tar.gz | |
fs: rework I_NEW handling to operate without fences
In the inode hash code grab the state while ->i_lock is held. If found
to be set, synchronize the sleep once more with the lock held.
In the real world the flag is not set most of the time.
Apart from being simpler to reason about, it comes with a minor speed up
as now clearing the flag does not require the smp_mb() fence.
While here rename wait_on_inode() to wait_on_new_inode() to line it up
with __wait_on_freeing_inode().
Christian Brauner <brauner@kernel.org> says:
As per the discussion in [1] I folded in the diff sent in [2].
Link: https://lore.kernel.org/69238e4d.a70a0220.d98e3.006e.GAE@google.com [1]
Link: https://lore.kernel.org/c2kpawomkbvtahjm7y5mposbhckb7wxthi3iqy5yr22ggpucrm@ufvxwy233qxo [2]
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://patch.msgid.link/20251010221737.1403539-1-mjguzik@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/dcache.c')
| -rw-r--r-- | fs/dcache.c | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 78ffa7b7e824fc..25131f105a60ec 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1981,17 +1981,7 @@ void d_instantiate_new(struct dentry *entry, struct inode *inode) spin_lock(&inode->i_lock); __d_instantiate(entry, inode); WARN_ON(!(inode_state_read(inode) & I_NEW)); - /* - * Pairs with smp_rmb in wait_on_inode(). - */ - smp_wmb(); inode_state_clear(inode, I_NEW | I_CREATING); - /* - * Pairs with the barrier in prepare_to_wait_event() to make sure - * ___wait_var_event() either sees the bit cleared or - * waitqueue_active() check in wake_up_var() sees the waiter. - */ - smp_mb(); inode_wake_up_bit(inode, __I_NEW); spin_unlock(&inode->i_lock); } |
