All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Schmidt <list.btrfs@jan-o-sch.net>
To: Wang Shilong <wangshilong1991@gmail.com>
Cc: linux-btrfs@vger.kernel.org, koen.de.wit@oracle.com
Subject: Re: [PATCH] Btrfs-progs: fix overflow when printing qgroup info
Date: Fri, 22 Mar 2013 13:34:33 +0100	[thread overview]
Message-ID: <514C4FD9.30504@jan-o-sch.net> (raw)
In-Reply-To: <1363953208-2342-1-git-send-email-wangshilong1991@gmail.com>


On Fri, March 22, 2013 at 12:53 (+0100), Wang Shilong wrote:
> From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
> 
> Since btrfs quota rescan has not been implemented yet,
> a user complains that "btrfs qgroup show" lists qgroup
> referenced/exclusive be negative. However, this should
> not happen even if overflow happens,because the type for
> qgroup referenced/exclusive is u64,fix it.
> 
> Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
> Reported-by: Koen De Wit <koen.de.wit@oracle.com>
> ---
>  cmds-qgroup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cmds-qgroup.c b/cmds-qgroup.c
> index 60ca33d..fc4cb13 100644
> --- a/cmds-qgroup.c
> +++ b/cmds-qgroup.c
> @@ -105,7 +105,7 @@ static int qgroup_create(int create, int argc, char **argv)
>  
>  void print_qgroup_info(u64 objectid, struct btrfs_qgroup_info_item *info)
>  {
> -	printf("%llu/%llu %lld %lld\n", objectid >> 48,
> +	printf("%llu/%llu %llu %llu\n", objectid >> 48,
>  		objectid & ((1ll << 48) - 1),
>  		btrfs_stack_qgroup_info_referenced(info),
>  		btrfs_stack_qgroup_info_exclusive(info));
> 

I don't like that change. Seeing negative numbers is what you should expect in
the current situation.

Once anyone come across negative numbers with a volume holding more data than
what can be tracked with 63 bit, I may come to agree to your change. For now, it
will confuse more than help.

-Jan

  reply	other threads:[~2013-03-22 12:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22 11:53 [PATCH] Btrfs-progs: fix overflow when printing qgroup info Wang Shilong
2013-03-22 12:34 ` Jan Schmidt [this message]
2013-03-22 12:42   ` Wang Shilong
2013-03-22 13:25     ` Wang Shilong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=514C4FD9.30504@jan-o-sch.net \
    --to=list.btrfs@jan-o-sch.net \
    --cc=koen.de.wit@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wangshilong1991@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.