public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Moise <00moses.alexander00@gmail.com>
To: clm@fb.com
Cc: jbacik@fb.com, dsterba@suse.com, linux-btrfs@vger.kernel.org,
	linux-kernel@vger.kernel.org, wangsl-fnst@cn.fujitsu.com
Subject: [PATCH] btrfs: Remove unneeded cast to s64 for qgroup rfer state
Date: Sat, 29 Aug 2015 11:45:53 +0000	[thread overview]
Message-ID: <20150829114553.GA7522@gmail.com> (raw)

This patch reverts commit: b4fcd6be6bbd702ae1a6545c9b413681850a9814
Wang Shilong added those casts as a workaround for a bug reproduced
using the following steps:

Steps to reproduce:
>    	mkfs.btrfs <disk>
>    	mount <disk> <mnt>
>    	dd if=/dev/zero of=/<mnt>/data bs=1M count=10
>    	sync
>    	btrfs quota enable <mnt>
>    	btrfs qgroup create 0/5 <mnt>
>    	btrfs qgroup limit 5M 0/5 <mnt>
>    	rm -f /<mnt>/data
>    	sync
>    	btrfs qgroup show <mnt>
>    	dd if=/dev/zero of=data bs=1M count=1
>
>    >From the perspective of users, qgroup's referenced or exclusive
>    is negative,but user can not continue to write data! a workaround
>    way is to cast u64 to s64 when doing qgroup reservation

I am unable to reproduce this problem without his modification.
I could be wrong in reverting this, so I'm gonna CC Wang as well so
he is aware of this patch.

Signed-off-by: Alexandru Moise <00moses.alexander00@gmail.com>
---
 fs/btrfs/qgroup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 8a82029..9c75e86 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -2077,14 +2077,14 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
 		qg = u64_to_ptr(unode->aux);
 
 		if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
-		    qg->reserved + (s64)qg->rfer + num_bytes >
+		    qg->reserved + qg->rfer + num_bytes >
 		    qg->max_rfer) {
 			ret = -EDQUOT;
 			goto out;
 		}
 
 		if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) &&
-		    qg->reserved + (s64)qg->excl + num_bytes >
+		    qg->reserved + qg->excl + num_bytes >
 		    qg->max_excl) {
 			ret = -EDQUOT;
 			goto out;
-- 
2.5.0


             reply	other threads:[~2015-08-29  8:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-29 11:45 Alexandru Moise [this message]
2015-08-31  1:44 ` [PATCH] btrfs: Remove unneeded cast to s64 for qgroup rfer state Qu Wenruo
2015-08-31  6:32   ` Alexandru Moise
2015-08-31  6:51     ` Qu Wenruo
2015-08-31  6:56       ` Alexandru Moise

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=20150829114553.GA7522@gmail.com \
    --to=00moses.alexander00@gmail.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=jbacik@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wangsl-fnst@cn.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox