diff options
author | David Sterba <dsterba@suse.com> | 2016-10-04 13:34:27 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-12-06 10:07:00 -0500 |
commit | 34441361c4f52a5f6e41d8de8e5debbeb415dbf0 (patch) | |
tree | 1ecdf96fc87c0c297106555b2ad7e1f4e74b2952 /fs/btrfs | |
parent | 3a45bb207ee2c5548ebf6f5fcc7d249e141f15e8 (diff) |
btrfs: opencode chunk locking, remove helpers
The helpers are trivial and we don't use them consistently.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/disk-io.c | 4 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 8 | ||||
-rw-r--r-- | fs/btrfs/free-space-cache.c | 4 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 70 | ||||
-rw-r--r-- | fs/btrfs/volumes.h | 10 |
5 files changed, 43 insertions, 53 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 196f1aafcea9..848d5e1c0585 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -4003,7 +4003,7 @@ void close_ctree(struct btrfs_fs_info *fs_info) | |||
4003 | __btrfs_free_block_rsv(root->orphan_block_rsv); | 4003 | __btrfs_free_block_rsv(root->orphan_block_rsv); |
4004 | root->orphan_block_rsv = NULL; | 4004 | root->orphan_block_rsv = NULL; |
4005 | 4005 | ||
4006 | lock_chunks(fs_info); | 4006 | mutex_lock(&fs_info->chunk_mutex); |
4007 | while (!list_empty(&fs_info->pinned_chunks)) { | 4007 | while (!list_empty(&fs_info->pinned_chunks)) { |
4008 | struct extent_map *em; | 4008 | struct extent_map *em; |
4009 | 4009 | ||
@@ -4012,7 +4012,7 @@ void close_ctree(struct btrfs_fs_info *fs_info) | |||
4012 | list_del_init(&em->list); | 4012 | list_del_init(&em->list); |
4013 | free_extent_map(em); | 4013 | free_extent_map(em); |
4014 | } | 4014 | } |
4015 | unlock_chunks(fs_info); | 4015 | mutex_unlock(&fs_info->chunk_mutex); |
4016 | } | 4016 | } |
4017 | 4017 | ||
4018 | int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid, | 4018 | int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid, |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 2825019cd18f..e97302f437a1 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -9419,9 +9419,9 @@ again: | |||
9419 | out: | 9419 | out: |
9420 | if (cache->flags & BTRFS_BLOCK_GROUP_SYSTEM) { | 9420 | if (cache->flags & BTRFS_BLOCK_GROUP_SYSTEM) { |
9421 | alloc_flags = update_block_group_flags(fs_info, cache->flags); | 9421 | alloc_flags = update_block_group_flags(fs_info, cache->flags); |
9422 | lock_chunks(fs_info); | 9422 | mutex_lock(&fs_info->chunk_mutex); |
9423 | check_system_chunk(trans, fs_info, alloc_flags); | 9423 | check_system_chunk(trans, fs_info, alloc_flags); |
9424 | unlock_chunks(fs_info); | 9424 | mutex_unlock(&fs_info->chunk_mutex); |
9425 | } | 9425 | } |
9426 | mutex_unlock(&fs_info->ro_block_group_mutex); | 9426 | mutex_unlock(&fs_info->ro_block_group_mutex); |
9427 | 9427 | ||
@@ -10458,7 +10458,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, | |||
10458 | 10458 | ||
10459 | memcpy(&key, &block_group->key, sizeof(key)); | 10459 | memcpy(&key, &block_group->key, sizeof(key)); |
10460 | 10460 | ||
10461 | lock_chunks(fs_info); | 10461 | mutex_lock(&fs_info->chunk_mutex); |
10462 | if (!list_empty(&em->list)) { | 10462 | if (!list_empty(&em->list)) { |
10463 | /* We're in the transaction->pending_chunks list. */ | 10463 | /* We're in the transaction->pending_chunks list. */ |
10464 | free_extent_map(em); | 10464 | free_extent_map(em); |
@@ -10526,7 +10526,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, | |||
10526 | free_extent_map(em); | 10526 | free_extent_map(em); |
10527 | } | 10527 | } |
10528 | 10528 | ||
10529 | unlock_chunks(fs_info); | 10529 | mutex_unlock(&fs_info->chunk_mutex); |
10530 | 10530 | ||
10531 | ret = remove_block_group_free_space(trans, fs_info, block_group); | 10531 | ret = remove_block_group_free_space(trans, fs_info, block_group); |
10532 | if (ret) | 10532 | if (ret) |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 2e8445e4ffa3..7015892c9ee8 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -3352,7 +3352,7 @@ void btrfs_put_block_group_trimming(struct btrfs_block_group_cache *block_group) | |||
3352 | spin_unlock(&block_group->lock); | 3352 | spin_unlock(&block_group->lock); |
3353 | 3353 | ||
3354 | if (cleanup) { | 3354 | if (cleanup) { |
3355 | lock_chunks(fs_info); | 3355 | mutex_lock(&fs_info->chunk_mutex); |
3356 | em_tree = &fs_info->mapping_tree.map_tree; | 3356 | em_tree = &fs_info->mapping_tree.map_tree; |
3357 | write_lock(&em_tree->lock); | 3357 | write_lock(&em_tree->lock); |
3358 | em = lookup_extent_mapping(em_tree, block_group->key.objectid, | 3358 | em = lookup_extent_mapping(em_tree, block_group->key.objectid, |
@@ -3364,7 +3364,7 @@ void btrfs_put_block_group_trimming(struct btrfs_block_group_cache *block_group) | |||
3364 | */ | 3364 | */ |
3365 | remove_extent_mapping(em_tree, em); | 3365 | remove_extent_mapping(em_tree, em); |
3366 | write_unlock(&em_tree->lock); | 3366 | write_unlock(&em_tree->lock); |
3367 | unlock_chunks(fs_info); | 3367 | mutex_unlock(&fs_info->chunk_mutex); |
3368 | 3368 | ||
3369 | /* once for us and once for the tree */ | 3369 | /* once for us and once for the tree */ |
3370 | free_extent_map(em); | 3370 | free_extent_map(em); |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index cf3838604987..bb8592e1a364 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1890,10 +1890,10 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, char *device_path, u64 devid) | |||
1890 | } | 1890 | } |
1891 | 1891 | ||
1892 | if (device->writeable) { | 1892 | if (device->writeable) { |
1893 | lock_chunks(fs_info); | 1893 | mutex_lock(&fs_info->chunk_mutex); |
1894 | list_del_init(&device->dev_alloc_list); | 1894 | list_del_init(&device->dev_alloc_list); |
1895 | device->fs_devices->rw_devices--; | 1895 | device->fs_devices->rw_devices--; |
1896 | unlock_chunks(fs_info); | 1896 | mutex_unlock(&fs_info->chunk_mutex); |
1897 | clear_super = true; | 1897 | clear_super = true; |
1898 | } | 1898 | } |
1899 | 1899 | ||
@@ -1982,11 +1982,11 @@ out: | |||
1982 | 1982 | ||
1983 | error_undo: | 1983 | error_undo: |
1984 | if (device->writeable) { | 1984 | if (device->writeable) { |
1985 | lock_chunks(fs_info); | 1985 | mutex_lock(&fs_info->chunk_mutex); |
1986 | list_add(&device->dev_alloc_list, | 1986 | list_add(&device->dev_alloc_list, |
1987 | &fs_info->fs_devices->alloc_list); | 1987 | &fs_info->fs_devices->alloc_list); |
1988 | device->fs_devices->rw_devices++; | 1988 | device->fs_devices->rw_devices++; |
1989 | unlock_chunks(fs_info); | 1989 | mutex_unlock(&fs_info->chunk_mutex); |
1990 | } | 1990 | } |
1991 | goto out; | 1991 | goto out; |
1992 | } | 1992 | } |
@@ -2211,9 +2211,9 @@ static int btrfs_prepare_sprout(struct btrfs_fs_info *fs_info) | |||
2211 | list_for_each_entry(device, &seed_devices->devices, dev_list) | 2211 | list_for_each_entry(device, &seed_devices->devices, dev_list) |
2212 | device->fs_devices = seed_devices; | 2212 | device->fs_devices = seed_devices; |
2213 | 2213 | ||
2214 | lock_chunks(fs_info); | 2214 | mutex_lock(&fs_info->chunk_mutex); |
2215 | list_splice_init(&fs_devices->alloc_list, &seed_devices->alloc_list); | 2215 | list_splice_init(&fs_devices->alloc_list, &seed_devices->alloc_list); |
2216 | unlock_chunks(fs_info); | 2216 | mutex_unlock(&fs_info->chunk_mutex); |
2217 | 2217 | ||
2218 | fs_devices->seeding = 0; | 2218 | fs_devices->seeding = 0; |
2219 | fs_devices->num_devices = 0; | 2219 | fs_devices->num_devices = 0; |
@@ -2402,7 +2402,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, char *device_path) | |||
2402 | device->fs_devices = fs_info->fs_devices; | 2402 | device->fs_devices = fs_info->fs_devices; |
2403 | 2403 | ||
2404 | mutex_lock(&fs_info->fs_devices->device_list_mutex); | 2404 | mutex_lock(&fs_info->fs_devices->device_list_mutex); |
2405 | lock_chunks(fs_info); | 2405 | mutex_lock(&fs_info->chunk_mutex); |
2406 | list_add_rcu(&device->dev_list, &fs_info->fs_devices->devices); | 2406 | list_add_rcu(&device->dev_list, &fs_info->fs_devices->devices); |
2407 | list_add(&device->dev_alloc_list, | 2407 | list_add(&device->dev_alloc_list, |
2408 | &fs_info->fs_devices->alloc_list); | 2408 | &fs_info->fs_devices->alloc_list); |
@@ -2435,13 +2435,13 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, char *device_path) | |||
2435 | */ | 2435 | */ |
2436 | btrfs_clear_space_info_full(fs_info); | 2436 | btrfs_clear_space_info_full(fs_info); |
2437 | 2437 | ||
2438 | unlock_chunks(fs_info); | 2438 | mutex_unlock(&fs_info->chunk_mutex); |
2439 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); | 2439 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); |
2440 | 2440 | ||
2441 | if (seeding_dev) { | 2441 | if (seeding_dev) { |
2442 | lock_chunks(fs_info); | 2442 | mutex_lock(&fs_info->chunk_mutex); |
2443 | ret = init_first_rw_device(trans, fs_info, device); | 2443 | ret = init_first_rw_device(trans, fs_info, device); |
2444 | unlock_chunks(fs_info); | 2444 | mutex_unlock(&fs_info->chunk_mutex); |
2445 | if (ret) { | 2445 | if (ret) { |
2446 | btrfs_abort_transaction(trans, ret); | 2446 | btrfs_abort_transaction(trans, ret); |
2447 | goto error_trans; | 2447 | goto error_trans; |
@@ -2684,13 +2684,13 @@ int btrfs_grow_device(struct btrfs_trans_handle *trans, | |||
2684 | if (!device->writeable) | 2684 | if (!device->writeable) |
2685 | return -EACCES; | 2685 | return -EACCES; |
2686 | 2686 | ||
2687 | lock_chunks(fs_info); | 2687 | mutex_lock(&fs_info->chunk_mutex); |
2688 | old_total = btrfs_super_total_bytes(super_copy); | 2688 | old_total = btrfs_super_total_bytes(super_copy); |
2689 | diff = new_size - device->total_bytes; | 2689 | diff = new_size - device->total_bytes; |
2690 | 2690 | ||
2691 | if (new_size <= device->total_bytes || | 2691 | if (new_size <= device->total_bytes || |
2692 | device->is_tgtdev_for_dev_replace) { | 2692 | device->is_tgtdev_for_dev_replace) { |
2693 | unlock_chunks(fs_info); | 2693 | mutex_unlock(&fs_info->chunk_mutex); |
2694 | return -EINVAL; | 2694 | return -EINVAL; |
2695 | } | 2695 | } |
2696 | 2696 | ||
@@ -2705,7 +2705,7 @@ int btrfs_grow_device(struct btrfs_trans_handle *trans, | |||
2705 | if (list_empty(&device->resized_list)) | 2705 | if (list_empty(&device->resized_list)) |
2706 | list_add_tail(&device->resized_list, | 2706 | list_add_tail(&device->resized_list, |
2707 | &fs_devices->resized_devices); | 2707 | &fs_devices->resized_devices); |
2708 | unlock_chunks(fs_info); | 2708 | mutex_unlock(&fs_info->chunk_mutex); |
2709 | 2709 | ||
2710 | return btrfs_update_device(trans, device); | 2710 | return btrfs_update_device(trans, device); |
2711 | } | 2711 | } |
@@ -2760,7 +2760,7 @@ static int btrfs_del_sys_chunk(struct btrfs_fs_info *fs_info, | |||
2760 | u32 cur; | 2760 | u32 cur; |
2761 | struct btrfs_key key; | 2761 | struct btrfs_key key; |
2762 | 2762 | ||
2763 | lock_chunks(fs_info); | 2763 | mutex_lock(&fs_info->chunk_mutex); |
2764 | array_size = btrfs_super_sys_array_size(super_copy); | 2764 | array_size = btrfs_super_sys_array_size(super_copy); |
2765 | 2765 | ||
2766 | ptr = super_copy->sys_chunk_array; | 2766 | ptr = super_copy->sys_chunk_array; |
@@ -2790,7 +2790,7 @@ static int btrfs_del_sys_chunk(struct btrfs_fs_info *fs_info, | |||
2790 | cur += len; | 2790 | cur += len; |
2791 | } | 2791 | } |
2792 | } | 2792 | } |
2793 | unlock_chunks(fs_info); | 2793 | mutex_unlock(&fs_info->chunk_mutex); |
2794 | return ret; | 2794 | return ret; |
2795 | } | 2795 | } |
2796 | 2796 | ||
@@ -2824,9 +2824,9 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans, | |||
2824 | return -EINVAL; | 2824 | return -EINVAL; |
2825 | } | 2825 | } |
2826 | map = em->map_lookup; | 2826 | map = em->map_lookup; |
2827 | lock_chunks(fs_info); | 2827 | mutex_lock(&fs_info->chunk_mutex); |
2828 | check_system_chunk(trans, fs_info, map->type); | 2828 | check_system_chunk(trans, fs_info, map->type); |
2829 | unlock_chunks(fs_info); | 2829 | mutex_unlock(&fs_info->chunk_mutex); |
2830 | 2830 | ||
2831 | /* | 2831 | /* |
2832 | * Take the device list mutex to prevent races with the final phase of | 2832 | * Take the device list mutex to prevent races with the final phase of |
@@ -2846,14 +2846,14 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans, | |||
2846 | } | 2846 | } |
2847 | 2847 | ||
2848 | if (device->bytes_used > 0) { | 2848 | if (device->bytes_used > 0) { |
2849 | lock_chunks(fs_info); | 2849 | mutex_lock(&fs_info->chunk_mutex); |
2850 | btrfs_device_set_bytes_used(device, | 2850 | btrfs_device_set_bytes_used(device, |
2851 | device->bytes_used - dev_extent_len); | 2851 | device->bytes_used - dev_extent_len); |
2852 | spin_lock(&fs_info->free_chunk_lock); | 2852 | spin_lock(&fs_info->free_chunk_lock); |
2853 | fs_info->free_chunk_space += dev_extent_len; | 2853 | fs_info->free_chunk_space += dev_extent_len; |
2854 | spin_unlock(&fs_info->free_chunk_lock); | 2854 | spin_unlock(&fs_info->free_chunk_lock); |
2855 | btrfs_clear_space_info_full(fs_info); | 2855 | btrfs_clear_space_info_full(fs_info); |
2856 | unlock_chunks(fs_info); | 2856 | mutex_unlock(&fs_info->chunk_mutex); |
2857 | } | 2857 | } |
2858 | 2858 | ||
2859 | if (map->stripes[i].dev) { | 2859 | if (map->stripes[i].dev) { |
@@ -4373,7 +4373,7 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size) | |||
4373 | 4373 | ||
4374 | path->reada = READA_FORWARD; | 4374 | path->reada = READA_FORWARD; |
4375 | 4375 | ||
4376 | lock_chunks(fs_info); | 4376 | mutex_lock(&fs_info->chunk_mutex); |
4377 | 4377 | ||
4378 | btrfs_device_set_total_bytes(device, new_size); | 4378 | btrfs_device_set_total_bytes(device, new_size); |
4379 | if (device->writeable) { | 4379 | if (device->writeable) { |
@@ -4382,7 +4382,7 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size) | |||
4382 | fs_info->free_chunk_space -= diff; | 4382 | fs_info->free_chunk_space -= diff; |
4383 | spin_unlock(&fs_info->free_chunk_lock); | 4383 | spin_unlock(&fs_info->free_chunk_lock); |
4384 | } | 4384 | } |
4385 | unlock_chunks(fs_info); | 4385 | mutex_unlock(&fs_info->chunk_mutex); |
4386 | 4386 | ||
4387 | again: | 4387 | again: |
4388 | key.objectid = device->devid; | 4388 | key.objectid = device->devid; |
@@ -4454,7 +4454,7 @@ again: | |||
4454 | goto done; | 4454 | goto done; |
4455 | } | 4455 | } |
4456 | 4456 | ||
4457 | lock_chunks(fs_info); | 4457 | mutex_lock(&fs_info->chunk_mutex); |
4458 | 4458 | ||
4459 | /* | 4459 | /* |
4460 | * We checked in the above loop all device extents that were already in | 4460 | * We checked in the above loop all device extents that were already in |
@@ -4474,7 +4474,7 @@ again: | |||
4474 | 4474 | ||
4475 | if (contains_pending_extent(trans->transaction, device, | 4475 | if (contains_pending_extent(trans->transaction, device, |
4476 | &start, len)) { | 4476 | &start, len)) { |
4477 | unlock_chunks(fs_info); | 4477 | mutex_unlock(&fs_info->chunk_mutex); |
4478 | checked_pending_chunks = true; | 4478 | checked_pending_chunks = true; |
4479 | failed = 0; | 4479 | failed = 0; |
4480 | retried = false; | 4480 | retried = false; |
@@ -4492,7 +4492,7 @@ again: | |||
4492 | 4492 | ||
4493 | WARN_ON(diff > old_total); | 4493 | WARN_ON(diff > old_total); |
4494 | btrfs_set_super_total_bytes(super_copy, old_total - diff); | 4494 | btrfs_set_super_total_bytes(super_copy, old_total - diff); |
4495 | unlock_chunks(fs_info); | 4495 | mutex_unlock(&fs_info->chunk_mutex); |
4496 | 4496 | ||
4497 | /* Now btrfs_update_device() will change the on-disk size. */ | 4497 | /* Now btrfs_update_device() will change the on-disk size. */ |
4498 | ret = btrfs_update_device(trans, device); | 4498 | ret = btrfs_update_device(trans, device); |
@@ -4500,14 +4500,14 @@ again: | |||
4500 | done: | 4500 | done: |
4501 | btrfs_free_path(path); | 4501 | btrfs_free_path(path); |
4502 | if (ret) { | 4502 | if (ret) { |
4503 | lock_chunks(fs_info); | 4503 | mutex_lock(&fs_info->chunk_mutex); |
4504 | btrfs_device_set_total_bytes(device, old_size); | 4504 | btrfs_device_set_total_bytes(device, old_size); |
4505 | if (device->writeable) | 4505 | if (device->writeable) |
4506 | device->fs_devices->total_rw_bytes += diff; | 4506 | device->fs_devices->total_rw_bytes += diff; |
4507 | spin_lock(&fs_info->free_chunk_lock); | 4507 | spin_lock(&fs_info->free_chunk_lock); |
4508 | fs_info->free_chunk_space += diff; | 4508 | fs_info->free_chunk_space += diff; |
4509 | spin_unlock(&fs_info->free_chunk_lock); | 4509 | spin_unlock(&fs_info->free_chunk_lock); |
4510 | unlock_chunks(fs_info); | 4510 | mutex_unlock(&fs_info->chunk_mutex); |
4511 | } | 4511 | } |
4512 | return ret; | 4512 | return ret; |
4513 | } | 4513 | } |
@@ -4521,11 +4521,11 @@ static int btrfs_add_system_chunk(struct btrfs_fs_info *fs_info, | |||
4521 | u32 array_size; | 4521 | u32 array_size; |
4522 | u8 *ptr; | 4522 | u8 *ptr; |
4523 | 4523 | ||
4524 | lock_chunks(fs_info); | 4524 | mutex_lock(&fs_info->chunk_mutex); |
4525 | array_size = btrfs_super_sys_array_size(super_copy); | 4525 | array_size = btrfs_super_sys_array_size(super_copy); |
4526 | if (array_size + item_size + sizeof(disk_key) | 4526 | if (array_size + item_size + sizeof(disk_key) |
4527 | > BTRFS_SYSTEM_CHUNK_ARRAY_SIZE) { | 4527 | > BTRFS_SYSTEM_CHUNK_ARRAY_SIZE) { |
4528 | unlock_chunks(fs_info); | 4528 | mutex_unlock(&fs_info->chunk_mutex); |
4529 | return -EFBIG; | 4529 | return -EFBIG; |
4530 | } | 4530 | } |
4531 | 4531 | ||
@@ -4536,7 +4536,7 @@ static int btrfs_add_system_chunk(struct btrfs_fs_info *fs_info, | |||
4536 | memcpy(ptr, chunk, item_size); | 4536 | memcpy(ptr, chunk, item_size); |
4537 | item_size += sizeof(disk_key); | 4537 | item_size += sizeof(disk_key); |
4538 | btrfs_set_super_sys_array_size(super_copy, array_size + item_size); | 4538 | btrfs_set_super_sys_array_size(super_copy, array_size + item_size); |
4539 | unlock_chunks(fs_info); | 4539 | mutex_unlock(&fs_info->chunk_mutex); |
4540 | 4540 | ||
4541 | return 0; | 4541 | return 0; |
4542 | } | 4542 | } |
@@ -6783,7 +6783,7 @@ int btrfs_read_chunk_tree(struct btrfs_fs_info *fs_info) | |||
6783 | return -ENOMEM; | 6783 | return -ENOMEM; |
6784 | 6784 | ||
6785 | mutex_lock(&uuid_mutex); | 6785 | mutex_lock(&uuid_mutex); |
6786 | lock_chunks(fs_info); | 6786 | mutex_lock(&fs_info->chunk_mutex); |
6787 | 6787 | ||
6788 | /* | 6788 | /* |
6789 | * Read all device items, and then all the chunk items. All | 6789 | * Read all device items, and then all the chunk items. All |
@@ -6850,7 +6850,7 @@ int btrfs_read_chunk_tree(struct btrfs_fs_info *fs_info) | |||
6850 | } | 6850 | } |
6851 | ret = 0; | 6851 | ret = 0; |
6852 | error: | 6852 | error: |
6853 | unlock_chunks(fs_info); | 6853 | mutex_unlock(&fs_info->chunk_mutex); |
6854 | mutex_unlock(&uuid_mutex); | 6854 | mutex_unlock(&uuid_mutex); |
6855 | 6855 | ||
6856 | btrfs_free_path(path); | 6856 | btrfs_free_path(path); |
@@ -7149,13 +7149,13 @@ void btrfs_update_commit_device_size(struct btrfs_fs_info *fs_info) | |||
7149 | return; | 7149 | return; |
7150 | 7150 | ||
7151 | mutex_lock(&fs_devices->device_list_mutex); | 7151 | mutex_lock(&fs_devices->device_list_mutex); |
7152 | lock_chunks(fs_info); | 7152 | mutex_lock(&fs_info->chunk_mutex); |
7153 | list_for_each_entry_safe(curr, next, &fs_devices->resized_devices, | 7153 | list_for_each_entry_safe(curr, next, &fs_devices->resized_devices, |
7154 | resized_list) { | 7154 | resized_list) { |
7155 | list_del_init(&curr->resized_list); | 7155 | list_del_init(&curr->resized_list); |
7156 | curr->commit_total_bytes = curr->disk_total_bytes; | 7156 | curr->commit_total_bytes = curr->disk_total_bytes; |
7157 | } | 7157 | } |
7158 | unlock_chunks(fs_info); | 7158 | mutex_unlock(&fs_info->chunk_mutex); |
7159 | mutex_unlock(&fs_devices->device_list_mutex); | 7159 | mutex_unlock(&fs_devices->device_list_mutex); |
7160 | } | 7160 | } |
7161 | 7161 | ||
@@ -7172,7 +7172,7 @@ void btrfs_update_commit_device_bytes_used(struct btrfs_fs_info *fs_info, | |||
7172 | return; | 7172 | return; |
7173 | 7173 | ||
7174 | /* In order to kick the device replace finish process */ | 7174 | /* In order to kick the device replace finish process */ |
7175 | lock_chunks(fs_info); | 7175 | mutex_lock(&fs_info->chunk_mutex); |
7176 | list_for_each_entry(em, &transaction->pending_chunks, list) { | 7176 | list_for_each_entry(em, &transaction->pending_chunks, list) { |
7177 | map = em->map_lookup; | 7177 | map = em->map_lookup; |
7178 | 7178 | ||
@@ -7181,7 +7181,7 @@ void btrfs_update_commit_device_bytes_used(struct btrfs_fs_info *fs_info, | |||
7181 | dev->commit_bytes_used = dev->bytes_used; | 7181 | dev->commit_bytes_used = dev->bytes_used; |
7182 | } | 7182 | } |
7183 | } | 7183 | } |
7184 | unlock_chunks(fs_info); | 7184 | mutex_unlock(&fs_info->chunk_mutex); |
7185 | } | 7185 | } |
7186 | 7186 | ||
7187 | void btrfs_set_fs_info_ptr(struct btrfs_fs_info *fs_info) | 7187 | void btrfs_set_fs_info_ptr(struct btrfs_fs_info *fs_info) |
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 18b4449fa5a5..811328984702 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h | |||
@@ -534,16 +534,6 @@ void btrfs_update_commit_device_size(struct btrfs_fs_info *fs_info); | |||
534 | void btrfs_update_commit_device_bytes_used(struct btrfs_fs_info *fs_info, | 534 | void btrfs_update_commit_device_bytes_used(struct btrfs_fs_info *fs_info, |
535 | struct btrfs_transaction *transaction); | 535 | struct btrfs_transaction *transaction); |
536 | 536 | ||
537 | static inline void lock_chunks(struct btrfs_fs_info *fs_info) | ||
538 | { | ||
539 | mutex_lock(&fs_info->chunk_mutex); | ||
540 | } | ||
541 | |||
542 | static inline void unlock_chunks(struct btrfs_fs_info *fs_info) | ||
543 | { | ||
544 | mutex_unlock(&fs_info->chunk_mutex); | ||
545 | } | ||
546 | |||
547 | struct list_head *btrfs_get_fs_uuids(void); | 537 | struct list_head *btrfs_get_fs_uuids(void); |
548 | void btrfs_set_fs_info_ptr(struct btrfs_fs_info *fs_info); | 538 | void btrfs_set_fs_info_ptr(struct btrfs_fs_info *fs_info); |
549 | void btrfs_reset_fs_info_ptr(struct btrfs_fs_info *fs_info); | 539 | void btrfs_reset_fs_info_ptr(struct btrfs_fs_info *fs_info); |