]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
fs: rework I_NEW handling to operate without fences
authorMateusz Guzik <mjguzik@gmail.com>
Fri, 10 Oct 2025 22:17:36 +0000 (00:17 +0200)
committerChristian Brauner <brauner@kernel.org>
Tue, 25 Nov 2025 09:32:39 +0000 (10:32 +0100)
commita27628f4363435beac84b55c749c41a005054d30
tree23c7382d96e094039462df3aac506bac125fa588
parent11f2af2a80b5f9dcfc829c64e0ad176e011ddf60
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
Link: https://lore.kernel.org/c2kpawomkbvtahjm7y5mposbhckb7wxthi3iqy5yr22ggpucrm@ufvxwy233qxo
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>
fs/afs/dir.c
fs/dcache.c
fs/gfs2/glock.c
fs/inode.c
include/linux/fs.h