Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/3] reduce reflink src inode lock contention
@ 2026-09-11  0:26 Boris Burkov
  2026-09-11  0:26 ` [PATCH v2 1/3] btrfs: pre-flush reflink source before taking inode locks Boris Burkov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Boris Burkov @ 2026-09-11  0:26 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

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.

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     | 72 ++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 83 insertions(+), 2 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-09-11 21:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-11  0:26 [PATCH v2 0/3] reduce reflink src inode lock contention Boris Burkov
2026-09-11  0:26 ` [PATCH v2 1/3] btrfs: pre-flush reflink source before taking inode locks Boris Burkov
2026-09-11  9:17   ` Filipe Manana
2026-09-11 21:51     ` Boris Burkov
2026-09-11  0:26 ` [PATCH v2 2/3] btrfs: skip unlocked reflink source flush if the inode has writers Boris Burkov
2026-09-11  0:26 ` [PATCH v2 3/3] btrfs: downgrade the reflink source inode lock for tree walking Boris Burkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox