Skip to content

Commit

Permalink
vmdk: fix comment for vmdk_co_write_zeroes
Browse files Browse the repository at this point in the history
The comment was truncated. Add the missing parts, especially explain why
we need zero_dry_run.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
Fam Zheng authored and Michael Tokarev committed Aug 2, 2013
1 parent 437de2a commit 8e50724
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions block/vmdk.c
Expand Up @@ -1200,8 +1200,10 @@ static coroutine_fn int vmdk_co_read(BlockDriverState *bs, int64_t sector_num,
/**
* vmdk_write:
* @zeroed: buf is ignored (data is zero), use zeroed_grain GTE feature
* if possible, otherwise return -ENOTSUP.
* @zero_dry_run: used for zeroed == true only, don't update L2 table, just
* if possible, otherwise return -ENOTSUP.
* @zero_dry_run: used for zeroed == true only, don't update L2 table, just try
* with each cluster. By dry run we can find if the zero write
* is possible without modifying image data.
*
* Returns: error code with 0 for success.
*/
Expand Down Expand Up @@ -1328,6 +1330,8 @@ static int coroutine_fn vmdk_co_write_zeroes(BlockDriverState *bs,
int ret;
BDRVVmdkState *s = bs->opaque;
qemu_co_mutex_lock(&s->lock);
/* write zeroes could fail if sectors not aligned to cluster, test it with
* dry_run == true before really updating image */
ret = vmdk_write(bs, sector_num, NULL, nb_sectors, true, true);
if (!ret) {
ret = vmdk_write(bs, sector_num, NULL, nb_sectors, true, false);
Expand Down

0 comments on commit 8e50724

Please sign in to comment.