@@ -776,13 +776,26 @@ static noinline void submit_compressed_extents(struct async_chunk *async_chunk)
* and IO for us. Otherwise, we need to submit
* all those pages down to the drive.
*/
- if (!page_started && !ret)
+ if (!page_started && !ret) {
+ struct extent_map *em;
+ u64 logical;
+
+ em = btrfs_get_extent(BTRFS_I(inode), NULL, 0,
+ async_extent->start,
+ async_extent->ram_size,
+ 0);
+ logical = em->block_start;
+ free_extent_map(em);
+
extent_write_locked_range(inode,
async_extent->start,
async_extent->start +
async_extent->ram_size - 1,
WB_SYNC_ALL);
- else if (ret)
+
+ btrfs_hmzoned_data_io_unlock_logical(fs_info,
+ logical);
+ } else if (ret)
unlock_page(async_chunk->locked_page);
kfree(async_extent);
cond_resched();
@@ -883,6 +896,7 @@ static noinline void submit_compressed_extents(struct async_chunk *async_chunk)
free_async_extent_pages(async_extent);
}
alloc_hint = ins.objectid + ins.offset;
+ btrfs_hmzoned_data_io_unlock_logical(fs_info, ins.objectid);
kfree(async_extent);
cond_resched();
}
@@ -890,6 +904,7 @@ static noinline void submit_compressed_extents(struct async_chunk *async_chunk)
out_free_reserve:
btrfs_dec_block_group_reservations(fs_info, ins.objectid);
btrfs_free_reserved_extent(fs_info, ins.objectid, ins.offset, 1);
+ btrfs_hmzoned_data_io_unlock_logical(fs_info, ins.objectid);
out_free:
extent_clear_unlock_delalloc(inode, async_extent->start,
async_extent->start +
As same as with non-compressed IO submission, we must unlock a block group for the next allocation. Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> --- fs/btrfs/inode.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)