mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
ceb21a8db4
commit
129827e300
3 changed files with 8 additions and 8 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue