From patchwork Mon Sep 23 06:17:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 2926191 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 57FB8BFF05 for ; Mon, 23 Sep 2013 06:20:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7749420547 for ; Mon, 23 Sep 2013 06:20:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4EE132053D for ; Mon, 23 Sep 2013 06:20:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753321Ab3IWGUK (ORCPT ); Mon, 23 Sep 2013 02:20:10 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:43765 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752544Ab3IWGUH (ORCPT ); Mon, 23 Sep 2013 02:20:07 -0400 X-IronPort-AV: E=Sophos;i="4.90,938,1371052800"; d="scan'208";a="8592783" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 23 Sep 2013 14:16:52 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r8N6K3T7012949 for ; Mon, 23 Sep 2013 14:20:04 +0800 Received: from localhost.localdomain ([10.167.226.104]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013092314182317-1692401 ; Mon, 23 Sep 2013 14:18:23 +0800 From: Wang Shilong To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 4/9] Btrfs-progs: introduce '-l' option to print max referenced size of qgroups Date: Mon, 23 Sep 2013 14:17:23 +0800 Message-Id: <1379917048-9720-5-git-send-email-wangsl.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1379917048-9720-1-git-send-email-wangsl.fnst@cn.fujitsu.com> References: <1379917048-9720-1-git-send-email-wangsl.fnst@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/09/23 14:18:23, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/09/23 14:18:26, Serialize complete at 2013/09/23 14:18:26 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-9.2 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 From: Wang Shilong This patch introduces '-l' option to print max referenced size of qgroups. You may use it like: btrfs qgroup show -l Signed-off-by: Wang Shilong Signed-off-by: Miao Xie --- cmds-qgroup.c | 9 +++++++-- qgroup.c | 7 +++++++ qgroup.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cmds-qgroup.c b/cmds-qgroup.c index 147bedc..32537f9 100644 --- a/cmds-qgroup.c +++ b/cmds-qgroup.c @@ -202,10 +202,11 @@ static int cmd_qgroup_destroy(int argc, char **argv) } static const char * const cmd_qgroup_show_usage[] = { - "btrfs qgroup show -pc ", + "btrfs qgroup show -pcl ", "Show all subvolume quota groups.", "-p print parent qgroup id", "-c print child qgroup id", + "-l print max referenced size of qgroup", NULL }; @@ -220,7 +221,7 @@ static int cmd_qgroup_show(int argc, char **argv) optind = 1; while (1) { - c = getopt(argc, argv, "pc"); + c = getopt(argc, argv, "pcl"); if (c < 0) break; switch (c) { @@ -232,6 +233,10 @@ static int cmd_qgroup_show(int argc, char **argv) btrfs_qgroup_setup_print_column( BTRFS_QGROUP_CHILD); break; + case 'l': + btrfs_qgroup_setup_print_column( + BTRFS_QGROUP_MAX_RFER); + break; default: usage(cmd_qgroup_show_usage); } diff --git a/qgroup.c b/qgroup.c index 1592dd4..f9eb52d 100644 --- a/qgroup.c +++ b/qgroup.c @@ -87,6 +87,10 @@ struct { .column_name = "Excl", .need_print = 1, }, + { .name = "max_rfer", + .column_name = "Max_rfer", + .need_print = 0, + }, { .name = "parent", .column_name = "Parent", @@ -166,6 +170,9 @@ static void print_qgroup_column(struct btrfs_qgroup *qgroup, case BTRFS_QGROUP_PARENT: print_parent_column(qgroup); break; + case BTRFS_QGROUP_MAX_RFER: + printf("%llu", qgroup->max_rfer); + break; case BTRFS_QGROUP_CHILD: print_child_column(qgroup); break; diff --git a/qgroup.h b/qgroup.h index 33682ae..168fac0 100644 --- a/qgroup.h +++ b/qgroup.h @@ -26,6 +26,7 @@ enum btrfs_qgroup_column_enum { BTRFS_QGROUP_QGROUPID, BTRFS_QGROUP_RFER, BTRFS_QGROUP_EXCL, + BTRFS_QGROUP_MAX_RFER, BTRFS_QGROUP_PARENT, BTRFS_QGROUP_CHILD, BTRFS_QGROUP_ALL,