summaryrefslogtreecommitdiff
path: root/volumes.c
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2017-01-24 11:03:05 +0800
committerDavid Sterba <dsterba@suse.com>2017-03-08 13:00:45 +0100
commita2203246ae483d09114329d5d1f898efb23d6168 (patch)
tree40cea3c2a1293e7f23559c5183cf92c22312321b /volumes.c
parent95f515f2d12fb1c1b5a01e03d9f709570b762eeb (diff)
btrfs-progs: Introduce kernel sizes to cleanup large intermediate number
Large numbers like (1024 * 1024 * 1024) may cost reader/reviewer to waste one second to convert to 1G. Introduce kernel include/linux/sizes.h to replace any intermediate number larger than 4096 (not including 4096) to SZ_*. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'volumes.c')
-rw-r--r--volumes.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/volumes.c b/volumes.c
index a0a85edd..d87fd70e 100644
--- a/volumes.c
+++ b/volumes.c
@@ -319,7 +319,7 @@ static int find_free_dev_extent_start(struct btrfs_trans_handle *trans,
* used by the boot loader (grub for example), so we make sure to start
* at an offset of at least 1MB.
*/
- min_search_start = max(root->fs_info->alloc_start, 1024ull * 1024);
+ min_search_start = max(root->fs_info->alloc_start, (u64)SZ_1M);
search_start = max(search_start, min_search_start);
path = btrfs_alloc_path();
@@ -843,8 +843,8 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
struct list_head *dev_list = &info->fs_devices->devices;
struct list_head *cur;
struct map_lookup *map;
- int min_stripe_size = 1 * 1024 * 1024;
- u64 calc_size = 8 * 1024 * 1024;
+ int min_stripe_size = SZ_1M;
+ u64 calc_size = SZ_8M;
u64 min_free;
u64 max_chunk_size = 4 * calc_size;
u64 avail = 0;
@@ -870,19 +870,19 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
BTRFS_BLOCK_GROUP_RAID10 |
BTRFS_BLOCK_GROUP_DUP)) {
if (type & BTRFS_BLOCK_GROUP_SYSTEM) {
- calc_size = 8 * 1024 * 1024;
+ calc_size = SZ_8M;
max_chunk_size = calc_size * 2;
- min_stripe_size = 1 * 1024 * 1024;
+ min_stripe_size = SZ_1M;
max_stripes = BTRFS_MAX_DEVS_SYS_CHUNK;
} else if (type & BTRFS_BLOCK_GROUP_DATA) {
- calc_size = 1024 * 1024 * 1024;
+ calc_size = SZ_1G;
max_chunk_size = 10 * calc_size;
- min_stripe_size = 64 * 1024 * 1024;
+ min_stripe_size = SZ_64M;
max_stripes = BTRFS_MAX_DEVS(chunk_root);
} else if (type & BTRFS_BLOCK_GROUP_METADATA) {
- calc_size = 1024 * 1024 * 1024;
+ calc_size = SZ_1G;
max_chunk_size = 4 * calc_size;
- min_stripe_size = 32 * 1024 * 1024;
+ min_stripe_size = SZ_32M;
max_stripes = BTRFS_MAX_DEVS(chunk_root);
}
}
@@ -1108,7 +1108,7 @@ int btrfs_alloc_data_chunk(struct btrfs_trans_handle *trans,
struct list_head *dev_list = &info->fs_devices->devices;
struct list_head *cur;
struct map_lookup *map;
- u64 calc_size = 8 * 1024 * 1024;
+ u64 calc_size = SZ_8M;
int num_stripes = 1;
int sub_stripes = 0;
int ret;