diff options
author | Nikolay Borisov <nborisov@suse.com> | 2018-04-24 16:18:18 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-05-28 18:07:30 +0200 |
commit | 646f4dd76fb3ac0d1e8677890522d4c044ee2f06 (patch) | |
tree | 2b689d007d7ba0ac5d57676e2ff63f7c0545210c /fs | |
parent | btrfs: Factor out common delayed refs init code (diff) | |
download | linux-646f4dd76fb3ac0d1e8677890522d4c044ee2f06.tar.xz linux-646f4dd76fb3ac0d1e8677890522d4c044ee2f06.zip |
btrfs: Use init_delayed_ref_common in add_delayed_tree_ref
Use the newly introduced common helper. No functional changes.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/delayed-ref.c | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index a0dc255792c7..1c27d3322198 100644 --- a/fs/btrfs/delayed-ref.c +++ b/fs/btrfs/delayed-ref.c @@ -708,38 +708,25 @@ add_delayed_tree_ref(struct btrfs_fs_info *fs_info, { struct btrfs_delayed_tree_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; - - if (is_fstree(ref_root)) - seq = atomic64_read(&fs_info->tree_mod_seq); delayed_refs = &trans->transaction->delayed_refs; - - /* 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_tree_ref(ref); - full_ref->parent = parent; - full_ref->root = ref_root; if (parent) - ref->type = BTRFS_SHARED_BLOCK_REF_KEY; + ref_type = BTRFS_SHARED_BLOCK_REF_KEY; else - ref->type = BTRFS_TREE_BLOCK_REF_KEY; + ref_type = BTRFS_TREE_BLOCK_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->level = level; - trace_add_delayed_tree_ref(fs_info, ref, full_ref, action); + trace_add_delayed_tree_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); |