Skip to content

Commit

Permalink
block: Use blk_co_pwritev() in blk_co_write_zeroes()
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
kevmw committed Mar 17, 2016
1 parent 57d6a42 commit 8896e08
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions block/block-backend.c
Expand Up @@ -1462,12 +1462,13 @@ void *blk_aio_get(const AIOCBInfo *aiocb_info, BlockBackend *blk,
int coroutine_fn blk_co_write_zeroes(BlockBackend *blk, int64_t sector_num,
int nb_sectors, BdrvRequestFlags flags)
{
int ret = blk_check_request(blk, sector_num, nb_sectors);
if (ret < 0) {
return ret;
if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) {
return -EINVAL;
}

return bdrv_co_write_zeroes(blk_bs(blk), sector_num, nb_sectors, flags);
return blk_co_pwritev(blk, sector_num << BDRV_SECTOR_BITS,
nb_sectors << BDRV_SECTOR_BITS, NULL,
BDRV_REQ_ZERO_WRITE);
}

int blk_write_compressed(BlockBackend *blk, int64_t sector_num,
Expand Down

0 comments on commit 8896e08

Please sign in to comment.