summaryrefslogtreecommitdiff
path: root/mkfs
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2017-07-27 11:17:00 +0300
committerDavid Sterba <dsterba@suse.com>2017-09-08 16:15:05 +0200
commitcbaa70b265aa4161d92fe87fde586e1660905be2 (patch)
treeb80467439a62078e4a8a4ba7c936e67647c5a473 /mkfs
parentc0d783347f7e1763e1a13d3e13ab95a81f8718e6 (diff)
btrfs-progs: Use named constants for common sizes
There multiple places where we use well-known sizes - 1,8,16,32 megabytes. We also have them defined as constants in the sizes.h header. So let's use them. No functional changes. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'mkfs')
-rw-r--r--mkfs/common.c2
-rw-r--r--mkfs/main.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/mkfs/common.c b/mkfs/common.c
index 6ee1cd1d..7d482c26 100644
--- a/mkfs/common.c
+++ b/mkfs/common.c
@@ -95,7 +95,7 @@ int make_btrfs(int fd, struct btrfs_mkfs_config *cfg)
cfg->blocks[MKFS_SUPER_BLOCK] = BTRFS_SUPER_INFO_OFFSET;
for (i = 1; i < MKFS_BLOCK_COUNT; i++) {
- cfg->blocks[i] = BTRFS_SUPER_INFO_OFFSET + 1024 * 1024 +
+ cfg->blocks[i] = BTRFS_SUPER_INFO_OFFSET + SZ_1M +
cfg->nodesize * i;
}
diff --git a/mkfs/main.c b/mkfs/main.c
index afd68bc5..dfa7a031 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -719,7 +719,7 @@ again:
* keep our extent size at 1MB max, this makes it easier to work inside
* the tiny block groups created during mkfs
*/
- cur_bytes = min(total_bytes, 1024ULL * 1024);
+ cur_bytes = min(total_bytes, (u64)SZ_1M);
ret = btrfs_reserve_extent(trans, root, cur_bytes, 0, 0, (u64)-1,
&key, 1);
if (ret)
@@ -992,7 +992,7 @@ static int create_chunks(struct btrfs_trans_handle *trans,
u64 chunk_size;
u64 meta_type = BTRFS_BLOCK_GROUP_METADATA;
u64 data_type = BTRFS_BLOCK_GROUP_DATA;
- u64 minimum_data_chunk_size = 8 * 1024 * 1024;
+ u64 minimum_data_chunk_size = SZ_8M;
u64 i;
int ret;
@@ -1095,9 +1095,9 @@ static u64 size_sourcedir(const char *dir_name, u64 sectorsize,
u64 dir_size = 0;
u64 total_size = 0;
int ret;
- u64 default_chunk_size = 8 * 1024 * 1024; /* 8MB */
- u64 allocated_meta_size = 8 * 1024 * 1024; /* 8MB */
- u64 allocated_total_size = 20 * 1024 * 1024; /* 20MB */
+ u64 default_chunk_size = SZ_8M;
+ u64 allocated_meta_size = SZ_8M;
+ u64 allocated_total_size = 20 * SZ_1M; /* 20MB */
u64 num_of_meta_chunks = 0;
u64 num_of_data_chunks = 0;
u64 num_of_allocated_meta_chunks =