Commit 4b67c11d authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: make create_io_em take btrfs_inode

It really wants a btrfs_inode and will allow submit_compressed_extents
to be completely converted to btrfs_inode in follow up patches.
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 7bfa9535
...@@ -84,8 +84,8 @@ static noinline int cow_file_range(struct inode *inode, ...@@ -84,8 +84,8 @@ static noinline int cow_file_range(struct inode *inode,
struct page *locked_page, struct page *locked_page,
u64 start, u64 end, int *page_started, u64 start, u64 end, int *page_started,
unsigned long *nr_written, int unlock); unsigned long *nr_written, int unlock);
static struct extent_map *create_io_em(struct inode *inode, u64 start, u64 len, static struct extent_map *create_io_em(struct btrfs_inode *inode, u64 start,
u64 orig_start, u64 block_start, u64 len, u64 orig_start, u64 block_start,
u64 block_len, u64 orig_block_len, u64 block_len, u64 orig_block_len,
u64 ram_bytes, int compress_type, u64 ram_bytes, int compress_type,
int type); int type);
...@@ -845,7 +845,7 @@ static noinline void submit_compressed_extents(struct async_chunk *async_chunk) ...@@ -845,7 +845,7 @@ static noinline void submit_compressed_extents(struct async_chunk *async_chunk)
* here we're doing allocation and writeback of the * here we're doing allocation and writeback of the
* compressed pages * compressed pages
*/ */
em = create_io_em(inode, async_extent->start, em = create_io_em(BTRFS_I(inode), async_extent->start,
async_extent->ram_size, /* len */ async_extent->ram_size, /* len */
async_extent->start, /* orig_start */ async_extent->start, /* orig_start */
ins.objectid, /* block_start */ ins.objectid, /* block_start */
...@@ -1064,7 +1064,7 @@ static noinline int cow_file_range(struct inode *inode, ...@@ -1064,7 +1064,7 @@ static noinline int cow_file_range(struct inode *inode,
extent_reserved = true; extent_reserved = true;
ram_size = ins.offset; ram_size = ins.offset;
em = create_io_em(inode, start, ins.offset, /* len */ em = create_io_em(BTRFS_I(inode), start, ins.offset, /* len */
start, /* orig_start */ start, /* orig_start */
ins.objectid, /* block_start */ ins.objectid, /* block_start */
ins.offset, /* block_len */ ins.offset, /* block_len */
...@@ -1700,7 +1700,7 @@ static noinline int run_delalloc_nocow(struct inode *inode, ...@@ -1700,7 +1700,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
u64 orig_start = found_key.offset - extent_offset; u64 orig_start = found_key.offset - extent_offset;
struct extent_map *em; struct extent_map *em;
em = create_io_em(inode, cur_offset, num_bytes, em = create_io_em(BTRFS_I(inode), cur_offset, num_bytes,
orig_start, orig_start,
disk_bytenr, /* block_start */ disk_bytenr, /* block_start */
num_bytes, /* block_len */ num_bytes, /* block_len */
...@@ -6861,7 +6861,7 @@ static struct extent_map *btrfs_create_dio_extent(struct inode *inode, ...@@ -6861,7 +6861,7 @@ 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(inode, start, len, orig_start, em = create_io_em(BTRFS_I(inode), start, len, orig_start,
block_start, block_len, orig_block_len, block_start, block_len, orig_block_len,
ram_bytes, ram_bytes,
BTRFS_COMPRESS_NONE, /* compress_type */ BTRFS_COMPRESS_NONE, /* compress_type */
...@@ -7140,8 +7140,8 @@ static int lock_extent_direct(struct inode *inode, u64 lockstart, u64 lockend, ...@@ -7140,8 +7140,8 @@ static int lock_extent_direct(struct inode *inode, u64 lockstart, u64 lockend,
} }
/* The callers of this must take lock_extent() */ /* The callers of this must take lock_extent() */
static struct extent_map *create_io_em(struct inode *inode, u64 start, u64 len, static struct extent_map *create_io_em(struct btrfs_inode *inode, u64 start,
u64 orig_start, u64 block_start, u64 len, u64 orig_start, u64 block_start,
u64 block_len, u64 orig_block_len, u64 block_len, u64 orig_block_len,
u64 ram_bytes, int compress_type, u64 ram_bytes, int compress_type,
int type) int type)
...@@ -7155,7 +7155,7 @@ static struct extent_map *create_io_em(struct inode *inode, u64 start, u64 len, ...@@ -7155,7 +7155,7 @@ static struct extent_map *create_io_em(struct inode *inode, u64 start, u64 len,
type == BTRFS_ORDERED_NOCOW || type == BTRFS_ORDERED_NOCOW ||
type == BTRFS_ORDERED_REGULAR); type == BTRFS_ORDERED_REGULAR);
em_tree = &BTRFS_I(inode)->extent_tree; em_tree = &inode->extent_tree;
em = alloc_extent_map(); em = alloc_extent_map();
if (!em) if (!em)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -7177,8 +7177,8 @@ static struct extent_map *create_io_em(struct inode *inode, u64 start, u64 len, ...@@ -7177,8 +7177,8 @@ static struct extent_map *create_io_em(struct inode *inode, u64 start, u64 len,
} }
do { do {
btrfs_drop_extent_cache(BTRFS_I(inode), em->start, btrfs_drop_extent_cache(inode, em->start,
em->start + em->len - 1, 0); em->start + em->len - 1, 0);
write_lock(&em_tree->lock); write_lock(&em_tree->lock);
ret = add_extent_mapping(em_tree, em, 1); ret = add_extent_mapping(em_tree, em, 1);
write_unlock(&em_tree->lock); write_unlock(&em_tree->lock);
......
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