Home Home > GIT Browse > SLE12-SP4-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2019-05-14 16:05:45 +0800
committerQu Wenruo <wqu@suse.com>2019-05-14 16:05:45 +0800
commit6a614ca6156442af0553e97add9e6733d870398a (patch)
treef7b9fd1fb313a5e3b1c19421828c808104fcfa25
parentb53159588218593c1fb23ae2b5f605c6a9bda513 (diff)
btrfs: Use init_delayed_ref_common in add_delayed_data_ref
(bsc#1134813). suse-commit: 50b6855f8e57ef30536703f17f41e763ceb661ba
-rw-r--r--fs/btrfs/delayed-ref.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 738bf6122661..88dcfc243a46 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -758,41 +758,28 @@ add_delayed_data_ref(struct btrfs_fs_info *fs_info,
{
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(&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(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(fs_info, ref, full_ref, action);
+ trace_add_delayed_data_ref(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)