Skip to content

assorted ->i_count changes + extension of lockless handling

Mateusz Guzik linux-fsdevel lkml 6 versions – Applied

Status from this message: Applied to the vfs-7.2.inode branch of the vfs/vfs.git tree.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest3 patches 4 repliesApplied
  2. v54 patches 10 repliesSuperseded
  3. v44 patches 0 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v37 patches4 repliesSuperseded
v25 patches0 repliesSuperseded
v15 patches0 repliesSuperseded

v5 from the cover letter

- reword some commentary
- add unlikely to the new icount check in iput_final()

Patches in v6 Applied

#Subject and filesSizeRepliesApplied
1/3fs: add icount_read_once() and stop open-coding ->i_count loadsarch/powerpc/platforms/cell/spufs/file.c fs/btrfs/inode.c fs/ceph/mds_client.c +11 more+33 -201 reply
2/3fs: relocate and tidy up ihold()fs/inode.c+11 -91 reply
3/3fs: allow lockless ->i_count bumps as long as it does not transition 0->1fs/dcache.c fs/inode.c include/linux/fs.h+70 -21 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchJan Kara
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 0/3] assorted ->i_count changes + extension of lockless handling

The stock kernel support partial lockless in handling in that iput() can decrement any value > 1. Any ref acquire however requires the spinlock.

With this patchset ref acquires when the value was already at least 1 also become lockless. That is, only transitions 0->1 and 1->0 take the lock.

I verified when nfs calls into the hash taking the lock is typically avoided. Similarly, btrfs likes to igrab() and avoids the lock. However, I have to fully admit I did not perform any benchmarks. While cleaning stuff up I noticed lockless operation is almost readily available so I went for it.

Clean-up wise, 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.

v6
- remove the DONTCACHE vs drop patch for the time being
- s/igrab_try_lockless/igrab_from_hash/

v5:
- reword some commentary
- add unlikely to the new icount check in iput_final()

v4:
- squash icount_read patches
- use icount_read_once in the new ihold assert, reported by syzbot
- squash lockless ref acquire patches, rewrite new comments

v3:
- tidy up ihold
- add lockless handling to the hash

Mateusz Guzik (3):
fs: add icount_read_once() and stop open-coding ->i_count loads
fs: relocate and tidy up ihold()
fs: allow lockless ->i_count bumps 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/dcache.c                              |  4 +
 fs/ext4/ialloc.c                         |  4 +-
 fs/hpfs/inode.c                          |  2 +-
 fs/inode.c                               | 96 ++++++++++++++++++++----
 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 +-
 15 files changed, 112 insertions(+), 29 deletions(-)
Signature · 1 line
2.48.1