Skip to content

RFC exfat: take s_lock in read mode for iomap mapping paths

Chi Zhiling exfat lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6exfat: remove dead hint_bmap updates in I/O and truncate pathsfs/exfat/file.c fs/exfat/inode.c+0 -90 replies
2/6exfat: take bitmap_lock at the start of exfat_alloc_cluster()fs/exfat/fatent.c+10 -70 replies
3/6exfat: use atomic bit ops for volume dirty flagfs/exfat/exfat_fs.h fs/exfat/exfat_raw.h fs/exfat/super.c+15 -202 replies
4/6exfat: lock FAT2 buffer while copying mirrored FAT entriesfs/exfat/fatent.c+3 -00 replies
5/6exfat: convert s_lock mutex to rw_semaphore using write lockfs/exfat/dir.c fs/exfat/exfat_fs.h fs/exfat/file.c +4 more+35 -350 replies
6/6exfat: take s_lock in read mode for iomap mapping pathsfs/exfat/iomap.c fs/exfat/super.c+6 -23 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/6] exfat: take s_lock in read mode for iomap mapping paths

From: Chi Zhiling <[email protected]>

The iomap mapping paths currently serialize all inode mappings on the sbi->s_lock mutex. This series converts it to an rw_semaphore and takes it in read mode on the mapping paths so that mappings of distinct inodes proceed in parallel. The preceding patches make the paths safe to run
concurrently: bitmap_lock covers the allocation state, atomic bit ops cover the volume dirty flag, and the FAT2 mirror copy is serialized against writeback.

Same-inode access stays serialized by the exclusive inode_lock; writeback does not hold it but is safe because truncate flushes and truncates the page cache first and cannot run concurrently with writeback. The lock ordering (inode_lock -> s_lock -> bitmap_lock) is unchanged, so no new deadlock scenarios are introduced.

A per-inode read-write lock was also considered, but its implementation turned out to be considerably more complex, so this series relaxes the existing s_lock instead. Any suggestions on that approach are welcome.

The series passes the xfstests exfat suite. In Unixbench, the fstime-w score improved from 3977196.8 to 4746349.6 (~+19%). Any comments and suggestions are welcome.

Chi Zhiling (6):
exfat: remove dead hint_bmap updates in I/O and truncate paths
exfat: take bitmap_lock at the start of exfat_alloc_cluster()
exfat: use atomic bit ops for volume dirty flag
exfat: lock FAT2 buffer while copying mirrored FAT entries
exfat: convert s_lock mutex to rw_semaphore using write lock
exfat: take s_lock in read mode for iomap mapping paths

 fs/exfat/dir.c       | 14 +++++++-------
 fs/exfat/exfat_fs.h  |  5 ++---
 fs/exfat/exfat_raw.h |  4 ++--
 fs/exfat/fatent.c    | 20 +++++++++++++-------
 fs/exfat/file.c      |  8 ++------
 fs/exfat/inode.c     | 15 +++++----------
 fs/exfat/iomap.c     |  4 ++--
 fs/exfat/namei.c     | 26 +++++++++++++-------------
 fs/exfat/super.c     | 42 +++++++++++++++++++++---------------------
 9 files changed, 67 insertions(+), 71 deletions(-)
Signature · 1 line
2.53.0