summaryrefslogtreecommitdiff
path: root/mkfs/common.c
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2017-10-16 16:22:56 +0800
committerDavid Sterba <dsterba@suse.com>2017-11-14 15:59:00 +0100
commitb84aa6033c340118e5ecc18acecd6b7492569fa7 (patch)
treeeb134049a739d0b49e7ce51610550a8398334ad7 /mkfs/common.c
parentda2659b090af383dea6dec71d2d4e128c643d455 (diff)
btrfs-progs: mkfs: refactor test_minimum_size to use the calculated minimal size
test_minimum_size() function is only called to check if provided device is large enough. However the minimal device size only needs to be calculated once, and can be reused everywhere. Refactor that function to make later modification easier. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'mkfs/common.c')
-rw-r--r--mkfs/common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mkfs/common.c b/mkfs/common.c
index c9ce10d4..71318b10 100644
--- a/mkfs/common.c
+++ b/mkfs/common.c
@@ -698,7 +698,7 @@ int is_vol_small(const char *file)
}
}
-int test_minimum_size(const char *file, u32 nodesize)
+int test_minimum_size(const char *file, u64 min_dev_size)
{
int fd;
struct stat statbuf;
@@ -710,7 +710,7 @@ int test_minimum_size(const char *file, u32 nodesize)
close(fd);
return -errno;
}
- if (btrfs_device_size(fd, &statbuf) < btrfs_min_dev_size(nodesize)) {
+ if (btrfs_device_size(fd, &statbuf) < min_dev_size) {
close(fd);
return 1;
}