aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2015-03-19 13:33:31 +0100
committerKevin Wolf <kwolf@redhat.com>2015-04-28 15:36:08 +0200
commit0df89e8e6f62aea32a7302e73a86b7bfe5821018 (patch)
treec3b1ec0f9d74ccad5b0f51e4f07ce59c49102d1d /block
parenta0710f7995f914e3044e5899bd8ff6c43c62f916 (diff)
block-backend: Expose bdrv_write_zeroes()
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/block-backend.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index 48b6e4c05c..93e46f376a 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -515,6 +515,17 @@ int blk_write(BlockBackend *blk, int64_t sector_num, const uint8_t *buf,
return bdrv_write(blk->bs, sector_num, buf, nb_sectors);
}
+int blk_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;
+ }
+
+ return bdrv_write_zeroes(blk->bs, sector_num, nb_sectors, flags);
+}
+
static void error_callback_bh(void *opaque)
{
struct BlockBackendAIOCB *acb = opaque;