diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2015-03-17 04:59:47 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-06-10 12:25:18 -0400 |
commit | c682f9b3c2e091f3211ca68585be39f2a2beb8d0 (patch) | |
tree | 22bcdd24bbb4e0ba3eeb6e8c34bd4e6bbfcd73c5 | |
parent | 9c542136fd94941572762e7955e6a054b23e97f7 (diff) |
btrfs: extent-tree: Use ref_node to replace unneeded parameters in __inc_extent_ref() and __free_extent()
__btrfs_inc_extent_ref() and __btrfs_free_extent() have already had too
many parameters, but three of them can be extracted from
btrfs_delayed_ref_node struct.
So use btrfs_delayed_ref_node struct as a single parameter to replace
the bytenr/num_byte/no_quota parameters.
The real objective of this patch is to allow btrfs_qgroup_record_ref()
get the delayed_ref_node in incoming qgroup patches.
Other functions calling btrfs_qgroup_record_ref() are not affected since
the rest will only add/sub exclusive extents, where node is not used.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r-- | fs/btrfs/extent-tree.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index adf0eedde502..236a12f7d5f7 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -79,11 +79,10 @@ static int update_block_group(struct btrfs_trans_handle *trans, | |||
79 | u64 num_bytes, int alloc); | 79 | u64 num_bytes, int alloc); |
80 | static int __btrfs_free_extent(struct btrfs_trans_handle *trans, | 80 | static int __btrfs_free_extent(struct btrfs_trans_handle *trans, |
81 | struct btrfs_root *root, | 81 | struct btrfs_root *root, |
82 | u64 bytenr, u64 num_bytes, u64 parent, | 82 | struct btrfs_delayed_ref_node *node, u64 parent, |
83 | u64 root_objectid, u64 owner_objectid, | 83 | u64 root_objectid, u64 owner_objectid, |
84 | u64 owner_offset, int refs_to_drop, | 84 | u64 owner_offset, int refs_to_drop, |
85 | struct btrfs_delayed_extent_op *extra_op, | 85 | struct btrfs_delayed_extent_op *extra_op); |
86 | int no_quota); | ||
87 | static void __run_delayed_extent_op(struct btrfs_delayed_extent_op *extent_op, | 86 | static void __run_delayed_extent_op(struct btrfs_delayed_extent_op *extent_op, |
88 | struct extent_buffer *leaf, | 87 | struct extent_buffer *leaf, |
89 | struct btrfs_extent_item *ei); | 88 | struct btrfs_extent_item *ei); |
@@ -1967,10 +1966,9 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, | |||
1967 | 1966 | ||
1968 | static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, | 1967 | static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, |
1969 | struct btrfs_root *root, | 1968 | struct btrfs_root *root, |
1970 | u64 bytenr, u64 num_bytes, | 1969 | struct btrfs_delayed_ref_node *node, |
1971 | u64 parent, u64 root_objectid, | 1970 | u64 parent, u64 root_objectid, |
1972 | u64 owner, u64 offset, int refs_to_add, | 1971 | u64 owner, u64 offset, int refs_to_add, |
1973 | int no_quota, | ||
1974 | struct btrfs_delayed_extent_op *extent_op) | 1972 | struct btrfs_delayed_extent_op *extent_op) |
1975 | { | 1973 | { |
1976 | struct btrfs_fs_info *fs_info = root->fs_info; | 1974 | struct btrfs_fs_info *fs_info = root->fs_info; |
@@ -1978,8 +1976,11 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, | |||
1978 | struct extent_buffer *leaf; | 1976 | struct extent_buffer *leaf; |
1979 | struct btrfs_extent_item *item; | 1977 | struct btrfs_extent_item *item; |
1980 | struct btrfs_key key; | 1978 | struct btrfs_key key; |
1979 | u64 bytenr = node->bytenr; | ||
1980 | u64 num_bytes = node->num_bytes; | ||
1981 | u64 refs; | 1981 | u64 refs; |
1982 | int ret; | 1982 | int ret; |
1983 | int no_quota = node->no_quota; | ||
1983 | enum btrfs_qgroup_operation_type type = BTRFS_QGROUP_OPER_ADD_EXCL; | 1984 | enum btrfs_qgroup_operation_type type = BTRFS_QGROUP_OPER_ADD_EXCL; |
1984 | 1985 | ||
1985 | path = btrfs_alloc_path(); | 1986 | path = btrfs_alloc_path(); |
@@ -2087,17 +2088,15 @@ static int run_delayed_data_ref(struct btrfs_trans_handle *trans, | |||
2087 | ref->objectid, ref->offset, | 2088 | ref->objectid, ref->offset, |
2088 | &ins, node->ref_mod); | 2089 | &ins, node->ref_mod); |
2089 | } else if (node->action == BTRFS_ADD_DELAYED_REF) { | 2090 | } else if (node->action == BTRFS_ADD_DELAYED_REF) { |
2090 | ret = __btrfs_inc_extent_ref(trans, root, node->bytenr, | 2091 | ret = __btrfs_inc_extent_ref(trans, root, node, parent, |
2091 | node->num_bytes, parent, | ||
2092 | ref_root, ref->objectid, | 2092 | ref_root, ref->objectid, |
2093 | ref->offset, node->ref_mod, | 2093 | ref->offset, node->ref_mod, |
2094 | node->no_quota, extent_op); | 2094 | extent_op); |
2095 | } else if (node->action == BTRFS_DROP_DELAYED_REF) { | 2095 | } else if (node->action == BTRFS_DROP_DELAYED_REF) { |
2096 | ret = __btrfs_free_extent(trans, root, node->bytenr, | 2096 | ret = __btrfs_free_extent(trans, root, node, parent, |
2097 | node->num_bytes, parent, | ||
2098 | ref_root, ref->objectid, | 2097 | ref_root, ref->objectid, |
2099 | ref->offset, node->ref_mod, | 2098 | ref->offset, node->ref_mod, |
2100 | extent_op, node->no_quota); | 2099 | extent_op); |
2101 | } else { | 2100 | } else { |
2102 | BUG(); | 2101 | BUG(); |
2103 | } | 2102 | } |
@@ -2255,15 +2254,14 @@ static int run_delayed_tree_ref(struct btrfs_trans_handle *trans, | |||
2255 | ref->level, &ins, | 2254 | ref->level, &ins, |
2256 | node->no_quota); | 2255 | node->no_quota); |
2257 | } else if (node->action == BTRFS_ADD_DELAYED_REF) { | 2256 | } else if (node->action == BTRFS_ADD_DELAYED_REF) { |
2258 | ret = __btrfs_inc_extent_ref(trans, root, node->bytenr, | 2257 | ret = __btrfs_inc_extent_ref(trans, root, node, |
2259 | node->num_bytes, parent, ref_root, | 2258 | parent, ref_root, |
2260 | ref->level, 0, 1, node->no_quota, | 2259 | ref->level, 0, 1, |
2261 | extent_op); | 2260 | extent_op); |
2262 | } else if (node->action == BTRFS_DROP_DELAYED_REF) { | 2261 | } else if (node->action == BTRFS_DROP_DELAYED_REF) { |
2263 | ret = __btrfs_free_extent(trans, root, node->bytenr, | 2262 | ret = __btrfs_free_extent(trans, root, node, |
2264 | node->num_bytes, parent, ref_root, | 2263 | parent, ref_root, |
2265 | ref->level, 0, 1, extent_op, | 2264 | ref->level, 0, 1, extent_op); |
2266 | node->no_quota); | ||
2267 | } else { | 2265 | } else { |
2268 | BUG(); | 2266 | BUG(); |
2269 | } | 2267 | } |
@@ -6119,11 +6117,10 @@ static void add_pinned_bytes(struct btrfs_fs_info *fs_info, u64 num_bytes, | |||
6119 | 6117 | ||
6120 | static int __btrfs_free_extent(struct btrfs_trans_handle *trans, | 6118 | static int __btrfs_free_extent(struct btrfs_trans_handle *trans, |
6121 | struct btrfs_root *root, | 6119 | struct btrfs_root *root, |
6122 | u64 bytenr, u64 num_bytes, u64 parent, | 6120 | struct btrfs_delayed_ref_node *node, u64 parent, |
6123 | u64 root_objectid, u64 owner_objectid, | 6121 | u64 root_objectid, u64 owner_objectid, |
6124 | u64 owner_offset, int refs_to_drop, | 6122 | u64 owner_offset, int refs_to_drop, |
6125 | struct btrfs_delayed_extent_op *extent_op, | 6123 | struct btrfs_delayed_extent_op *extent_op) |
6126 | int no_quota) | ||
6127 | { | 6124 | { |
6128 | struct btrfs_key key; | 6125 | struct btrfs_key key; |
6129 | struct btrfs_path *path; | 6126 | struct btrfs_path *path; |
@@ -6137,8 +6134,11 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans, | |||
6137 | int extent_slot = 0; | 6134 | int extent_slot = 0; |
6138 | int found_extent = 0; | 6135 | int found_extent = 0; |
6139 | int num_to_del = 1; | 6136 | int num_to_del = 1; |
6137 | int no_quota = node->no_quota; | ||
6140 | u32 item_size; | 6138 | u32 item_size; |
6141 | u64 refs; | 6139 | u64 refs; |
6140 | u64 bytenr = node->bytenr; | ||
6141 | u64 num_bytes = node->num_bytes; | ||
6142 | int last_ref = 0; | 6142 | int last_ref = 0; |
6143 | enum btrfs_qgroup_operation_type type = BTRFS_QGROUP_OPER_SUB_EXCL; | 6143 | enum btrfs_qgroup_operation_type type = BTRFS_QGROUP_OPER_SUB_EXCL; |
6144 | bool skinny_metadata = btrfs_fs_incompat(root->fs_info, | 6144 | bool skinny_metadata = btrfs_fs_incompat(root->fs_info, |