From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Lu Fengqi <lufq.fnst@cn.fujitsu.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 13/19] btrfs: qgroup: Drop fs_info parameter from btrfs_qgroup_trace_extent
Date: Wed, 18 Jul 2018 14:58:06 +0800 [thread overview]
Message-ID: <ca879289-7a26-e445-210d-0d8c8c9c173e@gmx.com> (raw)
In-Reply-To: <20180718064542.2730-14-lufq.fnst@cn.fujitsu.com>
[-- Attachment #1.1: Type: text/plain, Size: 3475 bytes --]
On 2018年07月18日 14:45, Lu Fengqi wrote:
> It can be fetched from the transaction handle.
>
> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
> ---
> fs/btrfs/qgroup.c | 13 ++++++-------
> fs/btrfs/qgroup.h | 5 ++---
> fs/btrfs/tree-log.c | 2 +-
> 3 files changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
> index c85c1a0e933a..01add73cb2aa 100644
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -1579,10 +1579,10 @@ int btrfs_qgroup_trace_extent_post(struct btrfs_fs_info *fs_info,
> return 0;
> }
>
> -int btrfs_qgroup_trace_extent(struct btrfs_trans_handle *trans,
> - struct btrfs_fs_info *fs_info, u64 bytenr, u64 num_bytes,
> - gfp_t gfp_flag)
> +int btrfs_qgroup_trace_extent(struct btrfs_trans_handle *trans, u64 bytenr,
> + u64 num_bytes, gfp_t gfp_flag)
> {
> + struct btrfs_fs_info *fs_info = trans->fs_info;
Just lines below, we do extra WARN_ON(trans == NULL).
So if we really hit some case with NULL trans, this would cause a NULL
pointer dereference.
Although I have to admit, I'm a little paranoid about possible NULL
trans passed in.
So maybe it's a good timing to remove that WARN_ON() too?
Thanks,
Qu
> struct btrfs_qgroup_extent_record *record;
> struct btrfs_delayed_ref_root *delayed_refs;
> int ret;
> @@ -1644,8 +1644,8 @@ int btrfs_qgroup_trace_leaf_items(struct btrfs_trans_handle *trans,
>
> num_bytes = btrfs_file_extent_disk_num_bytes(eb, fi);
>
> - ret = btrfs_qgroup_trace_extent(trans, fs_info, bytenr,
> - num_bytes, GFP_NOFS);
> + ret = btrfs_qgroup_trace_extent(trans, bytenr, num_bytes,
> + GFP_NOFS);
> if (ret)
> return ret;
> }
> @@ -1796,8 +1796,7 @@ int btrfs_qgroup_trace_subtree(struct btrfs_trans_handle *trans,
> btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
> path->locks[level] = BTRFS_READ_LOCK_BLOCKING;
>
> - ret = btrfs_qgroup_trace_extent(trans, fs_info,
> - child_bytenr,
> + ret = btrfs_qgroup_trace_extent(trans, child_bytenr,
> fs_info->nodesize,
> GFP_NOFS);
> if (ret)
> diff --git a/fs/btrfs/qgroup.h b/fs/btrfs/qgroup.h
> index 385367989ed6..0215dc0b1710 100644
> --- a/fs/btrfs/qgroup.h
> +++ b/fs/btrfs/qgroup.h
> @@ -212,9 +212,8 @@ int btrfs_qgroup_trace_extent_post(struct btrfs_fs_info *fs_info,
> * Return <0 for error, like memory allocation failure or invalid parameter
> * (NULL trans)
> */
> -int btrfs_qgroup_trace_extent(struct btrfs_trans_handle *trans,
> - struct btrfs_fs_info *fs_info, u64 bytenr, u64 num_bytes,
> - gfp_t gfp_flag);
> +int btrfs_qgroup_trace_extent(struct btrfs_trans_handle *trans, u64 bytenr,
> + u64 num_bytes, gfp_t gfp_flag);
>
> /*
> * Inform qgroup to trace all leaf items of data
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index 7b7498f1f641..10f6a4223897 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -685,7 +685,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
> * as the owner of the file extent changed from log tree
> * (doesn't affect qgroup) to fs/file tree(affects qgroup)
> */
> - ret = btrfs_qgroup_trace_extent(trans, fs_info,
> + ret = btrfs_qgroup_trace_extent(trans,
> btrfs_file_extent_disk_bytenr(eb, item),
> btrfs_file_extent_disk_num_bytes(eb, item),
> GFP_NOFS);
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2018-07-18 7:34 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 6:45 [PATCH 00/19] qgroup unused parameter cleanup Lu Fengqi
2018-07-18 6:45 ` [PATCH 01/19] btrfs: qgroup: Drop quota_root parameter from add_qgroup_relation_item Lu Fengqi
2018-07-18 6:45 ` [PATCH 02/19] btrfs: qgroup: Drop quota_root parameter from del_qgroup_relation_item Lu Fengqi
2018-07-18 6:45 ` [PATCH 03/19] btrfs: qgroup: Drop quota_root parameter from del_qgroup_item Lu Fengqi
2018-07-18 6:45 ` [PATCH 04/19] btrfs: qgroup: Drop root parameter from update_qgroup_limit_item Lu Fengqi
2018-07-18 6:45 ` [PATCH 05/19] btrfs: qgroup: Drop root parameter from update_qgroup_info_item Lu Fengqi
2018-07-18 6:45 ` [PATCH 06/19] btrfs: qgroup: Drop quota_root and fs_info parameters from update_qgroup_status_item Lu Fengqi
2018-07-18 6:45 ` [PATCH 07/19] btrfs: qgroup: Drop fs_info parameter from btrfs_add_qgroup_relation Lu Fengqi
2018-07-18 6:45 ` [PATCH 08/19] btrfs: qgroup: Drop fs_info parameter from __del_qgroup_relation Lu Fengqi
2018-07-18 6:45 ` [PATCH 09/19] btrfs: qgroup: Drop fs_info parameter from btrfs_del_qgroup_relation Lu Fengqi
2018-07-18 6:45 ` [PATCH 10/19] btrfs: qgroup: Drop fs_info parameter from btrfs_create_qgroup Lu Fengqi
2018-07-18 6:45 ` [PATCH 11/19] btrfs: qgroup: Drop fs_info parameter from btrfs_remove_qgroup Lu Fengqi
2018-07-18 6:45 ` [PATCH 12/19] btrfs: qgroup: Drop fs_info parameter from btrfs_limit_qgroup Lu Fengqi
2018-07-18 6:45 ` [PATCH 13/19] btrfs: qgroup: Drop fs_info parameter from btrfs_qgroup_trace_extent Lu Fengqi
2018-07-18 6:58 ` Qu Wenruo [this message]
2018-07-18 7:54 ` Lu Fengqi
2018-07-18 8:02 ` Qu Wenruo
2018-07-18 8:28 ` [PATCH v2 " Lu Fengqi
2018-07-18 6:45 ` [PATCH 14/19] btrfs: qgroup: Drop fs_info parameter from btrfs_qgroup_trace_leaf_items Lu Fengqi
2018-07-18 6:45 ` [PATCH 15/19] btrfs: qgroup: Drop root parameter from btrfs_qgroup_trace_subtree Lu Fengqi
2018-07-18 6:45 ` [PATCH 16/19] btrfs: qgroup: Drop fs_info parameter from btrfs_qgroup_account_extent Lu Fengqi
2018-07-18 6:45 ` [PATCH 17/19] btrfs: qgroup: Drop fs_info parameter from btrfs_run_qgroups Lu Fengqi
2018-07-18 6:45 ` [PATCH 18/19] btrfs: qgroup: Drop fs_info parameter from btrfs_qgroup_inherit Lu Fengqi
2018-07-18 6:45 ` [PATCH 19/19] btrfs: qgroup: Drop fs_info parameter from qgroup_rescan_leaf Lu Fengqi
2018-07-18 7:00 ` [PATCH 00/19] qgroup unused parameter cleanup Qu Wenruo
2018-07-18 13:36 ` 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=ca879289-7a26-e445-210d-0d8c8c9c173e@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=lufq.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