|
|
Log in / Subscribe / Register

assorted ->i_count-related changes

From:  Mateusz Guzik <mjguzik-AT-gmail.com>
To:  brauner-AT-kernel.org
Subject:  [PATCH 0/5] assorted ->i_count-related changes
Date:  Sat, 28 Mar 2026 16:31:40 +0100
Message-ID:  <20260328153146.3368470-1-mjguzik@gmail.com>
Cc:  viro-AT-zeniv.linux.org.uk, jack-AT-suse.cz, linux-kernel-AT-vger.kernel.org, linux-fsdevel-AT-vger.kernel.org, Mateusz Guzik <mjguzik-AT-gmail.com>
Archive-link:  Article

The icount_read_once() stuff lines up with inode_state_read_once().
The prefix is different but I opted to not change it due to igrab(),
ihold() et al.

There is a future-proofing change in iput_final(). I am not going to
strongly insist on it, but at the very least the problem needs to be
noted in a comment.

Finally, igrab() gets lockless treatment. I verified btrfs likes to call
into it in writeback code with the count > 1, same with procfs during
process reaping. Grep shows nfs also calls there, but I have not checked
how often that happens. This is a minor single-threaded speed up at
least as a lock trip is avoided in the common case.

Mateusz Guzik (5):
  fs: add icount_read_once()
  Use icount_read() and icount_read_once() as appropriate.
  fs: enforce locking in icount_read(), add some commentary
  fs: handle hypothetical filesystems hich use I_DONTCACHE and drop the
    lock in ->drop_inode
  fs: locklessly bump refs in igrab as long as it does not transition
    0->1

 arch/powerpc/platforms/cell/spufs/file.c |  2 +-
 fs/btrfs/inode.c                         |  2 +-
 fs/ceph/mds_client.c                     |  2 +-
 fs/ext4/ialloc.c                         |  4 +--
 fs/hpfs/inode.c                          |  2 +-
 fs/inode.c                               | 42 ++++++++++++++++--------
 fs/nfs/inode.c                           |  4 +--
 fs/smb/client/inode.c                    |  2 +-
 fs/ubifs/super.c                         |  2 +-
 fs/xfs/xfs_inode.c                       |  2 +-
 fs/xfs/xfs_trace.h                       |  2 +-
 include/linux/fs.h                       | 13 ++++++++
 include/trace/events/filelock.h          |  2 +-
 security/landlock/fs.c                   |  2 +-
 14 files changed, 55 insertions(+), 28 deletions(-)

-- 
2.48.1




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds