On 15/11/2017 9:49 PM, Max Reitz wrote:
On 2017-11-14 11:16, Anton Nefedov wrote:
Signed-off-by: Anton Nefedov <anton.nefe...@virtuozzo.com>
---
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 <mre...@redhat.com>
Ok, and it will fail more loudly. Will remove.
bdrv_inc_in_flight(bs);
/* Don't do copy-on-read if we read data before write operation */