diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 29a2475b9b14..16d335b342a2 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1053,7 +1053,6 @@ static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize, | |||
1053 | INIT_LIST_HEAD(&root->dirty_list); | 1053 | INIT_LIST_HEAD(&root->dirty_list); |
1054 | INIT_LIST_HEAD(&root->orphan_list); | 1054 | INIT_LIST_HEAD(&root->orphan_list); |
1055 | INIT_LIST_HEAD(&root->root_list); | 1055 | INIT_LIST_HEAD(&root->root_list); |
1056 | spin_lock_init(&root->node_lock); | ||
1057 | spin_lock_init(&root->orphan_lock); | 1056 | spin_lock_init(&root->orphan_lock); |
1058 | spin_lock_init(&root->inode_lock); | 1057 | spin_lock_init(&root->inode_lock); |
1059 | spin_lock_init(&root->accounting_lock); | 1058 | spin_lock_init(&root->accounting_lock); |
@@ -1363,7 +1362,8 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits) | |||
1363 | struct btrfs_device *device; | 1362 | struct btrfs_device *device; |
1364 | struct backing_dev_info *bdi; | 1363 | struct backing_dev_info *bdi; |
1365 | 1364 | ||
1366 | list_for_each_entry(device, &info->fs_devices->devices, dev_list) { | 1365 | rcu_read_lock(); |
1366 | list_for_each_entry_rcu(device, &info->fs_devices->devices, dev_list) { | ||
1367 | if (!device->bdev) | 1367 | if (!device->bdev) |
1368 | continue; | 1368 | continue; |
1369 | bdi = blk_get_backing_dev_info(device->bdev); | 1369 | bdi = blk_get_backing_dev_info(device->bdev); |
@@ -1372,6 +1372,7 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits) | |||
1372 | break; | 1372 | break; |
1373 | } | 1373 | } |
1374 | } | 1374 | } |
1375 | rcu_read_unlock(); | ||
1375 | return ret; | 1376 | return ret; |
1376 | } | 1377 | } |
1377 | 1378 | ||
@@ -2305,9 +2306,9 @@ int write_all_supers(struct btrfs_root *root, int max_mirrors) | |||
2305 | sb = &root->fs_info->super_for_commit; | 2306 | sb = &root->fs_info->super_for_commit; |
2306 | dev_item = &sb->dev_item; | 2307 | dev_item = &sb->dev_item; |
2307 | 2308 | ||
2308 | mutex_lock(&root->fs_info->fs_devices->device_list_mutex); | 2309 | rcu_read_lock(); |
2309 | head = &root->fs_info->fs_devices->devices; | 2310 | head = &root->fs_info->fs_devices->devices; |
2310 | list_for_each_entry(dev, head, dev_list) { | 2311 | list_for_each_entry_rcu(dev, head, dev_list) { |
2311 | if (!dev->bdev) { | 2312 | if (!dev->bdev) { |
2312 | total_errors++; | 2313 | total_errors++; |
2313 | continue; | 2314 | continue; |
@@ -2340,7 +2341,7 @@ int write_all_supers(struct btrfs_root *root, int max_mirrors) | |||
2340 | } | 2341 | } |
2341 | 2342 | ||
2342 | total_errors = 0; | 2343 | total_errors = 0; |
2343 | list_for_each_entry(dev, head, dev_list) { | 2344 | list_for_each_entry_rcu(dev, head, dev_list) { |
2344 | if (!dev->bdev) | 2345 | if (!dev->bdev) |
2345 | continue; | 2346 | continue; |
2346 | if (!dev->in_fs_metadata || !dev->writeable) | 2347 | if (!dev->in_fs_metadata || !dev->writeable) |
@@ -2350,7 +2351,7 @@ int write_all_supers(struct btrfs_root *root, int max_mirrors) | |||
2350 | if (ret) | 2351 | if (ret) |
2351 | total_errors++; | 2352 | total_errors++; |
2352 | } | 2353 | } |
2353 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | 2354 | rcu_read_unlock(); |
2354 | if (total_errors > max_errors) { | 2355 | if (total_errors > max_errors) { |
2355 | printk(KERN_ERR "btrfs: %d errors while writing supers\n", | 2356 | printk(KERN_ERR "btrfs: %d errors while writing supers\n", |
2356 | total_errors); | 2357 | total_errors); |