diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2014-04-02 07:51:05 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-06-09 20:20:40 -0400 |
commit | 27cdeb7096b86f05ad018a24cdb63acdf0850a5d (patch) | |
tree | 1e795214fd0456f83c85843bea354d7331328bd1 /fs/btrfs/inode.c | |
parent | f959492fc15b60d874a9cbf55ae4760f2ef261ed (diff) |
Btrfs: use bitfield instead of integer data type for the some variants in btrfs_root
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 36c13e391ae3..ef3bd3deca12 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -2947,14 +2947,15 @@ void btrfs_orphan_commit_root(struct btrfs_trans_handle *trans, | |||
2947 | root->orphan_block_rsv = NULL; | 2947 | root->orphan_block_rsv = NULL; |
2948 | spin_unlock(&root->orphan_lock); | 2948 | spin_unlock(&root->orphan_lock); |
2949 | 2949 | ||
2950 | if (root->orphan_item_inserted && | 2950 | if (test_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state) && |
2951 | btrfs_root_refs(&root->root_item) > 0) { | 2951 | btrfs_root_refs(&root->root_item) > 0) { |
2952 | ret = btrfs_del_orphan_item(trans, root->fs_info->tree_root, | 2952 | ret = btrfs_del_orphan_item(trans, root->fs_info->tree_root, |
2953 | root->root_key.objectid); | 2953 | root->root_key.objectid); |
2954 | if (ret) | 2954 | if (ret) |
2955 | btrfs_abort_transaction(trans, root, ret); | 2955 | btrfs_abort_transaction(trans, root, ret); |
2956 | else | 2956 | else |
2957 | root->orphan_item_inserted = 0; | 2957 | clear_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, |
2958 | &root->state); | ||
2958 | } | 2959 | } |
2959 | 2960 | ||
2960 | if (block_rsv) { | 2961 | if (block_rsv) { |
@@ -3271,7 +3272,8 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) | |||
3271 | btrfs_block_rsv_release(root, root->orphan_block_rsv, | 3272 | btrfs_block_rsv_release(root, root->orphan_block_rsv, |
3272 | (u64)-1); | 3273 | (u64)-1); |
3273 | 3274 | ||
3274 | if (root->orphan_block_rsv || root->orphan_item_inserted) { | 3275 | if (root->orphan_block_rsv || |
3276 | test_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state)) { | ||
3275 | trans = btrfs_join_transaction(root); | 3277 | trans = btrfs_join_transaction(root); |
3276 | if (!IS_ERR(trans)) | 3278 | if (!IS_ERR(trans)) |
3277 | btrfs_end_transaction(trans, root); | 3279 | btrfs_end_transaction(trans, root); |
@@ -3998,7 +4000,8 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, | |||
3998 | * not block aligned since we will be keeping the last block of the | 4000 | * not block aligned since we will be keeping the last block of the |
3999 | * extent just the way it is. | 4001 | * extent just the way it is. |
4000 | */ | 4002 | */ |
4001 | if (root->ref_cows || root == root->fs_info->tree_root) | 4003 | if (test_bit(BTRFS_ROOT_REF_COWS, &root->state) || |
4004 | root == root->fs_info->tree_root) | ||
4002 | btrfs_drop_extent_cache(inode, ALIGN(new_size, | 4005 | btrfs_drop_extent_cache(inode, ALIGN(new_size, |
4003 | root->sectorsize), (u64)-1, 0); | 4006 | root->sectorsize), (u64)-1, 0); |
4004 | 4007 | ||
@@ -4091,7 +4094,9 @@ search_again: | |||
4091 | extent_num_bytes); | 4094 | extent_num_bytes); |
4092 | num_dec = (orig_num_bytes - | 4095 | num_dec = (orig_num_bytes - |
4093 | extent_num_bytes); | 4096 | extent_num_bytes); |
4094 | if (root->ref_cows && extent_start != 0) | 4097 | if (test_bit(BTRFS_ROOT_REF_COWS, |
4098 | &root->state) && | ||
4099 | extent_start != 0) | ||
4095 | inode_sub_bytes(inode, num_dec); | 4100 | inode_sub_bytes(inode, num_dec); |
4096 | btrfs_mark_buffer_dirty(leaf); | 4101 | btrfs_mark_buffer_dirty(leaf); |
4097 | } else { | 4102 | } else { |
@@ -4105,7 +4110,8 @@ search_again: | |||
4105 | num_dec = btrfs_file_extent_num_bytes(leaf, fi); | 4110 | num_dec = btrfs_file_extent_num_bytes(leaf, fi); |
4106 | if (extent_start != 0) { | 4111 | if (extent_start != 0) { |
4107 | found_extent = 1; | 4112 | found_extent = 1; |
4108 | if (root->ref_cows) | 4113 | if (test_bit(BTRFS_ROOT_REF_COWS, |
4114 | &root->state)) | ||
4109 | inode_sub_bytes(inode, num_dec); | 4115 | inode_sub_bytes(inode, num_dec); |
4110 | } | 4116 | } |
4111 | } | 4117 | } |
@@ -4120,10 +4126,9 @@ search_again: | |||
4120 | btrfs_file_extent_other_encoding(leaf, fi) == 0) { | 4126 | btrfs_file_extent_other_encoding(leaf, fi) == 0) { |
4121 | u32 size = new_size - found_key.offset; | 4127 | u32 size = new_size - found_key.offset; |
4122 | 4128 | ||
4123 | if (root->ref_cows) { | 4129 | if (test_bit(BTRFS_ROOT_REF_COWS, &root->state)) |
4124 | inode_sub_bytes(inode, item_end + 1 - | 4130 | inode_sub_bytes(inode, item_end + 1 - |
4125 | new_size); | 4131 | new_size); |
4126 | } | ||
4127 | 4132 | ||
4128 | /* | 4133 | /* |
4129 | * update the ram bytes to properly reflect | 4134 | * update the ram bytes to properly reflect |
@@ -4133,7 +4138,8 @@ search_again: | |||
4133 | size = | 4138 | size = |
4134 | btrfs_file_extent_calc_inline_size(size); | 4139 | btrfs_file_extent_calc_inline_size(size); |
4135 | btrfs_truncate_item(root, path, size, 1); | 4140 | btrfs_truncate_item(root, path, size, 1); |
4136 | } else if (root->ref_cows) { | 4141 | } else if (test_bit(BTRFS_ROOT_REF_COWS, |
4142 | &root->state)) { | ||
4137 | inode_sub_bytes(inode, item_end + 1 - | 4143 | inode_sub_bytes(inode, item_end + 1 - |
4138 | found_key.offset); | 4144 | found_key.offset); |
4139 | } | 4145 | } |
@@ -4155,8 +4161,9 @@ delete: | |||
4155 | } else { | 4161 | } else { |
4156 | break; | 4162 | break; |
4157 | } | 4163 | } |
4158 | if (found_extent && (root->ref_cows || | 4164 | if (found_extent && |
4159 | root == root->fs_info->tree_root)) { | 4165 | (test_bit(BTRFS_ROOT_REF_COWS, &root->state) || |
4166 | root == root->fs_info->tree_root)) { | ||
4160 | btrfs_set_path_blocking(path); | 4167 | btrfs_set_path_blocking(path); |
4161 | ret = btrfs_free_extent(trans, root, extent_start, | 4168 | ret = btrfs_free_extent(trans, root, extent_start, |
4162 | extent_num_bytes, 0, | 4169 | extent_num_bytes, 0, |