diff options
author | David Sterba <dsterba@suse.cz> | 2014-06-14 19:54:12 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2014-10-02 11:14:54 -0400 |
commit | 4d75f8a9c87b843c8ded15b82b8d137b9724cccc (patch) | |
tree | a6ac5d4fee70795507ccdebe83f92b6c28ab2d27 | |
parent | 0308af4465897c889e32754ef37bb465a1b2b872 (diff) |
btrfs: remove blocksize from btrfs_alloc_free_block and rename
Rename to btrfs_alloc_tree_block as it fits to the alloc/find/free +
_tree_block family. The parameter blocksize was set to the metadata
block size, directly or indirectly.
Signed-off-by: David Sterba <dsterba@suse.cz>
-rw-r--r-- | fs/btrfs/ctree.c | 26 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 6 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 8 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 5 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 3 |
5 files changed, 21 insertions, 27 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 2fb4ab659a0f..d498982bd202 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -258,9 +258,8 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans, | |||
258 | else | 258 | else |
259 | btrfs_node_key(buf, &disk_key, 0); | 259 | btrfs_node_key(buf, &disk_key, 0); |
260 | 260 | ||
261 | cow = btrfs_alloc_free_block(trans, root, buf->len, 0, | 261 | cow = btrfs_alloc_tree_block(trans, root, 0, new_root_objectid, |
262 | new_root_objectid, &disk_key, level, | 262 | &disk_key, level, buf->start, 0); |
263 | buf->start, 0); | ||
264 | if (IS_ERR(cow)) | 263 | if (IS_ERR(cow)) |
265 | return PTR_ERR(cow); | 264 | return PTR_ERR(cow); |
266 | 265 | ||
@@ -1133,9 +1132,9 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, | |||
1133 | } else | 1132 | } else |
1134 | parent_start = 0; | 1133 | parent_start = 0; |
1135 | 1134 | ||
1136 | cow = btrfs_alloc_free_block(trans, root, buf->len, parent_start, | 1135 | cow = btrfs_alloc_tree_block(trans, root, parent_start, |
1137 | root->root_key.objectid, &disk_key, | 1136 | root->root_key.objectid, &disk_key, level, |
1138 | level, search_start, empty_size); | 1137 | search_start, empty_size); |
1139 | if (IS_ERR(cow)) | 1138 | if (IS_ERR(cow)) |
1140 | return PTR_ERR(cow); | 1139 | return PTR_ERR(cow); |
1141 | 1140 | ||
@@ -3355,9 +3354,8 @@ static noinline int insert_new_root(struct btrfs_trans_handle *trans, | |||
3355 | else | 3354 | else |
3356 | btrfs_node_key(lower, &lower_key, 0); | 3355 | btrfs_node_key(lower, &lower_key, 0); |
3357 | 3356 | ||
3358 | c = btrfs_alloc_free_block(trans, root, root->nodesize, 0, | 3357 | c = btrfs_alloc_tree_block(trans, root, 0, root->root_key.objectid, |
3359 | root->root_key.objectid, &lower_key, | 3358 | &lower_key, level, root->node->start, 0); |
3360 | level, root->node->start, 0); | ||
3361 | if (IS_ERR(c)) | 3359 | if (IS_ERR(c)) |
3362 | return PTR_ERR(c); | 3360 | return PTR_ERR(c); |
3363 | 3361 | ||
@@ -3495,9 +3493,8 @@ static noinline int split_node(struct btrfs_trans_handle *trans, | |||
3495 | mid = (c_nritems + 1) / 2; | 3493 | mid = (c_nritems + 1) / 2; |
3496 | btrfs_node_key(c, &disk_key, mid); | 3494 | btrfs_node_key(c, &disk_key, mid); |
3497 | 3495 | ||
3498 | split = btrfs_alloc_free_block(trans, root, root->nodesize, 0, | 3496 | split = btrfs_alloc_tree_block(trans, root, 0, root->root_key.objectid, |
3499 | root->root_key.objectid, | 3497 | &disk_key, level, c->start, 0); |
3500 | &disk_key, level, c->start, 0); | ||
3501 | if (IS_ERR(split)) | 3498 | if (IS_ERR(split)) |
3502 | return PTR_ERR(split); | 3499 | return PTR_ERR(split); |
3503 | 3500 | ||
@@ -4275,9 +4272,8 @@ again: | |||
4275 | else | 4272 | else |
4276 | btrfs_item_key(l, &disk_key, mid); | 4273 | btrfs_item_key(l, &disk_key, mid); |
4277 | 4274 | ||
4278 | right = btrfs_alloc_free_block(trans, root, root->nodesize, 0, | 4275 | right = btrfs_alloc_tree_block(trans, root, 0, root->root_key.objectid, |
4279 | root->root_key.objectid, | 4276 | &disk_key, 0, l->start, 0); |
4280 | &disk_key, 0, l->start, 0); | ||
4281 | if (IS_ERR(right)) | 4277 | if (IS_ERR(right)) |
4282 | return PTR_ERR(right); | 4278 | return PTR_ERR(right); |
4283 | 4279 | ||
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 089f6da09411..3073b8876bca 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -3290,9 +3290,9 @@ struct btrfs_block_group_cache *btrfs_lookup_block_group( | |||
3290 | u64 bytenr); | 3290 | u64 bytenr); |
3291 | void btrfs_put_block_group(struct btrfs_block_group_cache *cache); | 3291 | void btrfs_put_block_group(struct btrfs_block_group_cache *cache); |
3292 | int get_block_group_index(struct btrfs_block_group_cache *cache); | 3292 | int get_block_group_index(struct btrfs_block_group_cache *cache); |
3293 | struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, | 3293 | struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans, |
3294 | struct btrfs_root *root, u32 blocksize, | 3294 | struct btrfs_root *root, u64 parent, |
3295 | u64 parent, u64 root_objectid, | 3295 | u64 root_objectid, |
3296 | struct btrfs_disk_key *key, int level, | 3296 | struct btrfs_disk_key *key, int level, |
3297 | u64 hint, u64 empty_size); | 3297 | u64 hint, u64 empty_size); |
3298 | void btrfs_free_tree_block(struct btrfs_trans_handle *trans, | 3298 | void btrfs_free_tree_block(struct btrfs_trans_handle *trans, |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index e0293d2fbb3a..2e5d460d4e0c 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1324,8 +1324,7 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans, | |||
1324 | root->root_key.type = BTRFS_ROOT_ITEM_KEY; | 1324 | root->root_key.type = BTRFS_ROOT_ITEM_KEY; |
1325 | root->root_key.offset = 0; | 1325 | root->root_key.offset = 0; |
1326 | 1326 | ||
1327 | leaf = btrfs_alloc_free_block(trans, root, root->nodesize, | 1327 | leaf = btrfs_alloc_tree_block(trans, root, 0, objectid, NULL, 0, 0, 0); |
1328 | 0, objectid, NULL, 0, 0, 0); | ||
1329 | if (IS_ERR(leaf)) { | 1328 | if (IS_ERR(leaf)) { |
1330 | ret = PTR_ERR(leaf); | 1329 | ret = PTR_ERR(leaf); |
1331 | leaf = NULL; | 1330 | leaf = NULL; |
@@ -1412,9 +1411,8 @@ static struct btrfs_root *alloc_log_tree(struct btrfs_trans_handle *trans, | |||
1412 | * updated (along with back refs to the log tree). | 1411 | * updated (along with back refs to the log tree). |
1413 | */ | 1412 | */ |
1414 | 1413 | ||
1415 | leaf = btrfs_alloc_free_block(trans, root, root->nodesize, 0, | 1414 | leaf = btrfs_alloc_tree_block(trans, root, 0, BTRFS_TREE_LOG_OBJECTID, |
1416 | BTRFS_TREE_LOG_OBJECTID, NULL, | 1415 | NULL, 0, 0, 0); |
1417 | 0, 0, 0); | ||
1418 | if (IS_ERR(leaf)) { | 1416 | if (IS_ERR(leaf)) { |
1419 | kfree(root); | 1417 | kfree(root); |
1420 | return ERR_CAST(leaf); | 1418 | return ERR_CAST(leaf); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index d9a90da93302..0ba42eb96775 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -7322,8 +7322,8 @@ static void unuse_block_rsv(struct btrfs_fs_info *fs_info, | |||
7322 | * | 7322 | * |
7323 | * returns the tree buffer or NULL. | 7323 | * returns the tree buffer or NULL. |
7324 | */ | 7324 | */ |
7325 | struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, | 7325 | struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans, |
7326 | struct btrfs_root *root, u32 blocksize, | 7326 | struct btrfs_root *root, |
7327 | u64 parent, u64 root_objectid, | 7327 | u64 parent, u64 root_objectid, |
7328 | struct btrfs_disk_key *key, int level, | 7328 | struct btrfs_disk_key *key, int level, |
7329 | u64 hint, u64 empty_size) | 7329 | u64 hint, u64 empty_size) |
@@ -7333,6 +7333,7 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, | |||
7333 | struct extent_buffer *buf; | 7333 | struct extent_buffer *buf; |
7334 | u64 flags = 0; | 7334 | u64 flags = 0; |
7335 | int ret; | 7335 | int ret; |
7336 | u32 blocksize = root->nodesize; | ||
7336 | bool skinny_metadata = btrfs_fs_incompat(root->fs_info, | 7337 | bool skinny_metadata = btrfs_fs_incompat(root->fs_info, |
7337 | SKINNY_METADATA); | 7338 | SKINNY_METADATA); |
7338 | 7339 | ||
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 0ff212757b95..2fc48905ccf5 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -480,8 +480,7 @@ static noinline int create_subvol(struct inode *dir, | |||
480 | if (ret) | 480 | if (ret) |
481 | goto fail; | 481 | goto fail; |
482 | 482 | ||
483 | leaf = btrfs_alloc_free_block(trans, root, root->nodesize, | 483 | leaf = btrfs_alloc_tree_block(trans, root, 0, objectid, NULL, 0, 0, 0); |
484 | 0, objectid, NULL, 0, 0, 0); | ||
485 | if (IS_ERR(leaf)) { | 484 | if (IS_ERR(leaf)) { |
486 | ret = PTR_ERR(leaf); | 485 | ret = PTR_ERR(leaf); |
487 | goto fail; | 486 | goto fail; |