From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 3/8] btrfs: Use init_delayed_ref_common in add_delayed_data_ref
Date: Wed, 21 Mar 2018 10:45:07 +0200 [thread overview]
Message-ID: <1521621912-25065-4-git-send-email-nborisov@suse.com> (raw)
In-Reply-To: <1521621912-25065-1-git-send-email-nborisov@suse.com>
Use the newly introduced helper and remove the duplicate code.
No functional changes
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/delayed-ref.c | 34 ++++++++++------------------------
1 file changed, 10 insertions(+), 24 deletions(-)
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 4e009b3f0ec9..7ec2282d2fe0 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -763,41 +763,27 @@ add_delayed_data_ref(struct btrfs_trans_handle *trans,
{
struct btrfs_delayed_data_ref *full_ref;
struct btrfs_delayed_ref_root *delayed_refs;
- u64 seq = 0;
+ u8 ref_type;
int ret;
- if (action == BTRFS_ADD_DELAYED_EXTENT)
- action = BTRFS_ADD_DELAYED_REF;
delayed_refs = &trans->transaction->delayed_refs;
-
- if (is_fstree(ref_root))
- seq = atomic64_read(&trans->fs_info->tree_mod_seq);
-
- /* first set the basic ref node struct up */
- refcount_set(&ref->refs, 1);
- ref->bytenr = bytenr;
- ref->num_bytes = num_bytes;
- ref->ref_mod = 1;
- ref->action = action;
- ref->is_head = 0;
- ref->in_tree = 1;
- ref->seq = seq;
- RB_CLEAR_NODE(&ref->ref_node);
- INIT_LIST_HEAD(&ref->add_list);
-
full_ref = btrfs_delayed_node_to_data_ref(ref);
- full_ref->parent = parent;
- full_ref->root = ref_root;
if (parent)
- ref->type = BTRFS_SHARED_DATA_REF_KEY;
+ ref_type = BTRFS_SHARED_DATA_REF_KEY;
else
- ref->type = BTRFS_EXTENT_DATA_REF_KEY;
+ ref_type = BTRFS_EXTENT_DATA_REF_KEY;
+ init_delayed_ref_common(trans->fs_info, ref, bytenr, num_bytes,
+ ref_root, action, ref_type);
+ full_ref->root = ref_root;
+ full_ref->parent = parent;
full_ref->objectid = owner;
full_ref->offset = offset;
- trace_add_delayed_data_ref(trans->fs_info, ref, full_ref, action);
+ trace_add_delayed_data_ref(trans->fs_info, ref, full_ref,
+ action == BTRFS_ADD_DELAYED_EXTENT ?
+ BTRFS_ADD_DELAYED_REF : action);
ret = insert_delayed_ref(trans, delayed_refs, head_ref, ref);
if (ret > 0)
--
2.7.4
next prev parent reply other threads:[~2018-03-21 8:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-21 8:45 [PATCH 0/8] Delayed refs cleanups/streamlining Nikolay Borisov
2018-03-21 8:45 ` [PATCH 1/8] btrfs: Factor out common delayed refs init code Nikolay Borisov
2018-03-21 8:45 ` [PATCH 2/8] btrfs: Use init_delayed_ref_common in add_delayed_tree_ref Nikolay Borisov
2018-03-21 8:45 ` Nikolay Borisov [this message]
2018-03-21 8:45 ` [PATCH 4/8] btrfs: Open-code add_delayed_tree_ref Nikolay Borisov
2018-03-21 8:45 ` [PATCH 5/8] btrfs: Open-code add_delayed_data_ref Nikolay Borisov
2018-03-21 8:45 ` [PATCH 6/8] btrfs: Introduce init_delayed_ref_head Nikolay Borisov
2018-03-21 8:45 ` [PATCH 7/8] btrfs: Use init_delayed_ref_head in add_delayed_ref_head Nikolay Borisov
2018-03-21 8:45 ` [PATCH 8/8] btrfs: split delayed ref head initialization and addition Nikolay Borisov
2018-03-27 19:08 ` [PATCH 0/8] Delayed refs cleanups/streamlining 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=1521621912-25065-4-git-send-email-nborisov@suse.com \
--to=nborisov@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).