diff options
author | Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com> | 2018-01-18 14:51:58 +0300 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2018-01-26 09:58:46 -0600 |
commit | 9776f0db6a19a0510e89b7aae38190b4811c95ba (patch) | |
tree | d8985aba7aa14f1c066f8e75b1d479cf833edacd /block/nbd.c | |
parent | 08fb10a7292637eb5836b8ac07b7ef8267db03be (diff) | |
download | qemu-9776f0db6a19a0510e89b7aae38190b4811c95ba.zip qemu-9776f0db6a19a0510e89b7aae38190b4811c95ba.tar.gz qemu-9776f0db6a19a0510e89b7aae38190b4811c95ba.tar.bz2 |
nbd: implement bdrv_get_info callback
Since mirror job supports efficient zero out target mechanism (see
in mirror_dirty_init()), implement bdrv_get_info to make it work
over NBD. Such improvement will allow using the largest chunk possible
and will decrease the number of NBD_CMD_WRITE_ZEROES requests on the wire.
Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
Message-Id: <20180118115158.17219-1-edgar.kaziakhmedov@virtuozzo.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block/nbd.c')
-rw-r--r-- | block/nbd.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/block/nbd.c b/block/nbd.c index 8b8ba56..94220f6 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -566,6 +566,14 @@ static void nbd_refresh_filename(BlockDriverState *bs, QDict *options) bs->full_open_options = opts; } +static int nbd_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) +{ + if (bs->supported_zero_flags & BDRV_REQ_MAY_UNMAP) { + bdi->can_write_zeroes_with_unmap = true; + } + return 0; +} + static BlockDriver bdrv_nbd = { .format_name = "nbd", .protocol_name = "nbd", @@ -583,6 +591,7 @@ static BlockDriver bdrv_nbd = { .bdrv_detach_aio_context = nbd_detach_aio_context, .bdrv_attach_aio_context = nbd_attach_aio_context, .bdrv_refresh_filename = nbd_refresh_filename, + .bdrv_get_info = nbd_get_info, }; static BlockDriver bdrv_nbd_tcp = { @@ -602,6 +611,7 @@ static BlockDriver bdrv_nbd_tcp = { .bdrv_detach_aio_context = nbd_detach_aio_context, .bdrv_attach_aio_context = nbd_attach_aio_context, .bdrv_refresh_filename = nbd_refresh_filename, + .bdrv_get_info = nbd_get_info, }; static BlockDriver bdrv_nbd_unix = { @@ -621,6 +631,7 @@ static BlockDriver bdrv_nbd_unix = { .bdrv_detach_aio_context = nbd_detach_aio_context, .bdrv_attach_aio_context = nbd_attach_aio_context, .bdrv_refresh_filename = nbd_refresh_filename, + .bdrv_get_info = nbd_get_info, }; static void bdrv_nbd_init(void) |