diff options
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index e86ae04abe6a..88b969aeeb71 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -227,9 +227,8 @@ loop_lock: | |||
227 | cur = pending; | 227 | cur = pending; |
228 | pending = pending->bi_next; | 228 | pending = pending->bi_next; |
229 | cur->bi_next = NULL; | 229 | cur->bi_next = NULL; |
230 | atomic_dec(&fs_info->nr_async_bios); | ||
231 | 230 | ||
232 | if (atomic_read(&fs_info->nr_async_bios) < limit && | 231 | if (atomic_dec_return(&fs_info->nr_async_bios) < limit && |
233 | waitqueue_active(&fs_info->async_submit_wait)) | 232 | waitqueue_active(&fs_info->async_submit_wait)) |
234 | wake_up(&fs_info->async_submit_wait); | 233 | wake_up(&fs_info->async_submit_wait); |
235 | 234 | ||
@@ -569,9 +568,11 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices) | |||
569 | memcpy(new_device, device, sizeof(*new_device)); | 568 | memcpy(new_device, device, sizeof(*new_device)); |
570 | 569 | ||
571 | /* Safe because we are under uuid_mutex */ | 570 | /* Safe because we are under uuid_mutex */ |
572 | name = rcu_string_strdup(device->name->str, GFP_NOFS); | 571 | if (device->name) { |
573 | BUG_ON(device->name && !name); /* -ENOMEM */ | 572 | name = rcu_string_strdup(device->name->str, GFP_NOFS); |
574 | rcu_assign_pointer(new_device->name, name); | 573 | BUG_ON(device->name && !name); /* -ENOMEM */ |
574 | rcu_assign_pointer(new_device->name, name); | ||
575 | } | ||
575 | new_device->bdev = NULL; | 576 | new_device->bdev = NULL; |
576 | new_device->writeable = 0; | 577 | new_device->writeable = 0; |
577 | new_device->in_fs_metadata = 0; | 578 | new_device->in_fs_metadata = 0; |
@@ -4605,28 +4606,6 @@ int btrfs_read_sys_array(struct btrfs_root *root) | |||
4605 | return ret; | 4606 | return ret; |
4606 | } | 4607 | } |
4607 | 4608 | ||
4608 | struct btrfs_device *btrfs_find_device_for_logical(struct btrfs_root *root, | ||
4609 | u64 logical, int mirror_num) | ||
4610 | { | ||
4611 | struct btrfs_mapping_tree *map_tree = &root->fs_info->mapping_tree; | ||
4612 | int ret; | ||
4613 | u64 map_length = 0; | ||
4614 | struct btrfs_bio *bbio = NULL; | ||
4615 | struct btrfs_device *device; | ||
4616 | |||
4617 | BUG_ON(mirror_num == 0); | ||
4618 | ret = btrfs_map_block(map_tree, WRITE, logical, &map_length, &bbio, | ||
4619 | mirror_num); | ||
4620 | if (ret) { | ||
4621 | BUG_ON(bbio != NULL); | ||
4622 | return NULL; | ||
4623 | } | ||
4624 | BUG_ON(mirror_num != bbio->mirror_num); | ||
4625 | device = bbio->stripes[mirror_num - 1].dev; | ||
4626 | kfree(bbio); | ||
4627 | return device; | ||
4628 | } | ||
4629 | |||
4630 | int btrfs_read_chunk_tree(struct btrfs_root *root) | 4609 | int btrfs_read_chunk_tree(struct btrfs_root *root) |
4631 | { | 4610 | { |
4632 | struct btrfs_path *path; | 4611 | struct btrfs_path *path; |