From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz, calestyo@scientia.net, ahferroin7@gmail.com,
1i5t5.duncan@cox.net
Subject: [PATCH 7/7] btrfs-progs: add -O comp= option for btrfs-convert
Date: Wed, 25 Nov 2015 20:08:20 +0800 [thread overview]
Message-ID: <1448453300-8449-8-git-send-email-anand.jain@oracle.com> (raw)
In-Reply-To: <1448453300-8449-1-git-send-email-anand.jain@oracle.com>
User may want to convert the FS to a minimum kernel version. As they may need
to use btrfs on a set of known kernel versions. And have the disk layout compatible.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
btrfs-convert.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/btrfs-convert.c b/btrfs-convert.c
index b0a998b..01b8940 100644
--- a/btrfs-convert.c
+++ b/btrfs-convert.c
@@ -2879,6 +2879,8 @@ static void print_usage(void)
printf("\t-L|--copy-label use label from converted filesystem\n");
printf("\t-p|--progress show converting progress (default)\n");
printf("\t-O|--features LIST comma separated list of filesystem features\n");
+ printf("\t use '-O list-all' to list features\n");
+ printf("\t use '-O comp=<x.y>|<x.y.z>' x.y.z is the minimum kernel version to be supported\n");
printf("\t--no-progress show only overview, not the detailed progress\n");
}
@@ -2970,6 +2972,24 @@ int main(int argc, char *argv[])
case 'O': {
char *orig = strdup(optarg);
char *tmp = orig;
+ char *tok;
+
+ tok = strtok(tmp, "=");
+ if (!strcmp(tok, "comp")) {
+ tok = strtok(NULL, "=");
+ if (!tok) {
+ fprintf(stderr,
+ "Provide a version for 'comp=' option, ref to 'mkfs.btrfs -O list-all'\n");
+ exit(1);
+ }
+ if (btrfs_features_allowed_by_version(tok, &features) < 0) {
+ fprintf(stderr, "Wrong version format: '%s'\n", tok);
+ exit(1);
+ }
+ features &= BTRFS_MKFS_DEFAULT_FEATURES;
+ goto cont;
+ }
+ tmp = orig;
tmp = btrfs_parse_fs_features(tmp, &features);
if (tmp) {
@@ -2979,6 +2999,7 @@ int main(int argc, char *argv[])
free(orig);
exit(1);
}
+cont:
free(orig);
if (features & BTRFS_FEATURE_LIST_ALL) {
btrfs_list_all_fs_features(
--
2.6.2
next prev parent reply other threads:[~2015-11-25 12:08 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-25 12:08 [PATCH 0/7] Let user specify the kernel version for features Anand Jain
2015-11-25 12:08 ` [PATCH 1/7] btrfs-progs: show the version for -O list-all Anand Jain
2015-11-25 12:08 ` [PATCH 2/7] btrfs-progs: add kernel alias for each of the features in the list Anand Jain
2015-11-25 13:36 ` [PATCH V1.1 " Anand Jain
2015-11-25 18:11 ` [PATCH " Liu Bo
2015-11-25 22:52 ` Anand Jain
2015-11-25 12:08 ` [PATCH 3/7] btrfs-progs: make is_numerical non static Anand Jain
2015-11-25 12:08 ` [PATCH 4/7] btrfs-progs: check for numerical in version_to_code() Anand Jain
2015-11-25 12:08 ` [PATCH 5/7] btrfs-progs: introduce framework version to features Anand Jain
2015-11-25 12:08 ` [PATCH 6/7] btrfs-progs: add -O comp= option for mkfs.btrfs Anand Jain
2015-11-25 12:08 ` Anand Jain [this message]
2015-11-26 2:02 ` [PATCH 0/7] Let user specify the kernel version for features Qu Wenruo
2015-11-26 6:07 ` Anand Jain
2015-11-26 6:53 ` Qu Wenruo
2015-11-26 11:18 ` Anand Jain
2015-11-26 12:31 ` Qu Wenruo
2015-11-26 22:17 ` Anand Jain
2015-11-27 0:44 ` Qu Wenruo
2015-11-27 8:41 ` Anand Jain
2015-11-29 1:21 ` Qu Wenruo
2015-11-30 4:54 ` Anand Jain
2015-11-30 5:46 ` Qu Wenruo
2016-02-03 10:50 ` David Sterba
2016-02-04 1:12 ` Qu Wenruo
2016-02-04 1:42 ` Chris Mason
2015-11-30 5:44 ` potential btrfs-progs clean up Anand Jain
2015-11-30 6:12 ` Qu Wenruo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1448453300-8449-8-git-send-email-anand.jain@oracle.com \
--to=anand.jain@oracle.com \
--cc=1i5t5.duncan@cox.net \
--cc=ahferroin7@gmail.com \
--cc=calestyo@scientia.net \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).