Commit 64f54188 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: make btrfs_create_dio_extent take btrfs_inode

Take btrfs_inode directly and stop using superfulous BTRFS_I calls.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent c1e09520
...@@ -6868,7 +6868,7 @@ struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode, ...@@ -6868,7 +6868,7 @@ struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode,
return em; return em;
} }
static struct extent_map *btrfs_create_dio_extent(struct inode *inode, static struct extent_map *btrfs_create_dio_extent(struct btrfs_inode *inode,
const u64 start, const u64 start,
const u64 len, const u64 len,
const u64 orig_start, const u64 orig_start,
...@@ -6882,21 +6882,19 @@ static struct extent_map *btrfs_create_dio_extent(struct inode *inode, ...@@ -6882,21 +6882,19 @@ static struct extent_map *btrfs_create_dio_extent(struct inode *inode,
int ret; int ret;
if (type != BTRFS_ORDERED_NOCOW) { if (type != BTRFS_ORDERED_NOCOW) {
em = create_io_em(BTRFS_I(inode), start, len, orig_start, em = create_io_em(inode, start, len, orig_start, block_start,
block_start, block_len, orig_block_len, block_len, orig_block_len, ram_bytes,
ram_bytes,
BTRFS_COMPRESS_NONE, /* compress_type */ BTRFS_COMPRESS_NONE, /* compress_type */
type); type);
if (IS_ERR(em)) if (IS_ERR(em))
goto out; goto out;
} }
ret = btrfs_add_ordered_extent_dio(BTRFS_I(inode), start, block_start, ret = btrfs_add_ordered_extent_dio(inode, start, block_start, len,
len, block_len, type); block_len, type);
if (ret) { if (ret) {
if (em) { if (em) {
free_extent_map(em); free_extent_map(em);
btrfs_drop_extent_cache(BTRFS_I(inode), start, btrfs_drop_extent_cache(inode, start, start + len - 1, 0);
start + len - 1, 0);
} }
em = ERR_PTR(ret); em = ERR_PTR(ret);
} }
...@@ -6921,7 +6919,7 @@ static struct extent_map *btrfs_new_extent_direct(struct inode *inode, ...@@ -6921,7 +6919,7 @@ static struct extent_map *btrfs_new_extent_direct(struct inode *inode,
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
em = btrfs_create_dio_extent(inode, start, ins.offset, start, em = btrfs_create_dio_extent(BTRFS_I(inode), start, ins.offset, start,
ins.objectid, ins.offset, ins.offset, ins.objectid, ins.offset, ins.offset,
ins.offset, BTRFS_ORDERED_REGULAR); ins.offset, BTRFS_ORDERED_REGULAR);
btrfs_dec_block_group_reservations(fs_info, ins.objectid); btrfs_dec_block_group_reservations(fs_info, ins.objectid);
...@@ -7295,7 +7293,7 @@ static int btrfs_get_blocks_direct_write(struct extent_map **map, ...@@ -7295,7 +7293,7 @@ static int btrfs_get_blocks_direct_write(struct extent_map **map,
btrfs_inc_nocow_writers(fs_info, block_start)) { btrfs_inc_nocow_writers(fs_info, block_start)) {
struct extent_map *em2; struct extent_map *em2;
em2 = btrfs_create_dio_extent(inode, start, len, em2 = btrfs_create_dio_extent(BTRFS_I(inode), start, len,
orig_start, block_start, orig_start, block_start,
len, orig_block_len, len, orig_block_len,
ram_bytes, type); ram_bytes, type);
......
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