]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: avoid unnecessary wake ups on io trees when there are no waiters
authorFilipe Manana <fdmanana@suse.com>
Wed, 11 Mar 2026 15:07:11 +0000 (15:07 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Apr 2026 16:56:04 +0000 (18:56 +0200)
commit87f5c3139ee34e0642584cff86298ef4b9a827ef
tree25e7aa3f121f9ffe36e89f14db02cede7b68f2d6
parentd110eb2f7f58c7b74c558dc922d5dae3e1b94362
btrfs: avoid unnecessary wake ups on io trees when there are no waiters

Whenever clearing the extent lock bits of an extent state record, we
unconditionally call wake_up() on the state's waitqueue. Most of the
time there are no waiters on the queue so we are just wasting time calling
wake_up(), since that requires locking and unlocking the queue's spinlock,
disable and re-enable interrupts, function calls, and other minor overhead
while we are holding a critical section delimited by the extent io tree's
spinlock.

So call wake_up() only if there are waiters on an extent state's wait
queue.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-io-tree.c