aboutsummaryrefslogtreecommitdiffstats
path: root/cmds-device.c
diff options
context:
space:
mode:
authorChandan Rajendra <chandan@linux.vnet.ibm.com>2015-10-14 23:09:37 +0530
committerDavid Sterba <dsterba@suse.com>2015-11-02 09:35:04 +0100
commitc11e36a29e84b7dc142f4dad8d02902f4f7ae158 (patch)
tree08877d380af1bfc58d3c4678a69c7fc3529e2f1e /cmds-device.c
parentcd12def348a1d55fdc1c680f3ed9c393f77ab407 (diff)
downloadbtrfs-progs-c11e36a29e84b7dc142f4dad8d02902f4f7ae158.tar.gz
btrfs-progs-c11e36a29e84b7dc142f4dad8d02902f4f7ae158.tar.xz
btrfs-progs-c11e36a29e84b7dc142f4dad8d02902f4f7ae158.zip
Btrfs-progs: Do not force mixed block group creation unless '-M' option is specified
When creating small Btrfs filesystem instances (i.e. filesystem size <= 1GiB), mkfs.btrfs fails if both sectorsize and nodesize are specified on the command line and sectorsize != nodesize, since mixed block groups involves both data and metadata blocks sharing the same block group. This is an incorrect behavior when '-M' option isn't specified on the command line. This commit makes optional the creation of mixed block groups i.e. Mixed block groups are created only when -M option is specified on the command line. Since we now allow small filesystem instances with sectorsize != nodesize to be created, we can end up in the following situation, [root@localhost ~]# mkfs.btrfs -f -n 65536 /dev/loop0 btrfs-progs v3.19-rc2-405-g976307c See http://btrfs.wiki.kernel.org for more information. Performing full device TRIM (512.00MiB) ... Label: (null) UUID: 49fab72e-0c8b-466b-a3ca-d1bfe56475f0 Node size: 65536 Sector size: 4096 Filesystem size: 512.00MiB Block group profiles: Data: single 8.00MiB Metadata: DUP 40.00MiB System: DUP 12.00MiB SSD detected: no Incompat features: extref, skinny-metadata Number of devices: 1 Devices: ID SIZE PATH 1 512.00MiB /dev/loop0 [root@localhost ~]# mount /dev/loop0 /mnt/ mount: mount /dev/loop0 on /mnt failed: No space left on device The ENOSPC occurs during the creation of the UUID tree. This is because of things like large metadata block size, DUP mode used for metadata and global reservation consuming space. Also, large nodesize does not make sense on small filesystems, hence this should not be an issue. Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-device.c')
-rw-r--r--cmds-device.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/cmds-device.c b/cmds-device.c
index 37fd284..e461aa1 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -92,7 +92,6 @@ static int cmd_device_add(int argc, char **argv)
struct btrfs_ioctl_vol_args ioctl_args;
int devfd, res;
u64 dev_block_count = 0;
- int mixed = 0;
char *path;
res = test_dev_for_mkfs(argv[i], force);
@@ -109,7 +108,7 @@ static int cmd_device_add(int argc, char **argv)
}
res = btrfs_prepare_device(devfd, argv[i], 1, &dev_block_count,
- 0, &mixed, discard);
+ 0, discard);
close(devfd);
if (res) {
ret++;