From 0cc35251421bc5c4d5a682566e2d71b942bbcc4a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 3 May 2012 14:31:37 +0100 Subject: [PATCH] virt-make-fs: Fix estimation when making btrfs (RHBZ#816098). This also disables data and metadata duplication, which is not very useful on a constructed filesystem on a virtual disk. --- tools/virt-make-fs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/virt-make-fs b/tools/virt-make-fs index 3938e2775..6efa3cd01 100755 --- a/tools/virt-make-fs +++ b/tools/virt-make-fs @@ -380,6 +380,13 @@ if ($type eq "ntfs") { $estimate += 4 * 1024 * 1024; # NTFS journal. } +if ($type eq "btrfs") { + # For BTRFS, the minimum metadata allocation is 256MB, with data + # additional to that. Note that we disable data and metadata + # duplication below. + $estimate += 256 * 1024 * 1024; +} + $estimate *= 1.10; # Add 10%, see above. # Calculate the output size. @@ -448,7 +455,11 @@ eval { print STDERR "creating $type filesystem on $dev ...\n" if $debug; # Create the filesystem. - $g->mkfs ($type, $dev); + if ($type ne "btrfs") { + $g->mkfs ($type, $dev); + } else { + $g->mkfs_btrfs ([$dev], datatype => "single", metadata => "single"); + } $g->mount ($dev, "/"); # Copy the data in.