int del_nr = 0;
int del_slot = 0;
int recow;
- int ret = 0;
+ int ret;
u64 ino = btrfs_ino(inode);
path = btrfs_alloc_path();
ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
if (ret < 0)
- goto out;
+ return ret;
if (ret > 0 && path->slots[0] > 0)
path->slots[0]--;
if (unlikely(key.objectid != ino || key.type != BTRFS_EXTENT_DATA_KEY)) {
ret = -EINVAL;
btrfs_abort_transaction(trans, ret);
- goto out;
+ return ret;
}
fi = btrfs_item_ptr(leaf, path->slots[0],
struct btrfs_file_extent_item);
if (unlikely(btrfs_file_extent_type(leaf, fi) != BTRFS_FILE_EXTENT_PREALLOC)) {
ret = -EINVAL;
btrfs_abort_transaction(trans, ret);
- goto out;
+ return ret;
}
extent_end = key.offset + btrfs_file_extent_num_bytes(leaf, fi);
if (unlikely(key.offset > start || extent_end < end)) {
ret = -EINVAL;
btrfs_abort_transaction(trans, ret);
- goto out;
+ return ret;
}
bytenr = btrfs_file_extent_disk_bytenr(leaf, fi);
trans->transid);
btrfs_set_file_extent_num_bytes(leaf, fi,
end - other_start);
- goto out;
+ return 0;
}
}
other_end - start);
btrfs_set_file_extent_offset(leaf, fi,
start - orig_offset);
- goto out;
+ return 0;
}
}
}
if (unlikely(ret < 0)) {
btrfs_abort_transaction(trans, ret);
- goto out;
+ return ret;
}
leaf = path->nodes[0];
ret = btrfs_inc_extent_ref(trans, &ref);
if (unlikely(ret)) {
btrfs_abort_transaction(trans, ret);
- goto out;
+ return ret;
}
if (split == start) {
if (unlikely(start != key.offset)) {
ret = -EINVAL;
btrfs_abort_transaction(trans, ret);
- goto out;
+ return ret;
}
path->slots[0]--;
extent_end = end;
ret = btrfs_free_extent(trans, &ref);
if (unlikely(ret)) {
btrfs_abort_transaction(trans, ret);
- goto out;
+ return ret;
}
}
other_start = 0;
ret = btrfs_free_extent(trans, &ref);
if (unlikely(ret)) {
btrfs_abort_transaction(trans, ret);
- goto out;
+ return ret;
}
}
if (del_nr == 0) {
ret = btrfs_del_items(trans, root, path, del_slot, del_nr);
if (unlikely(ret < 0)) {
btrfs_abort_transaction(trans, ret);
- goto out;
+ return ret;
}
}
-out:
- return ret;
+
+ return 0;
}
/*