btrfs-progs: fix mkfs.btrfs -r option

Commit 605e806166 broke the
mkfs.btrfs -r option, because it calls make_btrfs
without ever setting dev_block_count, in the -r case,
so we tell it to make a filesystem of size 0.

Then we wander into ENOSPC land and segfault.

As a quick one-line-fix, just set the dev_block_count
to the size of the destination image file.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
master
Eric Sandeen 2013-01-29 14:32:28 -06:00 committed by David Sterba
parent 7e08a9116d
commit 680a80ece1
1 changed files with 2 additions and 0 deletions

2
mkfs.c
View File

@ -1384,6 +1384,8 @@ int main(int ac, char **av)
fprintf(stderr, "unable to zero the output file\n");
exit(1);
}
/* our "device" is the new image file */
dev_block_count = block_count;
}
ssd = is_ssd(file);