Commit d1f68ba0 authored by Omar Sandoval's avatar Omar Sandoval Committed by David Sterba

btrfs: rename btrfs_insert_file_extent() to btrfs_insert_hole_extent()

btrfs_insert_file_extent() is only ever used to insert holes, so rename
it and remove the redundant parameters.
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarOmar Sandoval <osandov@osandov.com>
Signed-off-by: default avatarSweet Tea Dorminy <sweettea-kernel@dorminy.me>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 7f298f22
...@@ -3343,12 +3343,9 @@ int btrfs_find_orphan_item(struct btrfs_root *root, u64 offset); ...@@ -3343,12 +3343,9 @@ int btrfs_find_orphan_item(struct btrfs_root *root, u64 offset);
int btrfs_del_csums(struct btrfs_trans_handle *trans, int btrfs_del_csums(struct btrfs_trans_handle *trans,
struct btrfs_root *root, u64 bytenr, u64 len); struct btrfs_root *root, u64 bytenr, u64 len);
blk_status_t btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, u8 *dst); blk_status_t btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, u8 *dst);
int btrfs_insert_file_extent(struct btrfs_trans_handle *trans, int btrfs_insert_hole_extent(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root, u64 objectid, u64 pos,
u64 objectid, u64 pos, u64 num_bytes);
u64 disk_offset, u64 disk_num_bytes,
u64 num_bytes, u64 offset, u64 ram_bytes,
u8 compression, u8 encryption, u16 other_encoding);
int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans, int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct btrfs_path *path, u64 objectid, struct btrfs_path *path, u64 objectid,
......
...@@ -129,12 +129,9 @@ static inline u32 max_ordered_sum_bytes(struct btrfs_fs_info *fs_info, ...@@ -129,12 +129,9 @@ static inline u32 max_ordered_sum_bytes(struct btrfs_fs_info *fs_info,
return ncsums * fs_info->sectorsize; return ncsums * fs_info->sectorsize;
} }
int btrfs_insert_file_extent(struct btrfs_trans_handle *trans, int btrfs_insert_hole_extent(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
u64 objectid, u64 pos, u64 objectid, u64 pos, u64 num_bytes)
u64 disk_offset, u64 disk_num_bytes,
u64 num_bytes, u64 offset, u64 ram_bytes,
u8 compression, u8 encryption, u16 other_encoding)
{ {
int ret = 0; int ret = 0;
struct btrfs_file_extent_item *item; struct btrfs_file_extent_item *item;
...@@ -157,16 +154,16 @@ int btrfs_insert_file_extent(struct btrfs_trans_handle *trans, ...@@ -157,16 +154,16 @@ int btrfs_insert_file_extent(struct btrfs_trans_handle *trans,
leaf = path->nodes[0]; leaf = path->nodes[0];
item = btrfs_item_ptr(leaf, path->slots[0], item = btrfs_item_ptr(leaf, path->slots[0],
struct btrfs_file_extent_item); struct btrfs_file_extent_item);
btrfs_set_file_extent_disk_bytenr(leaf, item, disk_offset); btrfs_set_file_extent_disk_bytenr(leaf, item, 0);
btrfs_set_file_extent_disk_num_bytes(leaf, item, disk_num_bytes); btrfs_set_file_extent_disk_num_bytes(leaf, item, 0);
btrfs_set_file_extent_offset(leaf, item, offset); btrfs_set_file_extent_offset(leaf, item, 0);
btrfs_set_file_extent_num_bytes(leaf, item, num_bytes); btrfs_set_file_extent_num_bytes(leaf, item, num_bytes);
btrfs_set_file_extent_ram_bytes(leaf, item, ram_bytes); btrfs_set_file_extent_ram_bytes(leaf, item, num_bytes);
btrfs_set_file_extent_generation(leaf, item, trans->transid); btrfs_set_file_extent_generation(leaf, item, trans->transid);
btrfs_set_file_extent_type(leaf, item, BTRFS_FILE_EXTENT_REG); btrfs_set_file_extent_type(leaf, item, BTRFS_FILE_EXTENT_REG);
btrfs_set_file_extent_compression(leaf, item, compression); btrfs_set_file_extent_compression(leaf, item, 0);
btrfs_set_file_extent_encryption(leaf, item, encryption); btrfs_set_file_extent_encryption(leaf, item, 0);
btrfs_set_file_extent_other_encoding(leaf, item, other_encoding); btrfs_set_file_extent_other_encoding(leaf, item, 0);
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
out: out:
......
...@@ -2505,8 +2505,8 @@ static int fill_holes(struct btrfs_trans_handle *trans, ...@@ -2505,8 +2505,8 @@ static int fill_holes(struct btrfs_trans_handle *trans,
} }
btrfs_release_path(path); btrfs_release_path(path);
ret = btrfs_insert_file_extent(trans, root, btrfs_ino(inode), ret = btrfs_insert_hole_extent(trans, root, btrfs_ino(inode), offset,
offset, 0, 0, end - offset, 0, end - offset, 0, 0, 0); end - offset);
if (ret) if (ret)
return ret; return ret;
......
...@@ -5023,8 +5023,7 @@ static int maybe_insert_hole(struct btrfs_root *root, struct btrfs_inode *inode, ...@@ -5023,8 +5023,7 @@ static int maybe_insert_hole(struct btrfs_root *root, struct btrfs_inode *inode,
return ret; return ret;
} }
ret = btrfs_insert_file_extent(trans, root, btrfs_ino(inode), ret = btrfs_insert_hole_extent(trans, root, btrfs_ino(inode), offset, len);
offset, 0, 0, len, 0, len, 0, 0, 0);
if (ret) { if (ret) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
} else { } else {
......
...@@ -5221,10 +5221,9 @@ static int btrfs_log_holes(struct btrfs_trans_handle *trans, ...@@ -5221,10 +5221,9 @@ static int btrfs_log_holes(struct btrfs_trans_handle *trans,
* leafs from the log root. * leafs from the log root.
*/ */
btrfs_release_path(path); btrfs_release_path(path);
ret = btrfs_insert_file_extent(trans, root->log_root, ret = btrfs_insert_hole_extent(trans, root->log_root,
ino, prev_extent_end, 0, ino, prev_extent_end,
0, hole_len, 0, hole_len, hole_len);
0, 0, 0);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -5253,10 +5252,8 @@ static int btrfs_log_holes(struct btrfs_trans_handle *trans, ...@@ -5253,10 +5252,8 @@ static int btrfs_log_holes(struct btrfs_trans_handle *trans,
btrfs_release_path(path); btrfs_release_path(path);
hole_len = ALIGN(i_size - prev_extent_end, fs_info->sectorsize); hole_len = ALIGN(i_size - prev_extent_end, fs_info->sectorsize);
ret = btrfs_insert_file_extent(trans, root->log_root, ret = btrfs_insert_hole_extent(trans, root->log_root, ino,
ino, prev_extent_end, 0, 0, prev_extent_end, hole_len);
hole_len, 0, hole_len,
0, 0, 0);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment