Message ID | 20201118180433.11931-4-vsementsov@virtuozzo.com |
---|---|
State | New |
Headers | show |
Series | mirror: cancel nbd reconnect | expand |
On 11/18/20 12:04 PM, Vladimir Sementsov-Ogievskiy wrote: > We are going to cancel in-flight requests on mirror nbd target on job > cancel. Still nbd is often used not directly but as raw-format child. > So, add pass-through handler here. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> > --- > block/raw-format.c | 6 ++++++ > 1 file changed, 6 insertions(+) Should all filters do this automatically (or rather, should the block layer do this automatically for all filters)? But I understand that it does NOT make sense for format drivers in general (cancelling a guest request may still require metadata updates), where raw-format is the exception, so doing it in raw-format instead of the block layer makes sense. > BlockDriver bdrv_raw = { > .format_name = "raw", > .instance_size = sizeof(BDRVRawState), > @@ -608,6 +613,7 @@ BlockDriver bdrv_raw = { > .bdrv_has_zero_init = &raw_has_zero_init, > .strong_runtime_opts = raw_strong_runtime_opts, > .mutable_opts = mutable_opts, > + .bdrv_cancel_in_flight = raw_cancel_in_flight, A demonstration of why I don't like aligning the =. But it's merely cosmetic, so doesn't affect: Reviewed-by: Eric Blake <eblake@redhat.com>
21.01.2021 02:15, Eric Blake wrote: > On 11/18/20 12:04 PM, Vladimir Sementsov-Ogievskiy wrote: >> We are going to cancel in-flight requests on mirror nbd target on job >> cancel. Still nbd is often used not directly but as raw-format child. >> So, add pass-through handler here. >> >> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> >> --- >> block/raw-format.c | 6 ++++++ >> 1 file changed, 6 insertions(+) > > Should all filters do this automatically (or rather, should the block > layer do this automatically for all filters)? But I understand that it > does NOT make sense for format drivers in general (cancelling a guest > request may still require metadata updates), where raw-format is the > exception, so doing it in raw-format instead of the block layer makes sense. > Hmm.. probably not for backup_top filter. But of course OK for throttling > >> BlockDriver bdrv_raw = { >> .format_name = "raw", >> .instance_size = sizeof(BDRVRawState), >> @@ -608,6 +613,7 @@ BlockDriver bdrv_raw = { >> .bdrv_has_zero_init = &raw_has_zero_init, >> .strong_runtime_opts = raw_strong_runtime_opts, >> .mutable_opts = mutable_opts, >> + .bdrv_cancel_in_flight = raw_cancel_in_flight, > > A demonstration of why I don't like aligning the =. But it's merely > cosmetic, so doesn't affect: > > Reviewed-by: Eric Blake <eblake@redhat.com> >
diff --git a/block/raw-format.c b/block/raw-format.c index 42ec50802b..7717578ed6 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -575,6 +575,11 @@ static const char *const raw_strong_runtime_opts[] = { NULL }; +static void raw_cancel_in_flight(BlockDriverState *bs) +{ + bdrv_cancel_in_flight(bs->file->bs); +} + BlockDriver bdrv_raw = { .format_name = "raw", .instance_size = sizeof(BDRVRawState), @@ -608,6 +613,7 @@ BlockDriver bdrv_raw = { .bdrv_has_zero_init = &raw_has_zero_init, .strong_runtime_opts = raw_strong_runtime_opts, .mutable_opts = mutable_opts, + .bdrv_cancel_in_flight = raw_cancel_in_flight, }; static void bdrv_raw_init(void)
We are going to cancel in-flight requests on mirror nbd target on job cancel. Still nbd is often used not directly but as raw-format child. So, add pass-through handler here. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> --- block/raw-format.c | 6 ++++++ 1 file changed, 6 insertions(+)