btrfs: dev-replace: swich locking to rw semaphore
authorDavid Sterba <dsterba@suse.com>
Wed, 4 Apr 2018 23:29:24 +0000 (01:29 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Dec 2018 13:51:44 +0000 (14:51 +0100)
commit129827e3001fd1e6892a0629b48f9c7c91cbb8b6
tree2a99d8de69cd3d439d96a384d41da62ac083e6c1
parentceb21a8db48559fd0809e03c4df9eb37743d9170
btrfs: dev-replace: swich locking to rw semaphore

This is the first part of removing the custom locking and waiting scheme
used for device replace. It was probably copied from extent buffer
locking, but there's nothing that would require more than is provided by
the common locking primitives.

The rw spinlock protects waiting tasks counter in case of incompatible
locks and the waitqueue. Same as rw semaphore.

This patch only switches the locking primitive, for better
bisectability.  There should be no functional change other than the
overhead of the locking and potential sleeping instead of spinning when
the lock is contended.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/dev-replace.c
fs/btrfs/disk-io.c