diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-03-08 13:47:53 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-03-17 16:30:00 +0100 |
commit | 8896e08814a99ad9e3f25ad1fd0b51721c3baa77 (patch) | |
tree | aca7be0001ae570f72b83a7a66cb00e0ed52ce51 | |
parent | 57d6a42883b528e0078bb095398144740e1a4014 (diff) |
block: Use blk_co_pwritev() in blk_co_write_zeroes()
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r-- | block/block-backend.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/block/block-backend.c b/block/block-backend.c index 972a6177c9..dca21d1eeb 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -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, |