[RFC,3/3] btrfs-progs: kernel based default features for btrfs-convert
diff mbox

Message ID 1445417149-804-3-git-send-email-anand.jain@oracle.com
State New
Headers show

Commit Message

Anand Jain Oct. 21, 2015, 8:45 a.m. UTC
btrfs-convert convert FS with latest default features enabled, and
if the kernel is down-rev and does not support a latest feature then
mount fails, as expected.

This patch disables default features based on the running kernel.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 btrfs-convert.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Qu Wenruo Oct. 21, 2015, 9:12 a.m. UTC | #1
Anand Jain wrote on 2015/10/21 16:45 +0800:
> btrfs-convert convert FS with latest default features enabled, and
> if the kernel is down-rev and does not support a latest feature then
> mount fails, as expected.
>
> This patch disables default features based on the running kernel.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>   btrfs-convert.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/btrfs-convert.c b/btrfs-convert.c
> index cb92020..edec09e 100644
> --- a/btrfs-convert.c
> +++ b/btrfs-convert.c
> @@ -2890,7 +2890,10 @@ int main(int argc, char *argv[])
>   	int progress = 1;
>   	char *file;
>   	char fslabel[BTRFS_LABEL_SIZE];
> -	u64 features = BTRFS_MKFS_DEFAULT_FEATURES;
> +	u64 features;
> +
> +	features = btrfs_features_allowed_by_kernel();
> +	features &= BTRFS_MKFS_DEFAULT_FEATURES;
Same with previous patch.

Thanks,
Qu
>
>   	while(1) {
>   		enum { GETOPT_VAL_NO_PROGRESS = 256 };
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/btrfs-convert.c b/btrfs-convert.c
index cb92020..edec09e 100644
--- a/btrfs-convert.c
+++ b/btrfs-convert.c
@@ -2890,7 +2890,10 @@  int main(int argc, char *argv[])
 	int progress = 1;
 	char *file;
 	char fslabel[BTRFS_LABEL_SIZE];
-	u64 features = BTRFS_MKFS_DEFAULT_FEATURES;
+	u64 features;
+
+	features = btrfs_features_allowed_by_kernel();
+	features &= BTRFS_MKFS_DEFAULT_FEATURES;
 
 	while(1) {
 		enum { GETOPT_VAL_NO_PROGRESS = 256 };