reduce reflink src inode lock contention
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest3 patches 3 repliesIn review
- v23 patches 2 repliesSuperseded
Changes in v3 from the cover letter
- use btrfs_wait_ordered_range() instead of the misguided custom walk.
- add a helper to unify range computations.
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | btrfs: pre-flush reflink source before taking inode locksfs/ | +24 | 1 reply | |
| 2/3 | btrfs: skip unlocked reflink source flush if the inode has writersfs/ | +10 | 1 reply | |
| 3/3 | btrfs: downgrade the reflink source inode lock for tree walkingfs/ fs/ fs/ | +28 | 1 reply |
Reviews trailers per patch
All 3 patches have a Reviewed-by or Acked-by.
| Patch | Filipe Manana |
|---|---|
| 1/3 | R-b |
| 2/3 | R-b |
| 3/3 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/3] reduce reflink src inode lock contention
We currently take the src and dst inode i_rwsem exclusive for the entirety of a reflink which includes writing back all of both files and walking all the src extents and duplicating them to dst. This results in contention on those locks which I think can be reduced.
The basic strategy is:
1. try to do obvious easy src writeback outside the lock.
2. downgrade the src lock to shared where it is safe.
Changelog:
v3:
- use btrfs_wait_ordered_range() instead of the misguided custom walk.
- add a helper to unify range computations.
v2:
- introduce unlocked wb pre-flush instead of a downgrade of src inode lock for the whole reflink.
- add the "has writers" pessimization.
- still downgrade after done with wb.
Boris Burkov (3):
btrfs: pre-flush reflink source before taking inode locks
btrfs: skip unlocked reflink source flush if the inode has writers
btrfs: downgrade the reflink source inode lock for tree walking
fs/btrfs/btrfs_inode.h | 6 +++++ fs/btrfs/direct-io.c | 7 ++++++ fs/btrfs/reflink.c | 51 +++++++++++++++++++++++++++++++++++++----- 3 files changed, 58 insertions(+), 6 deletions(-)
Signature · 1 line
2.55.0