Skip to content

Commit

Permalink
block drivers: add discard/write_zeroes properties to bdrv_get_info i…
Browse files Browse the repository at this point in the history
…mplementation

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
bonzini authored and stefanhaRH committed Dec 3, 2013
1 parent 97b00e2 commit 95de6d7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions block/qcow2.c
Expand Up @@ -1893,6 +1893,8 @@ static coroutine_fn int qcow2_co_flush_to_os(BlockDriverState *bs)
static int qcow2_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
{
BDRVQcowState *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;
Expand Down
2 changes: 2 additions & 0 deletions block/qed.c
Expand Up @@ -1475,6 +1475,8 @@ static int bdrv_qed_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
memset(bdi, 0, sizeof(*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;
}

Expand Down
1 change: 1 addition & 0 deletions block/vdi.c
Expand Up @@ -331,6 +331,7 @@ static int vdi_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
logout("\n");
bdi->cluster_size = s->block_size;
bdi->vm_state_offset = 0;
bdi->unallocated_blocks_are_zero = true;
return 0;
}

Expand Down
3 changes: 3 additions & 0 deletions block/vhdx.c
Expand Up @@ -1049,6 +1049,9 @@ static int vhdx_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)

bdi->cluster_size = s->block_size;

bdi->unallocated_blocks_are_zero =
(s->params.data_bits & VHDX_PARAMS_HAS_PARENT) == 0;

return 0;
}

Expand Down
1 change: 1 addition & 0 deletions block/vpc.c
Expand Up @@ -464,6 +464,7 @@ static int vpc_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
bdi->cluster_size = s->block_size;
}

bdi->unallocated_blocks_are_zero = true;
return 0;
}

Expand Down

0 comments on commit 95de6d7

Please sign in to comment.