Skip to content
Snippets Groups Projects
Commit bd54669a authored by Vladimir Sementsov-Ogievskiy's avatar Vladimir Sementsov-Ogievskiy Committed by Eric Blake
Browse files

block: add new BlockDriver handler: bdrv_cancel_in_flight


It will be used to stop retrying NBD requests on mirror cancel.

Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Message-Id: <20210205163720.887197-2-vsementsov@virtuozzo.com>
Signed-off-by: default avatarEric Blake <eblake@redhat.com>
parent c90e3512
No related branches found
No related tags found
No related merge requests found
......@@ -3460,3 +3460,14 @@ out:
return ret;
}
void bdrv_cancel_in_flight(BlockDriverState *bs)
{
if (!bs || !bs->drv) {
return;
}
if (bs->drv->bdrv_cancel_in_flight) {
bs->drv->bdrv_cancel_in_flight(bs);
}
}
......@@ -849,4 +849,7 @@ int coroutine_fn bdrv_co_copy_range(BdrvChild *src, int64_t src_offset,
BdrvChild *dst, int64_t dst_offset,
int64_t bytes, BdrvRequestFlags read_flags,
BdrvRequestFlags write_flags);
void bdrv_cancel_in_flight(BlockDriverState *bs);
#endif
......@@ -352,6 +352,15 @@ struct BlockDriver {
bool want_zero, int64_t offset, int64_t bytes, int64_t *pnum,
int64_t *map, BlockDriverState **file);
/*
* This informs the driver that we are no longer interested in the result
* of in-flight requests, so don't waste the time if possible.
*
* One example usage is to avoid waiting for an nbd target node reconnect
* timeout during job-cancel.
*/
void (*bdrv_cancel_in_flight)(BlockDriverState *bs);
/*
* Invalidate any cached meta-data.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment