From patchwork Sun Nov 13 19:35:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 9424913 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 94F1B60233 for ; Sun, 13 Nov 2016 19:42:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A821288AF for ; Sun, 13 Nov 2016 19:42:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49CF62891B; Sun, 13 Nov 2016 19:42:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A223C288AF for ; Sun, 13 Nov 2016 19:42:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934430AbcKMTlW (ORCPT ); Sun, 13 Nov 2016 14:41:22 -0500 Received: from mail-pg0-f43.google.com ([74.125.83.43]:34465 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932504AbcKMTlV (ORCPT ); Sun, 13 Nov 2016 14:41:21 -0500 X-Greylist: delayed 326 seconds by postgrey-1.27 at vger.kernel.org; Sun, 13 Nov 2016 14:41:21 EST Received: by mail-pg0-f43.google.com with SMTP id x23so41502605pgx.1 for ; Sun, 13 Nov 2016 11:41:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=l6UzP3ZjvIJw1qlKx4A2hu4JEdXcCiAP/4ekDqEXiVY=; b=r02T/wvln1m5eIeKc3IOHCY1Q+RStjzpQuHdLcWd4bpEidrkBlaW5v3w+TGm9p4XfQ glM3r6Z8zucUfjoQ6o2S+koK4zZOQwj4AtXwg5ZYSqXdKzTzpgZB7DwISAPAA7AZsKNr zWiM/KGwj83IUEI+3/1o5RlAzzgN2S0R/eEVZKwGsD5V0MAh8hhq1YOeUg1iZP/gOUnc 7XuL6cFl1iCTu2MQLigCuwmSE5TOjgG7MJ9RJb0IE6mQ0Ez5ncE5rKLfmx9BKn7QLpBx D45f1DBSge59sekzvZy+NA4nBdB08MS5Yw6sxtLI3/rjigtqMFo3CEq2JUbavTUuJFnW kqaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=l6UzP3ZjvIJw1qlKx4A2hu4JEdXcCiAP/4ekDqEXiVY=; b=G5DgLyITDqkxXB6vORP9GxhVtJNeyQ0yWQgCtCm6bBKRRC7H3rEGi4aG5niqyDXspt DQPV+BgDBByXhZj4weD49+knCTwsSONWWDf0Vh2o9CdQ8ScySh/lBEl/BtikTdWZy4w3 rt09o5v/ZCbt92nvJRV++1KHhRgGgzRQOz2uaJH6JAW+9nSMfzqSpI0nWIkPX6CJnofB +enu4/78eUl90j3ixBDrt5SfEtUh87VdYOgU/NRZFbQdU1gOxbGJ5jJVy9yNDqceqoBt WHGUplKWw2zPsYHseDCxecQ+6QKCIv0MHDMMcwe6aXRKN8OVHD4c9aIXDFES/wZ+VZD/ iIlw== X-Gm-Message-State: ABUngveZ7XsDiOi2DzaUqCDLF1Y4xdFsd89crA0TACcpME5gMx/q+TZ+3UnktSr6/s4kQqMW X-Received: by 10.98.211.67 with SMTP id q64mr28262128pfg.173.1479065734661; Sun, 13 Nov 2016 11:35:34 -0800 (PST) Received: from localhost.localdomain ([2601:602:8801:8110:1a5e:fff:fea7:e0ef]) by smtp.gmail.com with ESMTPSA id v76sm8289029pfk.77.2016.11.13.11.35.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Nov 2016 11:35:34 -0800 (PST) From: Omar Sandoval To: linux-btrfs@vger.kernel.org Cc: kernel-team@fb.com Subject: [PATCH 2/6] btrfs-progs: format FREE_SPACE_TREE{, _VALID} nicely in dump-super Date: Sun, 13 Nov 2016 11:35:20 -0800 Message-Id: <86cfb5c7a06eb6fb488e4c615cd8dfbf2fa4180e.1479064970.git.osandov@fb.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: References: In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Omar Sandoval Signed-off-by: Omar Sandoval --- cmds-inspect-dump-super.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cmds-inspect-dump-super.c b/cmds-inspect-dump-super.c index d9f7bfb..ba0d708 100644 --- a/cmds-inspect-dump-super.c +++ b/cmds-inspect-dump-super.c @@ -197,6 +197,16 @@ struct readable_flag_entry { char *output; }; +#define DEF_COMPAT_RO_FLAG_ENTRY(bit_name) \ + {BTRFS_FEATURE_COMPAT_RO_##bit_name, #bit_name} + +static struct readable_flag_entry compat_ro_flags_array[] = { + DEF_COMPAT_RO_FLAG_ENTRY(FREE_SPACE_TREE), + DEF_COMPAT_RO_FLAG_ENTRY(FREE_SPACE_TREE_VALID), +}; +static const int compat_ro_flags_num = sizeof(compat_ro_flags_array) / + sizeof(struct readable_flag_entry); + #define DEF_INCOMPAT_FLAG_ENTRY(bit_name) \ {BTRFS_FEATURE_INCOMPAT_##bit_name, #bit_name} @@ -268,6 +278,19 @@ static void __print_readable_flag(u64 flag, struct readable_flag_entry *array, printf(")\n"); } +static void print_readable_compat_ro_flag(u64 flag) +{ + /* + * We know about the FREE_SPACE_TREE{,_VALID} bits, but we don't + * actually support them yet. + */ + return __print_readable_flag(flag, compat_ro_flags_array, + compat_ro_flags_num, + BTRFS_FEATURE_COMPAT_RO_SUPP | + BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE | + BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID); +} + static void print_readable_incompat_flag(u64 flag) { return __print_readable_flag(flag, incompat_flags_array, @@ -377,6 +400,7 @@ static void dump_superblock(struct btrfs_super_block *sb, int full) (unsigned long long)btrfs_super_compat_flags(sb)); printf("compat_ro_flags\t\t0x%llx\n", (unsigned long long)btrfs_super_compat_ro_flags(sb)); + print_readable_compat_ro_flag(btrfs_super_compat_ro_flags(sb)); printf("incompat_flags\t\t0x%llx\n", (unsigned long long)btrfs_super_incompat_flags(sb)); print_readable_incompat_flag(btrfs_super_incompat_flags(sb));