diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/crypto.c | 1 | ||||
-rw-r--r-- | block/file-posix.c | 3 | ||||
-rw-r--r-- | block/iscsi.c | 6 | ||||
-rw-r--r-- | block/nbd.c | 11 | ||||
-rw-r--r-- | block/qcow2.c | 3 | ||||
-rw-r--r-- | block/qed.c | 1 |
6 files changed, 6 insertions, 19 deletions
diff --git a/block/crypto.c b/block/crypto.c index 70e3691..3df6694 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -576,7 +576,6 @@ static int block_crypto_get_info_luks(BlockDriverState *bs, } bdi->unallocated_blocks_are_zero = false; - bdi->can_write_zeroes_with_unmap = false; bdi->cluster_size = subbdi.cluster_size; return 0; diff --git a/block/file-posix.c b/block/file-posix.c index dd8d7cb..ca49c1a 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -549,7 +549,6 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, s->has_discard = true; s->has_write_zeroes = true; - bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP; if ((bs->open_flags & BDRV_O_NOCACHE) != 0) { s->needs_alignment = true; } @@ -599,6 +598,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, } #endif + bs->supported_zero_flags = s->discard_zeroes ? BDRV_REQ_MAY_UNMAP : 0; ret = 0; fail: if (filename && (bdrv_flags & BDRV_O_TEMPORARY)) { @@ -2223,7 +2223,6 @@ static int raw_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) BDRVRawState *s = bs->opaque; bdi->unallocated_blocks_are_zero = s->discard_zeroes; - bdi->can_write_zeroes_with_unmap = s->discard_zeroes; return 0; } diff --git a/block/iscsi.c b/block/iscsi.c index 9f99ae5..421983d 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1877,7 +1877,6 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, if (iscsilun->dpofua) { bs->supported_write_flags = BDRV_REQ_FUA; } - bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP; /* Check the write protect flag of the LUN if we want to write */ if (iscsilun->type == TYPE_DISK && (flags & BDRV_O_RDWR) && @@ -1961,6 +1960,10 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, } } + if (iscsilun->lbprz && iscsilun->lbp.lbpws) { + bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP; + } + out: qemu_opts_del(opts); g_free(initiator_name); @@ -2160,7 +2163,6 @@ static int iscsi_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) { IscsiLun *iscsilun = bs->opaque; bdi->unallocated_blocks_are_zero = iscsilun->lbprz; - bdi->can_write_zeroes_with_unmap = iscsilun->lbprz && iscsilun->lbp.lbpws; bdi->cluster_size = iscsilun->cluster_sectors * BDRV_SECTOR_SIZE; return 0; } diff --git a/block/nbd.c b/block/nbd.c index 411eeb4..ef81a9f 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -566,14 +566,6 @@ 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", @@ -591,7 +583,6 @@ 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 = { @@ -611,7 +602,6 @@ 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 = { @@ -631,7 +621,6 @@ 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) diff --git a/block/qcow2.c b/block/qcow2.c index a64a572..801e29f 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1479,7 +1479,7 @@ static int qcow2_do_open(BlockDriverState *bs, QDict *options, int flags, /* Initialise locks */ qemu_co_mutex_init(&s->lock); - bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP; + bs->supported_zero_flags = header.version >= 3 ? BDRV_REQ_MAY_UNMAP : 0; /* Repair image if dirty */ if (!(flags & (BDRV_O_CHECK | BDRV_O_INACTIVE)) && !bs->read_only && @@ -3771,7 +3771,6 @@ static int qcow2_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) { BDRVQcow2State *s = bs->opaque; bdi->unallocated_blocks_are_zero = true; - bdi->can_write_zeroes_with_unmap = (s->qcow_version >= 3); bdi->cluster_size = s->cluster_size; bdi->vm_state_offset = qcow2_vm_state_offset(s); return 0; diff --git a/block/qed.c b/block/qed.c index 205dbf1..c6ff3ab 100644 --- a/block/qed.c +++ b/block/qed.c @@ -1438,7 +1438,6 @@ static int bdrv_qed_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) bdi->cluster_size = s->header.cluster_size; bdi->is_dirty = s->header.features & QED_F_NEED_CHECK; bdi->unallocated_blocks_are_zero = true; - bdi->can_write_zeroes_with_unmap = true; return 0; } |