bcachefs: Fix lock thrashing in __bchfs_fallocate()
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 3 Aug 2023 07:39:49 +0000 (03:39 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:09 +0000 (17:10 -0400)
commit4198bf03bed27aa758de36595416beb604600912
tree2d9d553aa272fda35e35dc27790a2c8d89b52e35
parentf6e6f42bbbe5e421b57182bb0c92a237701ca889
bcachefs: Fix lock thrashing in __bchfs_fallocate()

We've observed significant lock thrashing on fstests generic/083 in
fallocate, due to dropping and retaking btree locks when checking the
pagecache for data.

This adds a nonblocking mode to bch2_clamp_data_hole(), where we only
use folio_trylock(), and can thus be used safely while btree locks are
held - thus we only have to drop btree locks as a fallback, on actual
lock contention.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs-io.c