aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index c7367ae5a3e6..cd0b31a9ba3d 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -44,16 +44,6 @@ static int btrfs_relocate_sys_chunks(struct btrfs_root *root);
44static DEFINE_MUTEX(uuid_mutex); 44static DEFINE_MUTEX(uuid_mutex);
45static LIST_HEAD(fs_uuids); 45static LIST_HEAD(fs_uuids);
46 46
47void btrfs_lock_volumes(void)
48{
49 mutex_lock(&uuid_mutex);
50}
51
52void btrfs_unlock_volumes(void)
53{
54 mutex_unlock(&uuid_mutex);
55}
56
57static void lock_chunks(struct btrfs_root *root) 47static void lock_chunks(struct btrfs_root *root)
58{ 48{
59 mutex_lock(&root->fs_info->chunk_mutex); 49 mutex_lock(&root->fs_info->chunk_mutex);
@@ -1475,7 +1465,7 @@ next_slot:
1475 goto error; 1465 goto error;
1476 leaf = path->nodes[0]; 1466 leaf = path->nodes[0];
1477 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); 1467 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
1478 btrfs_release_path(root, path); 1468 btrfs_release_path(path);
1479 continue; 1469 continue;
1480 } 1470 }
1481 1471
@@ -1947,7 +1937,7 @@ again:
1947 chunk = btrfs_item_ptr(leaf, path->slots[0], 1937 chunk = btrfs_item_ptr(leaf, path->slots[0],
1948 struct btrfs_chunk); 1938 struct btrfs_chunk);
1949 chunk_type = btrfs_chunk_type(leaf, chunk); 1939 chunk_type = btrfs_chunk_type(leaf, chunk);
1950 btrfs_release_path(chunk_root, path); 1940 btrfs_release_path(path);
1951 1941
1952 if (chunk_type & BTRFS_BLOCK_GROUP_SYSTEM) { 1942 if (chunk_type & BTRFS_BLOCK_GROUP_SYSTEM) {
1953 ret = btrfs_relocate_chunk(chunk_root, chunk_tree, 1943 ret = btrfs_relocate_chunk(chunk_root, chunk_tree,
@@ -2065,7 +2055,7 @@ int btrfs_balance(struct btrfs_root *dev_root)
2065 if (found_key.offset == 0) 2055 if (found_key.offset == 0)
2066 break; 2056 break;
2067 2057
2068 btrfs_release_path(chunk_root, path); 2058 btrfs_release_path(path);
2069 ret = btrfs_relocate_chunk(chunk_root, 2059 ret = btrfs_relocate_chunk(chunk_root,
2070 chunk_root->root_key.objectid, 2060 chunk_root->root_key.objectid,
2071 found_key.objectid, 2061 found_key.objectid,
@@ -2137,7 +2127,7 @@ again:
2137 goto done; 2127 goto done;
2138 if (ret) { 2128 if (ret) {
2139 ret = 0; 2129 ret = 0;
2140 btrfs_release_path(root, path); 2130 btrfs_release_path(path);
2141 break; 2131 break;
2142 } 2132 }
2143 2133
@@ -2146,7 +2136,7 @@ again:
2146 btrfs_item_key_to_cpu(l, &key, path->slots[0]); 2136 btrfs_item_key_to_cpu(l, &key, path->slots[0]);
2147 2137
2148 if (key.objectid != device->devid) { 2138 if (key.objectid != device->devid) {
2149 btrfs_release_path(root, path); 2139 btrfs_release_path(path);
2150 break; 2140 break;
2151 } 2141 }
2152 2142
@@ -2154,14 +2144,14 @@ again:
2154 length = btrfs_dev_extent_length(l, dev_extent); 2144 length = btrfs_dev_extent_length(l, dev_extent);
2155 2145
2156 if (key.offset + length <= new_size) { 2146 if (key.offset + length <= new_size) {
2157 btrfs_release_path(root, path); 2147 btrfs_release_path(path);
2158 break; 2148 break;
2159 } 2149 }
2160 2150
2161 chunk_tree = btrfs_dev_extent_chunk_tree(l, dev_extent); 2151 chunk_tree = btrfs_dev_extent_chunk_tree(l, dev_extent);
2162 chunk_objectid = btrfs_dev_extent_chunk_objectid(l, dev_extent); 2152 chunk_objectid = btrfs_dev_extent_chunk_objectid(l, dev_extent);
2163 chunk_offset = btrfs_dev_extent_chunk_offset(l, dev_extent); 2153 chunk_offset = btrfs_dev_extent_chunk_offset(l, dev_extent);
2164 btrfs_release_path(root, path); 2154 btrfs_release_path(path);
2165 2155
2166 ret = btrfs_relocate_chunk(root, chunk_tree, chunk_objectid, 2156 ret = btrfs_relocate_chunk(root, chunk_tree, chunk_objectid,
2167 chunk_offset); 2157 chunk_offset);
@@ -2609,7 +2599,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
2609 2599
2610 trace_btrfs_chunk_alloc(info->chunk_root, map, start, *num_bytes); 2600 trace_btrfs_chunk_alloc(info->chunk_root, map, start, *num_bytes);
2611 2601
2612 em = alloc_extent_map(GFP_NOFS); 2602 em = alloc_extent_map();
2613 if (!em) { 2603 if (!em) {
2614 ret = -ENOMEM; 2604 ret = -ENOMEM;
2615 goto error; 2605 goto error;
@@ -2849,7 +2839,7 @@ int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset)
2849 2839
2850void btrfs_mapping_init(struct btrfs_mapping_tree *tree) 2840void btrfs_mapping_init(struct btrfs_mapping_tree *tree)
2851{ 2841{
2852 extent_map_tree_init(&tree->map_tree, GFP_NOFS); 2842 extent_map_tree_init(&tree->map_tree);
2853} 2843}
2854 2844
2855void btrfs_mapping_tree_free(struct btrfs_mapping_tree *tree) 2845void btrfs_mapping_tree_free(struct btrfs_mapping_tree *tree)
@@ -3499,7 +3489,7 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key,
3499 free_extent_map(em); 3489 free_extent_map(em);
3500 } 3490 }
3501 3491
3502 em = alloc_extent_map(GFP_NOFS); 3492 em = alloc_extent_map();
3503 if (!em) 3493 if (!em)
3504 return -ENOMEM; 3494 return -ENOMEM;
3505 num_stripes = btrfs_chunk_num_stripes(leaf, chunk); 3495 num_stripes = btrfs_chunk_num_stripes(leaf, chunk);
@@ -3688,15 +3678,6 @@ static int read_one_dev(struct btrfs_root *root,
3688 return ret; 3678 return ret;
3689} 3679}
3690 3680
3691int btrfs_read_super_device(struct btrfs_root *root, struct extent_buffer *buf)
3692{
3693 struct btrfs_dev_item *dev_item;
3694
3695 dev_item = (struct btrfs_dev_item *)offsetof(struct btrfs_super_block,
3696 dev_item);
3697 return read_one_dev(root, buf, dev_item);
3698}
3699
3700int btrfs_read_sys_array(struct btrfs_root *root) 3681int btrfs_read_sys_array(struct btrfs_root *root)
3701{ 3682{
3702 struct btrfs_super_block *super_copy = &root->fs_info->super_copy; 3683 struct btrfs_super_block *super_copy = &root->fs_info->super_copy;
@@ -3813,7 +3794,7 @@ again:
3813 } 3794 }
3814 if (key.objectid == BTRFS_DEV_ITEMS_OBJECTID) { 3795 if (key.objectid == BTRFS_DEV_ITEMS_OBJECTID) {
3815 key.objectid = 0; 3796 key.objectid = 0;
3816 btrfs_release_path(root, path); 3797 btrfs_release_path(path);
3817 goto again; 3798 goto again;
3818 } 3799 }
3819 ret = 0; 3800 ret = 0;