mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
block: Use tracked request for truncate
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: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
3d9f2d2af6
commit
1bc5f09f2e
2 changed files with 26 additions and 0 deletions
|
@ -63,6 +63,7 @@ enum BdrvTrackedRequestType {
|
|||
BDRV_TRACKED_READ,
|
||||
BDRV_TRACKED_WRITE,
|
||||
BDRV_TRACKED_DISCARD,
|
||||
BDRV_TRACKED_TRUNCATE,
|
||||
};
|
||||
|
||||
typedef struct BdrvTrackedRequest {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue