Commit 04ef7631 authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba

btrfs: cleanup duplicated parameters related to btrfs_create_dio_extent()

The following 3 parameters can be cleaned up using btrfs_file_extent
structure:

- len
  btrfs_file_extent::num_bytes

- orig_block_len
  btrfs_file_extent::disk_num_bytes

- ram_bytes
  btrfs_file_extent::ram_bytes
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 9fec848b
...@@ -7005,11 +7005,8 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, ...@@ -7005,11 +7005,8 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
static struct extent_map *btrfs_create_dio_extent(struct btrfs_inode *inode, static struct extent_map *btrfs_create_dio_extent(struct btrfs_inode *inode,
struct btrfs_dio_data *dio_data, struct btrfs_dio_data *dio_data,
const u64 start, const u64 start,
const u64 len, const struct btrfs_file_extent *file_extent,
const u64 orig_block_len, const int type)
const u64 ram_bytes,
const int type,
const struct btrfs_file_extent *file_extent)
{ {
struct extent_map *em = NULL; struct extent_map *em = NULL;
struct btrfs_ordered_extent *ordered; struct btrfs_ordered_extent *ordered;
...@@ -7027,7 +7024,7 @@ static struct extent_map *btrfs_create_dio_extent(struct btrfs_inode *inode, ...@@ -7027,7 +7024,7 @@ static struct extent_map *btrfs_create_dio_extent(struct btrfs_inode *inode,
if (em) { if (em) {
free_extent_map(em); free_extent_map(em);
btrfs_drop_extent_map_range(inode, start, btrfs_drop_extent_map_range(inode, start,
start + len - 1, false); start + file_extent->num_bytes - 1, false);
} }
em = ERR_CAST(ordered); em = ERR_CAST(ordered);
} else { } else {
...@@ -7070,10 +7067,8 @@ static struct extent_map *btrfs_new_extent_direct(struct btrfs_inode *inode, ...@@ -7070,10 +7067,8 @@ static struct extent_map *btrfs_new_extent_direct(struct btrfs_inode *inode,
file_extent.ram_bytes = ins.offset; file_extent.ram_bytes = ins.offset;
file_extent.offset = 0; file_extent.offset = 0;
file_extent.compression = BTRFS_COMPRESS_NONE; file_extent.compression = BTRFS_COMPRESS_NONE;
em = btrfs_create_dio_extent(inode, dio_data, start, ins.offset, em = btrfs_create_dio_extent(inode, dio_data, start, &file_extent,
ins.offset, BTRFS_ORDERED_REGULAR);
ins.offset, BTRFS_ORDERED_REGULAR,
&file_extent);
btrfs_dec_block_group_reservations(fs_info, ins.objectid); btrfs_dec_block_group_reservations(fs_info, ins.objectid);
if (IS_ERR(em)) if (IS_ERR(em))
btrfs_free_reserved_extent(fs_info, ins.objectid, ins.offset, btrfs_free_reserved_extent(fs_info, ins.objectid, ins.offset,
...@@ -7440,10 +7435,8 @@ static int btrfs_get_blocks_direct_write(struct extent_map **map, ...@@ -7440,10 +7435,8 @@ static int btrfs_get_blocks_direct_write(struct extent_map **map,
} }
space_reserved = true; space_reserved = true;
em2 = btrfs_create_dio_extent(BTRFS_I(inode), dio_data, start, len, em2 = btrfs_create_dio_extent(BTRFS_I(inode), dio_data, start,
file_extent.disk_num_bytes, &file_extent, type);
file_extent.ram_bytes, type,
&file_extent);
btrfs_dec_nocow_writers(bg); btrfs_dec_nocow_writers(bg);
if (type == BTRFS_ORDERED_PREALLOC) { if (type == BTRFS_ORDERED_PREALLOC) {
free_extent_map(em); free_extent_map(em);
......
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