On 10/7/21 15:15, Stefan Hajnoczi wrote: > On Tue, Oct 05, 2021 at 08:58:03PM +0200, Philippe Mathieu-Daudé wrote: >> Experiment to use glib g_autoptr/autofree features with >> AIO context. >> Since this is a RFC, only few examples are provided. >> >> TODO: Document the macros in docs/devel/multiple-iothreads.txt >> >> Philippe Mathieu-Daudé (4): >> block/aio: Add automatically released aio_context variants >> hw/scsi/scsi-disk: Use automatic AIO context lock >> hw/scsi/scsi-generic: Use automatic AIO context lock >> hw/block/virtio-blk: Use automatic AIO context lock >> >> include/block/aio.h | 24 ++++++++++++++++++++++++ >> hw/block/virtio-blk.c | 26 ++++++++++++-------------- >> hw/scsi/scsi-disk.c | 13 ++++--------- >> hw/scsi/scsi-generic.c | 6 +++--- >> 4 files changed, 43 insertions(+), 26 deletions(-) > > This is nice. Two things: > > 1. Emanuele is working on eliminating aio_context_acquire/release(), so > a big effort to convert existing code to using guards could be wasted > energy and cause conflicts with his patches.
Thanks for the update, I'll wait Emanuele effort to land. > 2. A few callers anticipate that the AioContext of their BDS may change > between acquire/release. Care needs to be taken when converting to > preserve the semantics but most instances should be safe to convert. > > Stefan >