path: root/utils.c
diff options
authorQu Wenruo <>2017-11-29 16:42:05 +0800
committerDavid Sterba <>2018-01-08 18:15:20 +0100
commit1733989352244572a0a53862c9377d21cbbcecf7 (patch)
tree1db0d547adbcb257a1bf6b82b407c35b9ac8418d /utils.c
parent0ca2f5a7241373c660946802b0d7f8305234c286 (diff)
btrfs-progs: mkfs: Use the whole file or block device to mkfs for rootdir
For --rootdir, even for large existing file or block device, it will always shrink the resulting filesystem. The problem is, mkfs.btrfs will try to calculate the dir size, and use it as @block_count to mkfs, which makes the filesystem shrunk. Fix it by trying to get the original block device or file size as @block_count, so mkfs.btrfs can use the full file/block device for --rootdir option. Signed-off-by: Qu Wenruo <> Signed-off-by: David Sterba <>
Diffstat (limited to 'utils.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/utils.c b/utils.c
index 22c13751..80071e23 100644
--- a/utils.c
+++ b/utils.c
@@ -447,7 +447,7 @@ int is_mount_point(const char *path)
return ret;
-static int is_reg_file(const char *path)
+int is_reg_file(const char *path)
struct stat statbuf;