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