summaryrefslogtreecommitdiff
path: root/btrfs_cmds.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2010-12-09 18:31:08 +0000
committerChris Mason <chris.mason@oracle.com>2011-10-25 09:18:31 -0400
commitb8802ae3fa0c70d4cfc3287ed07479925973b0ac (patch)
treeba2a311453c9a8783121bade7d8a6e64fad791fc /btrfs_cmds.c
parente2a6859d93254ee0cdb2bf575aa23b624bc735e5 (diff)
Btrfs-progs: add support for mixed data+metadata block groups
So alot of crazy people (I'm looking at you Meego) want to use btrfs on phones and such with small devices. Unfortunately the way we split out metadata/data chunks it makes space usage inefficient for volumes that are smaller than 1gigabyte. So add a -M option for mixing metadata+data, and default to this mixed mode if the filesystem is less than or equal to 1 gigabyte. I've tested this with xfstests on a 100mb filesystem and everything is a-ok. Signed-off-by: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'btrfs_cmds.c')
-rw-r--r--btrfs_cmds.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/btrfs_cmds.c b/btrfs_cmds.c
index 775bfe1c..c21a0071 100644
--- a/btrfs_cmds.c
+++ b/btrfs_cmds.c
@@ -720,6 +720,7 @@ int do_add_volume(int nargs, char **args)
int devfd, res;
u64 dev_block_count = 0;
struct stat st;
+ int mixed = 0;
devfd = open(args[i], O_RDWR);
if (!devfd) {
@@ -742,7 +743,7 @@ int do_add_volume(int nargs, char **args)
continue;
}
- res = btrfs_prepare_device(devfd, args[i], 1, &dev_block_count);
+ res = btrfs_prepare_device(devfd, args[i], 1, &dev_block_count, &mixed);
if (res) {
fprintf(stderr, "ERROR: Unable to init '%s'\n", args[i]);
close(devfd);
@@ -920,8 +921,14 @@ int do_df_filesystem(int nargs, char **argv)
memset(description, 0, 80);
if (flags & BTRFS_BLOCK_GROUP_DATA) {
- snprintf(description, 5, "%s", "Data");
- written += 4;
+ if (flags & BTRFS_BLOCK_GROUP_METADATA) {
+ snprintf(description, 15, "%s",
+ "Data+Metadata");
+ written += 14;
+ } else {
+ snprintf(description, 5, "%s", "Data");
+ written += 4;
+ }
} else if (flags & BTRFS_BLOCK_GROUP_SYSTEM) {
snprintf(description, 7, "%s", "System");
written += 6;