All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Marcos Paulo de Souza <marcos.souza.org@gmail.com>,
	linux-kernel@vger.kernel.org
Cc: dsterba@suse.com, linux-btrfs@vger.kernel.org,
	anand.jain@oracle.com, Marcos Paulo de Souza <mpdesouza@suse.com>,
	Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>
Subject: Re: [PATCH 1/2] btrfs: qgroup: Cleanup quota_root checks
Date: Tue, 26 Nov 2019 10:47:01 +0800	[thread overview]
Message-ID: <2644e882-5ca1-0fa8-7dde-1edd64f8243d@gmx.com> (raw)
In-Reply-To: <20191126005851.11813-2-marcos.souza.org@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 5877 bytes --]



On 2019/11/26 上午8:58, Marcos Paulo de Souza wrote:
> From: Marcos Paulo de Souza <mpdesouza@suse.com>
> 
> Remove some variables that are set only to be checked later, and never
> used.

Indeed.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> 
> Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
> ---
>  fs/btrfs/qgroup.c | 34 ++++++++++------------------------
>  1 file changed, 10 insertions(+), 24 deletions(-)
> 
> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
> index d4282e12f2a6..417fafb4b4f6 100644
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -1243,7 +1243,6 @@ int btrfs_add_qgroup_relation(struct btrfs_trans_handle *trans, u64 src,
>  			      u64 dst)
>  {
>  	struct btrfs_fs_info *fs_info = trans->fs_info;
> -	struct btrfs_root *quota_root;
>  	struct btrfs_qgroup *parent;
>  	struct btrfs_qgroup *member;
>  	struct btrfs_qgroup_list *list;
> @@ -1259,8 +1258,7 @@ int btrfs_add_qgroup_relation(struct btrfs_trans_handle *trans, u64 src,
>  		return -ENOMEM;
>  
>  	mutex_lock(&fs_info->qgroup_ioctl_lock);
> -	quota_root = fs_info->quota_root;
> -	if (!quota_root) {
> +	if (!fs_info->quota_root) {
>  		ret = -EINVAL;
>  		goto out;
>  	}
> @@ -1307,7 +1305,6 @@ static int __del_qgroup_relation(struct btrfs_trans_handle *trans, u64 src,
>  				 u64 dst)
>  {
>  	struct btrfs_fs_info *fs_info = trans->fs_info;
> -	struct btrfs_root *quota_root;
>  	struct btrfs_qgroup *parent;
>  	struct btrfs_qgroup *member;
>  	struct btrfs_qgroup_list *list;
> @@ -1320,8 +1317,7 @@ static int __del_qgroup_relation(struct btrfs_trans_handle *trans, u64 src,
>  	if (!tmp)
>  		return -ENOMEM;
>  
> -	quota_root = fs_info->quota_root;
> -	if (!quota_root) {
> +	if (!fs_info->quota_root) {
>  		ret = -EINVAL;
>  		goto out;
>  	}
> @@ -1387,11 +1383,11 @@ int btrfs_create_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
>  	int ret = 0;
>  
>  	mutex_lock(&fs_info->qgroup_ioctl_lock);
> -	quota_root = fs_info->quota_root;
> -	if (!quota_root) {
> +	if (!fs_info->quota_root) {
>  		ret = -EINVAL;
>  		goto out;
>  	}
> +	quota_root = fs_info->quota_root;
>  	qgroup = find_qgroup_rb(fs_info, qgroupid);
>  	if (qgroup) {
>  		ret = -EEXIST;
> @@ -1416,14 +1412,12 @@ int btrfs_create_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
>  int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
>  {
>  	struct btrfs_fs_info *fs_info = trans->fs_info;
> -	struct btrfs_root *quota_root;
>  	struct btrfs_qgroup *qgroup;
>  	struct btrfs_qgroup_list *list;
>  	int ret = 0;
>  
>  	mutex_lock(&fs_info->qgroup_ioctl_lock);
> -	quota_root = fs_info->quota_root;
> -	if (!quota_root) {
> +	if (!fs_info->quota_root) {
>  		ret = -EINVAL;
>  		goto out;
>  	}
> @@ -1465,7 +1459,6 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid,
>  		       struct btrfs_qgroup_limit *limit)
>  {
>  	struct btrfs_fs_info *fs_info = trans->fs_info;
> -	struct btrfs_root *quota_root;
>  	struct btrfs_qgroup *qgroup;
>  	int ret = 0;
>  	/* Sometimes we would want to clear the limit on this qgroup.
> @@ -1475,8 +1468,7 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid,
>  	const u64 CLEAR_VALUE = -1;
>  
>  	mutex_lock(&fs_info->qgroup_ioctl_lock);
> -	quota_root = fs_info->quota_root;
> -	if (!quota_root) {
> +	if (!fs_info->quota_root) {
>  		ret = -EINVAL;
>  		goto out;
>  	}
> @@ -2578,10 +2570,9 @@ int btrfs_qgroup_account_extents(struct btrfs_trans_handle *trans)
>  int btrfs_run_qgroups(struct btrfs_trans_handle *trans)
>  {
>  	struct btrfs_fs_info *fs_info = trans->fs_info;
> -	struct btrfs_root *quota_root = fs_info->quota_root;
>  	int ret = 0;
>  
> -	if (!quota_root)
> +	if (!fs_info->quota_root)
>  		return ret;
>  
>  	spin_lock(&fs_info->qgroup_lock);
> @@ -2875,7 +2866,6 @@ static bool qgroup_check_limits(struct btrfs_fs_info *fs_info,
>  static int qgroup_reserve(struct btrfs_root *root, u64 num_bytes, bool enforce,
>  			  enum btrfs_qgroup_rsv_type type)
>  {
> -	struct btrfs_root *quota_root;
>  	struct btrfs_qgroup *qgroup;
>  	struct btrfs_fs_info *fs_info = root->fs_info;
>  	u64 ref_root = root->root_key.objectid;
> @@ -2894,8 +2884,7 @@ static int qgroup_reserve(struct btrfs_root *root, u64 num_bytes, bool enforce,
>  		enforce = false;
>  
>  	spin_lock(&fs_info->qgroup_lock);
> -	quota_root = fs_info->quota_root;
> -	if (!quota_root)
> +	if (!fs_info->quota_root)
>  		goto out;
>  
>  	qgroup = find_qgroup_rb(fs_info, ref_root);
> @@ -2962,7 +2951,6 @@ void btrfs_qgroup_free_refroot(struct btrfs_fs_info *fs_info,
>  			       u64 ref_root, u64 num_bytes,
>  			       enum btrfs_qgroup_rsv_type type)
>  {
> -	struct btrfs_root *quota_root;
>  	struct btrfs_qgroup *qgroup;
>  	struct ulist_node *unode;
>  	struct ulist_iterator uiter;
> @@ -2980,8 +2968,7 @@ void btrfs_qgroup_free_refroot(struct btrfs_fs_info *fs_info,
>  	}
>  	spin_lock(&fs_info->qgroup_lock);
>  
> -	quota_root = fs_info->quota_root;
> -	if (!quota_root)
> +	if (!fs_info->quota_root)
>  		goto out;
>  
>  	qgroup = find_qgroup_rb(fs_info, ref_root);
> @@ -3681,7 +3668,6 @@ void __btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes,
>  static void qgroup_convert_meta(struct btrfs_fs_info *fs_info, u64 ref_root,
>  				int num_bytes)
>  {
> -	struct btrfs_root *quota_root = fs_info->quota_root;
>  	struct btrfs_qgroup *qgroup;
>  	struct ulist_node *unode;
>  	struct ulist_iterator uiter;
> @@ -3689,7 +3675,7 @@ static void qgroup_convert_meta(struct btrfs_fs_info *fs_info, u64 ref_root,
>  
>  	if (num_bytes == 0)
>  		return;
> -	if (!quota_root)
> +	if (!fs_info->quota_root)
>  		return;
>  
>  	spin_lock(&fs_info->qgroup_lock);
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-11-26  2:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26  0:58 [PATCH 0/2] btrfs qgroup cleanup Marcos Paulo de Souza
2019-11-26  0:58 ` [PATCH 1/2] btrfs: qgroup: Cleanup quota_root checks Marcos Paulo de Souza
2019-11-26  2:47   ` Qu Wenruo [this message]
2019-11-26  0:58 ` [PATCH 2/2] btrfs: qgroup: Return -ENOTCONN instead of -EINVAL Marcos Paulo de Souza
2019-11-26  2:50   ` Qu Wenruo
2019-11-26 17:00 ` [PATCH 0/2] btrfs qgroup cleanup David Sterba

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=2644e882-5ca1-0fa8-7dde-1edd64f8243d@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=anand.jain@oracle.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcos.souza.org@gmail.com \
    --cc=mpdesouza@suse.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.