From patchwork Wed Jun 3 06:57:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Dongsheng X-Patchwork-Id: 6532641 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 6D61CC0020 for ; Wed, 3 Jun 2015 07:02:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 94AB0206B8 for ; Wed, 3 Jun 2015 07:02:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8937320697 for ; Wed, 3 Jun 2015 07:02:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752537AbbFCHC0 (ORCPT ); Wed, 3 Jun 2015 03:02:26 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:17747 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751945AbbFCHCY (ORCPT ); Wed, 3 Jun 2015 03:02:24 -0400 X-IronPort-AV: E=Sophos;i="5.01,1,1399996800"; d="scan'208";a="96344657" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 03 Jun 2015 15:06:43 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t5370p5N010773 for ; Wed, 3 Jun 2015 15:00:51 +0800 Received: from yds-PC.g08.fujitsu.local (10.167.226.66) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Wed, 3 Jun 2015 15:02:25 +0800 From: Dongsheng Yang To: CC: Dongsheng Yang Subject: [PATCH 1/2] btrfs-progs: qgroup: show 'none' when we did not limit it on this qgroup Date: Wed, 3 Jun 2015 14:57:31 +0800 Message-ID: <1433314653-548-1-git-send-email-yangds.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.8.4.2 MIME-Version: 1.0 X-Originating-IP: [10.167.226.66] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 There are two understanding of the '0' value in btrfs qgroup show. (1) is no-limitation on this qgroup. (2) is the max-limitation is 0. This patch make it showing in different way. (1). max-limitation for 0 is still showing '0'. (2). no-limitation will show 'none'. qgroupid rfer excl max_rfer max_excl parent -------- ---- ---- -------- -------- ------ 0/5 2.19GiB 2.19GiB none none --- 0/257 100.02MiB 100.02MiB none none --- Signed-off-by: Dongsheng Yang Tested-by: Tsutomu Itoh --- qgroup.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/qgroup.c b/qgroup.c index 53815b5..dc04b03 100644 --- a/qgroup.c +++ b/qgroup.c @@ -237,10 +237,16 @@ static void print_qgroup_column(struct btrfs_qgroup *qgroup, print_qgroup_column_add_blank(BTRFS_QGROUP_PARENT, len); break; case BTRFS_QGROUP_MAX_RFER: - len = printf("%*s", max_len, pretty_size_mode(qgroup->max_rfer, unit_mode)); + if (qgroup->flags & BTRFS_QGROUP_LIMIT_MAX_RFER) + len = printf("%*s", max_len, pretty_size_mode(qgroup->max_rfer, unit_mode)); + else + len = printf("%*s", max_len, "none"); break; case BTRFS_QGROUP_MAX_EXCL: - len = printf("%*s", max_len, pretty_size_mode(qgroup->max_excl, unit_mode)); + if (qgroup->flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) + len = printf("%*s", max_len, pretty_size_mode(qgroup->max_excl, unit_mode)); + else + len = printf("%*s", max_len, "none"); break; case BTRFS_QGROUP_CHILD: len = print_child_column(qgroup);