forked from Mirrors/btrfs-progs
btrfs-progs: Refactor block sizes users in ctree.c and ctree.h
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>master
parent
3d5eadd633
commit
34bd207932
10
ctree.c
10
ctree.c
|
@ -650,7 +650,7 @@ struct extent_buffer *read_node_slot(struct btrfs_root *root,
|
|||
return NULL;
|
||||
|
||||
return read_tree_block(root, btrfs_node_blockptr(parent, slot),
|
||||
root->nodesize,
|
||||
root->fs_info->nodesize,
|
||||
btrfs_node_ptr_generation(parent, slot));
|
||||
}
|
||||
|
||||
|
@ -987,7 +987,7 @@ void reada_for_search(struct btrfs_root *root, struct btrfs_path *path,
|
|||
|
||||
node = path->nodes[level];
|
||||
search = btrfs_node_blockptr(node, slot);
|
||||
blocksize = root->nodesize;
|
||||
blocksize = root->fs_info->nodesize;
|
||||
eb = btrfs_find_tree_block(root, search, blocksize);
|
||||
if (eb) {
|
||||
free_extent_buffer(eb);
|
||||
|
@ -1420,7 +1420,7 @@ static int noinline insert_new_root(struct btrfs_trans_handle *trans,
|
|||
else
|
||||
btrfs_node_key(lower, &lower_key, 0);
|
||||
|
||||
c = btrfs_alloc_free_block(trans, root, root->nodesize,
|
||||
c = btrfs_alloc_free_block(trans, root, root->fs_info->nodesize,
|
||||
root->root_key.objectid, &lower_key,
|
||||
level, root->node->start, 0);
|
||||
|
||||
|
@ -1543,7 +1543,7 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root
|
|||
mid = (c_nritems + 1) / 2;
|
||||
btrfs_node_key(c, &disk_key, mid);
|
||||
|
||||
split = btrfs_alloc_free_block(trans, root, root->nodesize,
|
||||
split = btrfs_alloc_free_block(trans, root, root->fs_info->nodesize,
|
||||
root->root_key.objectid,
|
||||
&disk_key, level, c->start, 0);
|
||||
if (IS_ERR(split))
|
||||
|
@ -2110,7 +2110,7 @@ again:
|
|||
else
|
||||
btrfs_item_key(l, &disk_key, mid);
|
||||
|
||||
right = btrfs_alloc_free_block(trans, root, root->nodesize,
|
||||
right = btrfs_alloc_free_block(trans, root, root->fs_info->nodesize,
|
||||
root->root_key.objectid,
|
||||
&disk_key, 0, l->start, 0);
|
||||
if (IS_ERR(right)) {
|
||||
|
|
4
ctree.h
4
ctree.h
|
@ -352,11 +352,11 @@ struct btrfs_header {
|
|||
u8 level;
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
#define BTRFS_NODEPTRS_PER_BLOCK(r) (((r)->nodesize - \
|
||||
#define BTRFS_NODEPTRS_PER_BLOCK(r) (((r)->fs_info->nodesize - \
|
||||
sizeof(struct btrfs_header)) / \
|
||||
sizeof(struct btrfs_key_ptr))
|
||||
#define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header))
|
||||
#define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->nodesize))
|
||||
#define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->fs_info->nodesize))
|
||||
#define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \
|
||||
sizeof(struct btrfs_item) - \
|
||||
sizeof(struct btrfs_file_extent_item))
|
||||
|
|
Loading…
Reference in New Issue