summaryrefslogtreecommitdiff
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2018-04-05 01:29:24 +0200
committerDavid Sterba <dsterba@suse.com>2018-12-17 14:51:44 +0100
commit129827e3001fd1e6892a0629b48f9c7c91cbb8b6 (patch)
tree2a99d8de69cd3d439d96a384d41da62ac083e6c1 /fs/btrfs/disk-io.c
parentceb21a8db48559fd0809e03c4df9eb37743d9170 (diff)
downloadlwn-129827e3001fd1e6892a0629b48f9c7c91cbb8b6.tar.gz
lwn-129827e3001fd1e6892a0629b48f9c7c91cbb8b6.zip
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>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 14d355d0cb7a..eca66ac52c7a 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2141,7 +2141,7 @@ static void btrfs_init_btree_inode(struct btrfs_fs_info *fs_info)
static void btrfs_init_dev_replace_locks(struct btrfs_fs_info *fs_info)
{
mutex_init(&fs_info->dev_replace.lock_finishing_cancel_unmount);
- rwlock_init(&fs_info->dev_replace.lock);
+ init_rwsem(&fs_info->dev_replace.rwsem);
atomic_set(&fs_info->dev_replace.blocking_readers, 0);
init_waitqueue_head(&fs_info->dev_replace.replace_wait);
init_waitqueue_head(&fs_info->dev_replace.read_lock_wq);