* [PATCH] block: change type of bytes from int to int64_t for *bdrv_aio_pdiscard @ 2025-04-20 16:19 Sunny Zhu 2025-04-21 15:03 ` Eric Blake 0 siblings, 1 reply; 6+ messages in thread From: Sunny Zhu @ 2025-04-20 16:19 UTC (permalink / raw) To: qemu-devel; +Cc: qemu-block, kwolf, hreitz, Sunny Zhu Keep it consistent with *bdrv_co_pdiscard. Currently, there is no BlockDriver implemented the bdrv_aio_pdiscard() function, so we don’t need to make any adaptations either. Signed-off-by: Sunny Zhu <sunnyzhyy@qq.com> --- include/block/block_int-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h index ebb4e56a50..4bf422d733 100644 --- a/include/block/block_int-common.h +++ b/include/block/block_int-common.h @@ -507,7 +507,7 @@ struct BlockDriver { BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque); BlockAIOCB * GRAPH_RDLOCK_PTR (*bdrv_aio_pdiscard)( - BlockDriverState *bs, int64_t offset, int bytes, + BlockDriverState *bs, int64_t offset, int64_t bytes, BlockCompletionFunc *cb, void *opaque); int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_readv)(BlockDriverState *bs, -- 2.43.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] block: change type of bytes from int to int64_t for *bdrv_aio_pdiscard 2025-04-20 16:19 [PATCH] block: change type of bytes from int to int64_t for *bdrv_aio_pdiscard Sunny Zhu @ 2025-04-21 15:03 ` Eric Blake 2025-04-21 17:33 ` Sunny Zhu 2025-04-22 7:11 ` Philippe Mathieu-Daudé 0 siblings, 2 replies; 6+ messages in thread From: Eric Blake @ 2025-04-21 15:03 UTC (permalink / raw) To: Sunny Zhu; +Cc: qemu-devel, qemu-block, kwolf, hreitz On Mon, Apr 21, 2025 at 12:19:14AM +0800, Sunny Zhu wrote: > Keep it consistent with *bdrv_co_pdiscard. > > Currently, there is no BlockDriver implemented the bdrv_aio_pdiscard() function, > so we don’t need to make any adaptations either. If there are no drivers implementing the callback, then why have it? I think we have been moving towards more coroutine-based callbacks and away from the aio callbacks; if so, should we instead be deleting this callback as stale code? > > Signed-off-by: Sunny Zhu <sunnyzhyy@qq.com> > --- > include/block/block_int-common.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h > index ebb4e56a50..4bf422d733 100644 > --- a/include/block/block_int-common.h > +++ b/include/block/block_int-common.h > @@ -507,7 +507,7 @@ struct BlockDriver { > BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque); > > BlockAIOCB * GRAPH_RDLOCK_PTR (*bdrv_aio_pdiscard)( > - BlockDriverState *bs, int64_t offset, int bytes, > + BlockDriverState *bs, int64_t offset, int64_t bytes, > BlockCompletionFunc *cb, void *opaque); > > int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_readv)(BlockDriverState *bs, > -- > 2.43.0 > > -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: change type of bytes from int to int64_t for *bdrv_aio_pdiscard 2025-04-21 15:03 ` Eric Blake @ 2025-04-21 17:33 ` Sunny Zhu 2025-04-22 7:11 ` Philippe Mathieu-Daudé 1 sibling, 0 replies; 6+ messages in thread From: Sunny Zhu @ 2025-04-21 17:33 UTC (permalink / raw) To: eblake; +Cc: hreitz, kwolf, qemu-block, qemu-devel, sunnyzhyy Eric Blake wrote: >On Mon, Apr 21, 2025 at 12:19:14AM +0800, Sunny Zhu wrote: >> Keep it consistent with *bdrv_co_pdiscard. >> >> Currently, there is no BlockDriver implemented the bdrv_aio_pdiscard() function, >> so we don’t need to make any adaptations either. > >If there are no drivers implementing the callback, then why have it? >I think we have been moving towards more coroutine-based callbacks and >away from the aio callbacks; if so, should we instead be deleting this >callback as stale code? Yes, that makes sense. I will make the changes in the next version. Thanks. > >> >> Signed-off-by: Sunny Zhu <sunnyzhyy@qq.com> >> --- >> include/block/block_int-common.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h >> index ebb4e56a50..4bf422d733 100644 >> --- a/include/block/block_int-common.h >> +++ b/include/block/block_int-common.h >> @@ -507,7 +507,7 @@ struct BlockDriver { >> BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque); >> >> BlockAIOCB * GRAPH_RDLOCK_PTR (*bdrv_aio_pdiscard)( >> - BlockDriverState *bs, int64_t offset, int bytes, >> + BlockDriverState *bs, int64_t offset, int64_t bytes, >> BlockCompletionFunc *cb, void *opaque); >> >> int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_readv)(BlockDriverState *bs, >> -- >> 2.43.0 >> >> > >-- >Eric Blake, Principal Software Engineer >Red Hat, Inc. >Virtualization: qemu.org | libguestfs.org ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: change type of bytes from int to int64_t for *bdrv_aio_pdiscard 2025-04-21 15:03 ` Eric Blake 2025-04-21 17:33 ` Sunny Zhu @ 2025-04-22 7:11 ` Philippe Mathieu-Daudé 2025-04-24 17:40 ` Eric Blake 1 sibling, 1 reply; 6+ messages in thread From: Philippe Mathieu-Daudé @ 2025-04-22 7:11 UTC (permalink / raw) To: Eric Blake, Sunny Zhu; +Cc: qemu-devel, qemu-block, kwolf, hreitz Hi Eric, On 21/4/25 17:03, Eric Blake wrote: > On Mon, Apr 21, 2025 at 12:19:14AM +0800, Sunny Zhu wrote: >> Keep it consistent with *bdrv_co_pdiscard. >> >> Currently, there is no BlockDriver implemented the bdrv_aio_pdiscard() function, >> so we don’t need to make any adaptations either. > > If there are no drivers implementing the callback, then why have it? > I think we have been moving towards more coroutine-based callbacks and > away from the aio callbacks; if so, should we instead be deleting this > callback as stale code? Could we add a comment in BlockDriver prototypes about prefering co over aio implementations, possibly mentioning them as legacy? > >> >> Signed-off-by: Sunny Zhu <sunnyzhyy@qq.com> >> --- >> include/block/block_int-common.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h >> index ebb4e56a50..4bf422d733 100644 >> --- a/include/block/block_int-common.h >> +++ b/include/block/block_int-common.h >> @@ -507,7 +507,7 @@ struct BlockDriver { >> BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque); >> >> BlockAIOCB * GRAPH_RDLOCK_PTR (*bdrv_aio_pdiscard)( >> - BlockDriverState *bs, int64_t offset, int bytes, >> + BlockDriverState *bs, int64_t offset, int64_t bytes, >> BlockCompletionFunc *cb, void *opaque); >> >> int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_readv)(BlockDriverState *bs, >> -- >> 2.43.0 >> >> > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: change type of bytes from int to int64_t for *bdrv_aio_pdiscard 2025-04-22 7:11 ` Philippe Mathieu-Daudé @ 2025-04-24 17:40 ` Eric Blake 2025-04-25 15:36 ` Kevin Wolf 0 siblings, 1 reply; 6+ messages in thread From: Eric Blake @ 2025-04-24 17:40 UTC (permalink / raw) To: Philippe Mathieu-Daudé Cc: Sunny Zhu, qemu-devel, qemu-block, kwolf, hreitz On Tue, Apr 22, 2025 at 09:11:51AM +0200, Philippe Mathieu-Daudé wrote: > Hi Eric, > > On 21/4/25 17:03, Eric Blake wrote: > > On Mon, Apr 21, 2025 at 12:19:14AM +0800, Sunny Zhu wrote: > > > Keep it consistent with *bdrv_co_pdiscard. > > > > > > Currently, there is no BlockDriver implemented the bdrv_aio_pdiscard() function, > > > so we don’t need to make any adaptations either. > > > > If there are no drivers implementing the callback, then why have it? > > I think we have been moving towards more coroutine-based callbacks and > > away from the aio callbacks; if so, should we instead be deleting this > > callback as stale code? > > Could we add a comment in BlockDriver prototypes about prefering co over > aio implementations, possibly mentioning them as legacy? Thinking about this a bit more (but you'll definitely want Kevin's opinion, not just mine): $ git grep '\.bdrv_aio_' block/file-win32.c: .bdrv_aio_preadv = raw_aio_preadv, block/file-win32.c: .bdrv_aio_pwritev = raw_aio_pwritev, block/file-win32.c: .bdrv_aio_flush = raw_aio_flush, block/file-win32.c: .bdrv_aio_preadv = raw_aio_preadv, block/file-win32.c: .bdrv_aio_pwritev = raw_aio_pwritev, block/file-win32.c: .bdrv_aio_flush = raw_aio_flush, block/iscsi.c: .bdrv_aio_ioctl = iscsi_aio_ioctl, block/iscsi.c: .bdrv_aio_ioctl = iscsi_aio_ioctl, block/null.c: .bdrv_aio_preadv = null_aio_preadv, block/null.c: .bdrv_aio_pwritev = null_aio_pwritev, block/null.c: .bdrv_aio_flush = null_aio_flush, file-win32.c looks to be the major client of remaining aio interfaces. How hard would it be to convert those over to coroutines? iscsi.c uses aio only for ioctl. How hard would it be to convert it in the same way that we converted read/write/flush back in commit 063c3378? null.c provides aio interfaces solely for benchmarking purposes - but if it is the only remaining client of aio interfaces, it would be nice to just rip out support for null-aio: and rely solely on null: It sounds like we are close enough to a generic cleanup of detritus that it would be better to just finish the job than to add a comment about preferring co over aio. -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: change type of bytes from int to int64_t for *bdrv_aio_pdiscard 2025-04-24 17:40 ` Eric Blake @ 2025-04-25 15:36 ` Kevin Wolf 0 siblings, 0 replies; 6+ messages in thread From: Kevin Wolf @ 2025-04-25 15:36 UTC (permalink / raw) To: Eric Blake Cc: Philippe Mathieu-Daudé, Sunny Zhu, qemu-devel, qemu-block, hreitz Am 24.04.2025 um 19:40 hat Eric Blake geschrieben: > On Tue, Apr 22, 2025 at 09:11:51AM +0200, Philippe Mathieu-Daudé wrote: > > Hi Eric, > > > > On 21/4/25 17:03, Eric Blake wrote: > > > On Mon, Apr 21, 2025 at 12:19:14AM +0800, Sunny Zhu wrote: > > > > Keep it consistent with *bdrv_co_pdiscard. > > > > > > > > Currently, there is no BlockDriver implemented the bdrv_aio_pdiscard() function, > > > > so we don’t need to make any adaptations either. > > > > > > If there are no drivers implementing the callback, then why have it? > > > I think we have been moving towards more coroutine-based callbacks and > > > away from the aio callbacks; if so, should we instead be deleting this > > > callback as stale code? > > > > Could we add a comment in BlockDriver prototypes about prefering co over > > aio implementations, possibly mentioning them as legacy? > > Thinking about this a bit more (but you'll definitely want Kevin's > opinion, not just mine): > > $ git grep '\.bdrv_aio_' > block/file-win32.c: .bdrv_aio_preadv = raw_aio_preadv, > block/file-win32.c: .bdrv_aio_pwritev = raw_aio_pwritev, > block/file-win32.c: .bdrv_aio_flush = raw_aio_flush, > block/file-win32.c: .bdrv_aio_preadv = raw_aio_preadv, > block/file-win32.c: .bdrv_aio_pwritev = raw_aio_pwritev, > block/file-win32.c: .bdrv_aio_flush = raw_aio_flush, > block/iscsi.c: .bdrv_aio_ioctl = iscsi_aio_ioctl, > block/iscsi.c: .bdrv_aio_ioctl = iscsi_aio_ioctl, > block/null.c: .bdrv_aio_preadv = null_aio_preadv, > block/null.c: .bdrv_aio_pwritev = null_aio_pwritev, > block/null.c: .bdrv_aio_flush = null_aio_flush, > > file-win32.c looks to be the major client of remaining aio interfaces. > How hard would it be to convert those over to coroutines? Not terribly complicated. In case of doubt, they remain callback based internally and just yield until the callback reenters the coroutine. For file-win32 specifically, paio_submit() can be modified to call thread_pool_submit_co(), which already does this. The win32-aio paths won't necessarily become simpler, but that's okay. > iscsi.c uses aio only for ioctl. How hard would it be to convert it > in the same way that we converted read/write/flush back in commit > 063c3378? iscsi_aio_ioctl() could probably be simplified a bit when the callback is moved into the function itself, especially for the case of iscsi_ioctl_handle_emulated(). > null.c provides aio interfaces solely for benchmarking purposes - but > if it is the only remaining client of aio interfaces, it would be nice > to just rip out support for null-aio: and rely solely on null: null-aio is specifically an AIO based version, I think mainly to test performance of AIO vs. coroutines. If we get rid of the AIO interfaces, then we can probably just remove the whole null-aio driver. (Or rather, make it an alias of null-co for now and deprecate it.) > It sounds like we are close enough to a generic cleanup of detritus > that it would be better to just finish the job than to add a comment > about preferring co over aio. Agreed. Kevin ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-04-25 15:40 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-04-20 16:19 [PATCH] block: change type of bytes from int to int64_t for *bdrv_aio_pdiscard Sunny Zhu 2025-04-21 15:03 ` Eric Blake 2025-04-21 17:33 ` Sunny Zhu 2025-04-22 7:11 ` Philippe Mathieu-Daudé 2025-04-24 17:40 ` Eric Blake 2025-04-25 15:36 ` Kevin Wolf
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).