summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorMiao Xie2014-09-03 15:35:47 +0200
committerChris Mason2014-09-17 22:38:49 +0200
commitc3929c3624e1764855e5a452728aec201b18b42a (patch)
treeaf7420005570b68cbe7810e58f1bd84078b9925f /fs/btrfs/volumes.c
parentBtrfs: move the missing device to its own fs device list (diff)
downloadkernel-qcow2-linux-c3929c3624e1764855e5a452728aec201b18b42a.tar.gz
kernel-qcow2-linux-c3929c3624e1764855e5a452728aec201b18b42a.tar.xz
kernel-qcow2-linux-c3929c3624e1764855e5a452728aec201b18b42a.zip
Btrfs: modify rw_devices counter under chunk_mutex context
rw_devices counter is often used to tune the profile when doing chunk allocation, so we should modify it under the chunk_mutex context to avoid getting wrong chunk profile. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 57a7f331eb3e..77d7fbc0fa47 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1649,8 +1649,8 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
if (device->writeable) {
lock_chunks(root);
list_del_init(&device->dev_alloc_list);
+ device->fs_devices->rw_devices--;
unlock_chunks(root);
- root->fs_info->fs_devices->rw_devices--;
clear_super = true;
}
@@ -1795,8 +1795,8 @@ error_undo:
lock_chunks(root);
list_add(&device->dev_alloc_list,
&root->fs_info->fs_devices->alloc_list);
+ device->fs_devices->rw_devices++;
unlock_chunks(root);
- root->fs_info->fs_devices->rw_devices++;
}
goto error_brelse;
}