diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-09-28 13:35:26 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-09-28 13:35:26 +0100 |
commit | 099bea113ffba7380b45f174eb54d45d4b801ef2 (patch) | |
tree | d7215c1261f3a765b805ab1115fa0a2e885e0859 /block | |
parent | aa8e26de9617756febcbf794dda965df307fdaaa (diff) | |
parent | 51b3c6b73acae1e3fd3c7d441fc86dd17356695f (diff) |
Merge remote-tracking branch 'remotes/famz/tags/staging-pull-request' into staging
Block and testing patches
- Paolo's AIO fixes.
- VMDK streamOptimized corner case fix
- VM testing improvment on -cpu
# gpg: Signature made Wed 26 Sep 2018 03:54:08 BST
# gpg: using RSA key CA35624C6A9171C6
# gpg: Good signature from "Fam Zheng <famz@redhat.com>"
# Primary key fingerprint: 5003 7CB7 9706 0F76 F021 AD56 CA35 624C 6A91 71C6
* remotes/famz/tags/staging-pull-request:
vmdk: align end of file to a sector boundary
tests/vm: Use -cpu max rather than -cpu host
aio-posix: do skip system call if ctx->notifier polling succeeds
aio-posix: compute timeout before polling
aio-posix: fix concurrent access to poll_disable_cnt
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block')
-rw-r--r-- | block/vmdk.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/block/vmdk.c b/block/vmdk.c index a9d0084e36..2c9e86d98f 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1698,6 +1698,27 @@ static int coroutine_fn vmdk_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov) { + if (bytes == 0) { + /* The caller will write bytes 0 to signal EOF. + * When receive it, we align EOF to a sector boundary. */ + BDRVVmdkState *s = bs->opaque; + int i, ret; + int64_t length; + + for (i = 0; i < s->num_extents; i++) { + length = bdrv_getlength(s->extents[i].file->bs); + if (length < 0) { + return length; + } + length = QEMU_ALIGN_UP(length, BDRV_SECTOR_SIZE); + ret = bdrv_truncate(s->extents[i].file, length, + PREALLOC_MODE_OFF, NULL); + if (ret < 0) { + return ret; + } + } + return 0; + } return vmdk_co_pwritev(bs, offset, bytes, qiov, 0); } |