btrfs-progs: error if device for mkfs is too small
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Thu, 5 Sep 2013 06:53:34 +0000 (15:53 +0900)
committerChris Mason <chris.mason@fusionio.com>
Wed, 16 Oct 2013 12:20:42 +0000 (08:20 -0400)
commitf9d102efdc87f9c142157f16e443fb2c610c5317
tree9c8358a04594b5bf9309199d571163ebcb8d966b
parent7c9074422aedb10d56b3db74041f06fd43951577
btrfs-progs: error if device for mkfs is too small

Eric pointed out that mkfs abort if specified volume is too small:

  # truncate --size=2m testfile
  # ./mkfs.btrfs testfile
   :
  SMALL VOLUME: forcing mixed metadata/data groups
  mkfs.btrfs: volumes.c:852: btrfs_alloc_chunk: Assertion `!(ret)' failed.
  Aborted (core dumped)

As the first step to fix problems around there, let mkfs to report
error if the size of target volume is less than the size of the first
system block group, BTRFS_MKFS_SYSTEM_GROUP_SIZE (= 4MB).

Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
mkfs.c