@@ -2425,9 +2425,8 @@ split:
return ret;
}
-int btrfs_truncate_item(struct btrfs_path *path, u32 new_size, int from_end)
+void btrfs_truncate_item(struct btrfs_path *path, u32 new_size, int from_end)
{
- int ret = 0;
int slot;
struct extent_buffer *leaf;
u32 nritems;
@@ -2442,7 +2441,7 @@ int btrfs_truncate_item(struct btrfs_path *path, u32 new_size, int from_end)
old_size = btrfs_item_size(leaf, slot);
if (old_size == new_size)
- return 0;
+ return;
nritems = btrfs_header_nritems(leaf);
data_end = leaf_data_end(leaf);
@@ -2508,12 +2507,10 @@ int btrfs_truncate_item(struct btrfs_path *path, u32 new_size, int from_end)
btrfs_set_item_size(leaf, slot, new_size);
btrfs_mark_buffer_dirty(leaf);
- ret = 0;
if (btrfs_leaf_free_space(leaf) < 0) {
btrfs_print_leaf(leaf);
BUG();
}
- return ret;
}
int btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
@@ -969,7 +969,7 @@ int btrfs_create_root(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 objectid);
int btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
u32 data_size);
-int btrfs_truncate_item(struct btrfs_path *path, u32 new_size, int from_end);
+void btrfs_truncate_item(struct btrfs_path *path, u32 new_size, int from_end);
int btrfs_split_item(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path,
@@ -1129,7 +1129,6 @@ static int update_inline_extent_backref(struct btrfs_trans_handle *trans,
u32 item_size;
int size;
int type;
- int ret;
u64 refs;
leaf = path->nodes[0];
@@ -1169,8 +1168,7 @@ static int update_inline_extent_backref(struct btrfs_trans_handle *trans,
memmove_extent_buffer(leaf, ptr, ptr + size,
end - ptr - size);
item_size -= size;
- ret = btrfs_truncate_item(path, item_size, 1);
- BUG_ON(ret);
+ btrfs_truncate_item(path, item_size, 1);
}
btrfs_mark_buffer_dirty(leaf);
return 0;
@@ -356,7 +356,6 @@ static noinline int truncate_one_csum(struct btrfs_root *root,
u64 csum_end;
u64 end_byte = bytenr + len;
u32 blocksize = root->fs_info->sectorsize;
- int ret;
leaf = path->nodes[0];
csum_end = btrfs_item_size(leaf, path->slots[0]) / csum_size;
@@ -372,8 +371,7 @@ static noinline int truncate_one_csum(struct btrfs_root *root,
*/
u32 new_size = (bytenr - key->offset) / blocksize;
new_size *= csum_size;
- ret = btrfs_truncate_item(path, new_size, 1);
- BUG_ON(ret);
+ btrfs_truncate_item(path, new_size, 1);
} else if (key->offset >= bytenr && csum_end > end_byte &&
end_byte > key->offset) {
/*
@@ -385,8 +383,7 @@ static noinline int truncate_one_csum(struct btrfs_root *root,
u32 new_size = (csum_end - end_byte) / blocksize;
new_size *= csum_size;
- ret = btrfs_truncate_item(path, new_size, 0);
- BUG_ON(ret);
+ btrfs_truncate_item(path, new_size, 0);
key->offset = end_byte;
btrfs_set_item_key_safe(root->fs_info, path, key);
This is void in the kernel, and this makes sense in btrfs-progs as it stands currently as it doesn't actually return an error if there's a problem, it simply BUG()'s. Update this to be a void and update the callers to make it easier to sync ctree.c. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- kernel-shared/ctree.c | 7 ++----- kernel-shared/ctree.h | 2 +- kernel-shared/extent-tree.c | 4 +--- kernel-shared/file-item.c | 7 ++----- 4 files changed, 6 insertions(+), 14 deletions(-)