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 <[email protected]>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to