From patchwork Wed Nov 25 12:08:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 7698481 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A0764BF90C for ; Wed, 25 Nov 2015 12:08:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC012208F1 for ; Wed, 25 Nov 2015 12:08:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0F58208D1 for ; Wed, 25 Nov 2015 12:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753562AbbKYMIt (ORCPT ); Wed, 25 Nov 2015 07:08:49 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:40928 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753555AbbKYMIs (ORCPT ); Wed, 25 Nov 2015 07:08:48 -0500 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id tAPC8YfG016562 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 25 Nov 2015 12:08:35 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id tAPC8Y0G021402 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 25 Nov 2015 12:08:34 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id tAPC8YlH016277; Wed, 25 Nov 2015 12:08:34 GMT Received: from arch2.sg.oracle.com (/10.186.101.159) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 25 Nov 2015 04:08:34 -0800 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz, calestyo@scientia.net, ahferroin7@gmail.com, 1i5t5.duncan@cox.net Subject: [PATCH 2/7] btrfs-progs: add kernel alias for each of the features in the list Date: Wed, 25 Nov 2015 20:08:15 +0800 Message-Id: <1448453300-8449-3-git-send-email-anand.jain@oracle.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1448453300-8449-1-git-send-email-anand.jain@oracle.com> References: <1448453300-8449-1-git-send-email-anand.jain@oracle.com> X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We should have maintained feature's name same across progs UI and sysfs UI. For example, progs mixed-bg is /sys/fs/btrfs/features/mixed_groups in sysfs. As these are already released and is UIs, there is nothing much can be done about it, except for creating the alias and making it aware. Add kernel alias for each of the features in the list. eg: The string with in () is the sysfs name for the same feaure mkfs.btrfs -O list-all Filesystem features available: mixed-bg (mixed_groups) - mixed data and metadata block groups (0x4, 2.7.37) extref (extended_iref) - increased hardlink limit per file to 65536 (0x40, 3.7, default) raid56 (raid56) - raid56 extended format (0x80, 3.9) skinny-metadata (skinny_metadata) - reduced-size metadata extent refs (0x100, 3.10, default) no-holes (no_holes) - no explicit hole extents for files (0x200, 3.14) btrfs-convert -O list-all Filesystem features available: extref (extended_iref) - increased hardlink limit per file to 65536 (0x40, 3.7, default) skinny-metadata (skinny_metadata) - reduced-size metadata extent refs (0x100, 3.10, default) no-holes (no_holes) - no explicit hole extents for files (0x200, 3.14) --- utils.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/utils.c b/utils.c index 0163915..6d2675d 100644 --- a/utils.c +++ b/utils.c @@ -648,17 +648,26 @@ void btrfs_process_fs_features(u64 flags) void btrfs_list_all_fs_features(u64 mask_disallowed) { int i; + u64 feature_per_sysfs; + + btrfs_features_allowed_by_sysfs(&feature_per_sysfs); fprintf(stderr, "Filesystem features available:\n"); for (i = 0; i < ARRAY_SIZE(mkfs_features) - 1; i++) { char *is_default = ""; + char name[256]; if (mkfs_features[i].flag & mask_disallowed) continue; if (mkfs_features[i].flag & BTRFS_MKFS_DEFAULT_FEATURES) is_default = ", default"; - fprintf(stderr, "%-20s- %s (0x%llx, %s%s)\n", - mkfs_features[i].name, + if (mkfs_features[i].flag & feature_per_sysfs) + sprintf(name, "%s (%s)", + mkfs_features[i].name, mkfs_features[i].name_ker); + else + sprintf(name, "%s", mkfs_features[i].name); + fprintf(stderr, "%-34s- %s (0x%llx, %s%s)\n", + name, mkfs_features[i].desc, mkfs_features[i].flag, mkfs_features[i].min_ker_ver,