From: Jeff Mahoney <jeffm@suse.com>
To: Nikolay Borisov <nborisov@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/3] btrfs: Remove fs_info argument from __btrfs_inc_extent_ref
Date: Tue, 19 Jun 2018 15:31:30 -0400 [thread overview]
Message-ID: <cad42e02-c494-a10e-5e12-f21cd209579c@suse.com> (raw)
In-Reply-To: <1529323166-29931-2-git-send-email-nborisov@suse.com>
[-- Attachment #1.1: Type: text/plain, Size: 2855 bytes --]
On 6/18/18 7:59 AM, Nikolay Borisov wrote:
> This function already takes a transaction which holds a reference to
> the fs_info struct. Use that reference and remove the extra arg. No
> functional changes.
I like the idea here. I wasn't sold at first, but I think if we can
standardize on taking only a trans handle when one is required and both
a trans and fs_info when it's optional, it'll make the code clearer.
This cleanup can percolate up the stack to cover pretty much all of
delayed refs.
Reviewed-by: Jeff Mahoney <jeffm@suse.com>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/extent-tree.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 4850e538ab10..59645ced6fbc 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -2208,12 +2208,12 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
> }
>
> static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
> - struct btrfs_fs_info *fs_info,
> struct btrfs_delayed_ref_node *node,
> u64 parent, u64 root_objectid,
> u64 owner, u64 offset, int refs_to_add,
> struct btrfs_delayed_extent_op *extent_op)
> {
> + struct btrfs_fs_info *fs_info = trans->fs_info;
> struct btrfs_path *path;
> struct extent_buffer *leaf;
> struct btrfs_extent_item *item;
> @@ -2297,10 +2297,9 @@ static int run_delayed_data_ref(struct btrfs_trans_handle *trans,
> ref->objectid, ref->offset,
> &ins, node->ref_mod);
> } else if (node->action == BTRFS_ADD_DELAYED_REF) {
> - ret = __btrfs_inc_extent_ref(trans, fs_info, node, parent,
> - ref_root, ref->objectid,
> - ref->offset, node->ref_mod,
> - extent_op);
> + ret = __btrfs_inc_extent_ref(trans, node, parent, ref_root,
> + ref->objectid, ref->offset,
> + node->ref_mod, extent_op);
> } else if (node->action == BTRFS_DROP_DELAYED_REF) {
> ret = __btrfs_free_extent(trans, fs_info, node, parent,
> ref_root, ref->objectid,
> @@ -2450,10 +2449,8 @@ static int run_delayed_tree_ref(struct btrfs_trans_handle *trans,
> BUG_ON(!extent_op || !extent_op->update_flags);
> ret = alloc_reserved_tree_block(trans, node, extent_op);
> } else if (node->action == BTRFS_ADD_DELAYED_REF) {
> - ret = __btrfs_inc_extent_ref(trans, fs_info, node,
> - parent, ref_root,
> - ref->level, 0, 1,
> - extent_op);
> + ret = __btrfs_inc_extent_ref(trans, node, parent, ref_root,
> + ref->level, 0, 1, extent_op);
> } else if (node->action == BTRFS_DROP_DELAYED_REF) {
> ret = __btrfs_free_extent(trans, fs_info, node,
> parent, ref_root,
>
--
Jeff Mahoney
SUSE Labs
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-06-19 19:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-18 11:59 [PATCH 0/3] Cleanups around extent increment Nikolay Borisov
2018-06-18 11:59 ` [PATCH 1/3] btrfs: Remove fs_info argument from __btrfs_inc_extent_ref Nikolay Borisov
2018-06-19 5:24 ` Qu Wenruo
2018-06-19 13:01 ` Nikolay Borisov
2018-06-19 19:31 ` Jeff Mahoney [this message]
2018-06-19 22:36 ` Nikolay Borisov
2018-06-18 11:59 ` [PATCH 2/3] btrfs: Document __btrfs_inc_extent_ref Nikolay Borisov
2018-06-19 5:28 ` Qu Wenruo
2018-06-18 11:59 ` [PATCH 3/3] btrfs: Fix comment in lookup_inline_extent_backref Nikolay Borisov
2018-06-19 13:35 ` [PATCH 0/3] Cleanups around extent increment 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=cad42e02-c494-a10e-5e12-f21cd209579c@suse.com \
--to=jeffm@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox