linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: qgroup: move WARN_ON() to the correct location.
@ 2015-01-06 12:54 Dongsheng Yang
  2015-01-07  1:52 ` Satoru Takeuchi
  0 siblings, 1 reply; 2+ messages in thread
From: Dongsheng Yang @ 2015-01-06 12:54 UTC (permalink / raw)
  To: jbacik; +Cc: linux-btrfs, Dongsheng Yang

In function qgroup_excl_accounting(), we need to WARN when
qg->excl is less than what we want to free, same to child
and parents. But currently, for parent qgroup, the WARN_ON()
is located after freeing qg->excl. It will WARN out even we
free it normally.

This patch move this WARN_ON() before freeing qg->excl.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
 fs/btrfs/qgroup.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 48b60db..97159a8 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1431,9 +1431,8 @@ static int qgroup_excl_accounting(struct btrfs_fs_info *fs_info,
 		qgroup = u64_to_ptr(unode->aux);
 		qgroup->rfer += sign * oper->num_bytes;
 		qgroup->rfer_cmpr += sign * oper->num_bytes;
+		WARN_ON(sign < 0 && qgroup->excl < oper->num_bytes);
 		qgroup->excl += sign * oper->num_bytes;
-		if (sign < 0)
-			WARN_ON(qgroup->excl < oper->num_bytes);
 		qgroup->excl_cmpr += sign * oper->num_bytes;
 		qgroup_dirty(fs_info, qgroup);
 
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs: qgroup: move WARN_ON() to the correct location.
  2015-01-06 12:54 [PATCH] btrfs: qgroup: move WARN_ON() to the correct location Dongsheng Yang
@ 2015-01-07  1:52 ` Satoru Takeuchi
  0 siblings, 0 replies; 2+ messages in thread
From: Satoru Takeuchi @ 2015-01-07  1:52 UTC (permalink / raw)
  To: Dongsheng Yang, jbacik; +Cc: linux-btrfs

On 2015/01/06 21:54, Dongsheng Yang wrote:
> In function qgroup_excl_accounting(), we need to WARN when
> qg->excl is less than what we want to free, same to child
> and parents. But currently, for parent qgroup, the WARN_ON()
> is located after freeing qg->excl. It will WARN out even we
> free it normally.
> 
> This patch move this WARN_ON() before freeing qg->excl.
> 
> Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>

Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>

> ---
>   fs/btrfs/qgroup.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
> index 48b60db..97159a8 100644
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -1431,9 +1431,8 @@ static int qgroup_excl_accounting(struct btrfs_fs_info *fs_info,
>   		qgroup = u64_to_ptr(unode->aux);
>   		qgroup->rfer += sign * oper->num_bytes;
>   		qgroup->rfer_cmpr += sign * oper->num_bytes;
> +		WARN_ON(sign < 0 && qgroup->excl < oper->num_bytes);
>   		qgroup->excl += sign * oper->num_bytes;
> -		if (sign < 0)
> -			WARN_ON(qgroup->excl < oper->num_bytes);
>   		qgroup->excl_cmpr += sign * oper->num_bytes;
>   		qgroup_dirty(fs_info, qgroup);
>   
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-07  1:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-06 12:54 [PATCH] btrfs: qgroup: move WARN_ON() to the correct location Dongsheng Yang
2015-01-07  1:52 ` Satoru Takeuchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).