On 2017-11-14 11:16, Anton Nefedov wrote:
Signed-off-by: Anton Nefedov <address@hidden>
---
block/io.c | 30 ++++++++++++++++++++++++------
block/trace-events | 2 +-
2 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/block/io.c b/block/io.c
index 3d5ef2c..93c6b24 100644
--- a/block/io.c
+++ b/block/io.c
[...]
@@ -1209,6 +1220,13 @@ int coroutine_fn bdrv_co_preadv(BdrvChild *child,
return ret;
}
+ /* write compressed only makes sense with copy on read */
+ if ((flags & BDRV_REQ_WRITE_COMPRESSED) &&
+ !(flags & BDRV_REQ_COPY_ON_READ))
+ {
+ return -EINVAL;
+ }
+
I think the assertion in bdrv_aligned_preadv() should be enough, but
either way:
Reviewed-by: Max Reitz <address@hidden>