diff mbox

[1/2] btrfs-progs: qgroup: show 'none' when we did not limit it on this qgroup

Message ID 1433314653-548-1-git-send-email-yangds.fnst@cn.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Yang Dongsheng June 3, 2015, 6:57 a.m. UTC
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 <yangds.fnst@cn.fujitsu.com>
---
 qgroup.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Tsutomu Itoh June 3, 2015, 8:14 a.m. UTC | #1
On 2015/06/03 15:57, Dongsheng Yang wrote:
> 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 <yangds.fnst@cn.fujitsu.com>

Tested-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>

> ---
>   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);
> 


--
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
David Sterba June 5, 2015, 4:36 p.m. UTC | #2
On Wed, Jun 03, 2015 at 02:57:31PM +0800, Dongsheng Yang wrote:
> 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 <yangds.fnst@cn.fujitsu.com>

Applied, thanks.
--
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
diff mbox

Patch

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);