• K
    block: Use tracked request for truncate · 1bc5f09f
    Kevin Wolf 提交于
    When growing an image, block drivers (especially protocol drivers) may
    initialise the newly added area. I/O requests to the same area need to
    wait for this initialisation to be completed so that data writes don't
    get overwritten and reads don't read uninitialised data.
    
    To avoid overhead in the fast I/O path by adding new locking in the
    protocol drivers and to restrict the impact to requests that actually
    touch the new area, reuse the existing tracked request infrastructure in
    block/io.c and mark all discard requests as serialising.
    
    With this change, it is safe for protocol drivers to make
    .bdrv_co_truncate actually asynchronous.
    Signed-off-by: NKevin Wolf <kwolf@redhat.com>
    Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
    1bc5f09f
io.c 93.9 KB