summaryrefslogtreecommitdiff
path: root/block_int.h
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2012-01-18 14:40:42 +0000
committerKevin Wolf <kwolf@redhat.com>2012-01-26 11:45:26 +0100
commit470c05047a09cda3de16bb3f98a130d9537357a4 (patch)
treec101557e6ff36ca1fe1465884062433358f85714 /block_int.h
parent2d3735d3bf61d5c8e154a197a11535cc65044334 (diff)
downloadqemu-470c05047a09cda3de16bb3f98a130d9537357a4.tar.gz
qemu-470c05047a09cda3de16bb3f98a130d9537357a4.tar.bz2
qemu-470c05047a09cda3de16bb3f98a130d9537357a4.zip
block: make copy-on-read a per-request flag
Previously copy-on-read could only be enabled for all requests to a block device. This means requests coming from the guest as well as QEMU's internal requests would perform copy-on-read when enabled. For image streaming we want to support finer-grained behavior than just populating the image file from its backing image. Image streaming supports partial streaming where a common backing image is preserved. In this case guest requests should not perform copy-on-read because they would indiscriminately copy data which should be left in a backing image from the backing chain. Introduce a per-request flag for copy-on-read so that a block device can process both regular and copy-on-read requests. Overlapping reads and writes still need to be serialized for correctness when copy-on-read is happening, so add an in-flight reference count to track this. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block_int.h')
-rw-r--r--block_int.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/block_int.h b/block_int.h
index 311bd2a6fa..07d67ed282 100644
--- a/block_int.h
+++ b/block_int.h
@@ -218,6 +218,9 @@ struct BlockDriverState {
BlockDriverState *backing_hd;
BlockDriverState *file;
+ /* number of in-flight copy-on-read requests */
+ unsigned int copy_on_read_in_flight;
+
/* async read/write emulation */
void *sync_aiocb;