if (sctx->parent_root && !sctx->cur_inode_new) {
ret = is_extent_unchanged(sctx, path, key);
if (ret < 0)
- goto out;
- if (ret) {
- ret = 0;
+ return ret;
+ if (ret)
goto out_hole;
- }
} else {
struct btrfs_file_extent_item *ei;
u8 type;
* we have enough commands queued up to justify rev'ing
* the send spec.
*/
- if (type == BTRFS_FILE_EXTENT_PREALLOC) {
- ret = 0;
- goto out;
- }
+ if (type == BTRFS_FILE_EXTENT_PREALLOC)
+ return 0;
/* Have a hole, just skip it. */
- if (btrfs_file_extent_disk_bytenr(path->nodes[0], ei) == 0) {
- ret = 0;
- goto out;
- }
+ if (btrfs_file_extent_disk_bytenr(path->nodes[0], ei) == 0)
+ return 0;
}
}
ret = find_extent_clone(sctx, path, key->objectid, key->offset,
sctx->cur_inode_size, &found_clone);
if (ret != -ENOENT && ret < 0)
- goto out;
+ return ret;
ret = send_write_or_clone(sctx, path, key, found_clone);
if (ret)
- goto out;
+ return ret;
out_hole:
- ret = maybe_send_hole(sctx, path, key);
-out:
- return ret;
+ return maybe_send_hole(sctx, path, key);
}
static int process_all_extents(struct send_ctx *sctx)
int *pending_move,
int *refs_processed)
{
- int ret = 0;
+ int ret;
if (sctx->cur_ino == 0)
- goto out;
+ return 0;
+
if (!at_end && sctx->cur_ino == sctx->cmp_key->objectid &&
sctx->cmp_key->type <= BTRFS_INODE_EXTREF_KEY)
- goto out;
+ return 0;
+
if (list_empty(&sctx->new_refs) && list_empty(&sctx->deleted_refs))
- goto out;
+ return 0;
ret = process_recorded_refs(sctx, pending_move);
if (ret < 0)
- goto out;
+ return ret;
*refs_processed = 1;
-out:
- return ret;
+ return 0;
}
static int finish_inode_if_needed(struct send_ctx *sctx, bool at_end)
static int changed_inode(struct send_ctx *sctx,
enum btrfs_compare_tree_result result)
{
- int ret = 0;
+ int ret;
struct btrfs_key *key = sctx->cmp_key;
struct btrfs_inode_item *left_ii = NULL;
struct btrfs_inode_item *right_ii = NULL;
if (result == BTRFS_COMPARE_TREE_NEW) {
if (btrfs_inode_nlink(sctx->left_path->nodes[0], left_ii) == 0) {
sctx->ignore_cur_inode = true;
- goto out;
+ return 0;
}
sctx->cur_inode_gen = left_gen;
sctx->cur_inode_new = true;
old_nlinks = btrfs_inode_nlink(sctx->right_path->nodes[0], right_ii);
if (new_nlinks == 0 && old_nlinks == 0) {
sctx->ignore_cur_inode = true;
- goto out;
+ return 0;
} else if (new_nlinks == 0 || old_nlinks == 0) {
sctx->cur_inode_new_gen = 1;
}
ret = process_all_refs(sctx,
BTRFS_COMPARE_TREE_DELETED);
if (ret < 0)
- goto out;
+ return ret;
}
/*
left_ii);
ret = send_create_inode_if_needed(sctx);
if (ret < 0)
- goto out;
+ return ret;
ret = process_all_refs(sctx, BTRFS_COMPARE_TREE_NEW);
if (ret < 0)
- goto out;
+ return ret;
/*
* Advance send_progress now as we did not get
* into process_recorded_refs_if_needed in the
*/
ret = process_all_extents(sctx);
if (ret < 0)
- goto out;
+ return ret;
ret = process_all_new_xattrs(sctx);
if (ret < 0)
- goto out;
+ return ret;
}
} else {
sctx->cur_inode_gen = left_gen;
}
}
-out:
- return ret;
+ return 0;
}
/*
u32 item_size;
u32 cur_offset = 0;
int ref_name_len;
- int ret = 0;
/* Easy case, just check this one dirid */
if (key->type == BTRFS_INODE_REF_KEY) {
dirid = key->offset;
- ret = dir_changed(sctx, dirid);
- goto out;
+ return dir_changed(sctx, dirid);
}
leaf = path->nodes[0];
item_size = btrfs_item_size(leaf, path->slots[0]);
ptr = btrfs_item_ptr_offset(leaf, path->slots[0]);
while (cur_offset < item_size) {
+ int ret;
+
extref = (struct btrfs_inode_extref *)(ptr +
cur_offset);
dirid = btrfs_inode_extref_parent(leaf, extref);
continue;
ret = dir_changed(sctx, dirid);
if (ret)
- break;
+ return ret;
last_dirid = dirid;
}
-out:
- return ret;
+ return 0;
}
/*
ret = finish_inode_if_needed(sctx, 0);
if (ret < 0)
- goto out;
+ return ret;
/* Ignore non-FS objects */
if (key->objectid == BTRFS_FREE_INO_OBJECTID ||
key->objectid == BTRFS_FREE_SPACE_OBJECTID)
- goto out;
+ return 0;
if (key->type == BTRFS_INODE_ITEM_KEY) {
ret = changed_inode(sctx, result);
ret = changed_verity(sctx, result);
}
-out:
return ret;
}