Commit 20feab7
committed
btrfs: remove btrfs_root's delalloc_mutex
When running metadata space reclaim under high I/O concurrency, we observe
hung tasks caused by lock contention on `btrfs_root::delalloc_mutex`. For
example:
INFO: task kworker/u132:1:2177 blocked for more than 122 seconds.
Not tainted 6.16.0-rc3+ torvalds#1246
Workqueue: events_unbound btrfs_preempt_reclaim_metadata_space
Call Trace:
__schedule+0x2f9/0x7b0
schedule+0x27/0x80
__mutex_lock.constprop.0+0x4af/0x890
start_delalloc_inodes+0x6e/0x400
btrfs_start_delalloc_roots+0x162/0x270
shrink_delalloc+0x10c/0x2d0
flush_space+0x202/0x280
btrfs_preempt_reclaim_metadata_space+0xe7/0x340
The `delalloc_mutex` serializes delalloc flushing per root but is no
longer necessary. All critical paths (inode flushing, extent writing,
metadata updates) are already synchronized using finer-grained locking at
the inode, page, and tree levels. In particular, concurrent flushers
coordinate via inode locking, and no shared state requires global
serialization across the root.
Removing this mutex avoids unnecessary blocking in reclaim paths and
improves responsiveness under pressure, especially on systems with many
flushers or multi-queue SSDs/ZNS devices.
Signed-off-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Johannes Thumshirn <[email protected]>1 parent 1c688b4 commit 20feab7
3 files changed
+0
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | | - | |
242 | 241 | | |
243 | 242 | | |
244 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
681 | | - | |
682 | 681 | | |
683 | 682 | | |
684 | 683 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8673 | 8673 | | |
8674 | 8674 | | |
8675 | 8675 | | |
8676 | | - | |
8677 | 8676 | | |
8678 | 8677 | | |
8679 | 8678 | | |
| |||
8730 | 8729 | | |
8731 | 8730 | | |
8732 | 8731 | | |
8733 | | - | |
8734 | 8732 | | |
8735 | 8733 | | |
8736 | 8734 | | |
| |||
0 commit comments