Skip to content
  • Stefan Hajnoczi's avatar
    block: make copy-on-read a per-request flag · 470c0504
    Stefan Hajnoczi authored
    
    
    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: default avatarStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    470c0504