summaryrefslogtreecommitdiff
path: root/extent-tree.c
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2018-06-08 15:47:56 +0300
committerDavid Sterba <dsterba@suse.com>2018-10-23 14:48:41 +0200
commit3c8faad5cffdc78c12d318bf4ecd422b9d8f1ab2 (patch)
treea682b1796d8ef4c13bab7c7e903c40cc1369096d /extent-tree.c
parent98197fbcc5b5cfb77dd8b2398070ad98b488b958 (diff)
btrfs-progs: add alloc_reserved_tree_block2 function
This is a simple adapter function to convert the delayed-refs structures to the current arguments of alloc_reserved_tree_block. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'extent-tree.c')
-rw-r--r--extent-tree.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/extent-tree.c b/extent-tree.c
index 94b61cc..3abb8a8 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -2687,6 +2687,30 @@ int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
return ret;
}
+static int alloc_reserved_tree_block2(struct btrfs_trans_handle *trans,
+ struct btrfs_delayed_ref_node *node,
+ struct btrfs_delayed_extent_op *extent_op)
+{
+
+ struct btrfs_delayed_tree_ref *ref = btrfs_delayed_node_to_tree_ref(node);
+ struct btrfs_key ins;
+ bool skinny_metadata = btrfs_fs_incompat(trans->fs_info, SKINNY_METADATA);
+
+ ins.objectid = node->bytenr;
+ if (skinny_metadata) {
+ ins.offset = ref->level;
+ ins.type = BTRFS_METADATA_ITEM_KEY;
+ } else {
+ ins.offset = node->num_bytes;
+ ins.type = BTRFS_EXTENT_ITEM_KEY;
+ }
+
+ return alloc_reserved_tree_block(trans, ref->root, trans->transid,
+ extent_op->flags_to_set,
+ &extent_op->key, ref->level, &ins);
+
+}
+
static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
u64 root_objectid, u64 generation,
u64 flags, struct btrfs_disk_key *key,