qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

aio: rename aio_context_in_iothread() to in_aio_context_home_thread()

The name aio_context_in_iothread() is misleading because it also returns
true when called on the main AioContext from the main loop thread, which
is not an IOThread.

This patch renames it to in_aio_context_home_thread() and expands the
doc comment to make the semantics clearer.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>

authored by

Stefan Hajnoczi and committed by
Kevin Wolf
d2b63ba8 be820971

+6 -3
+5 -2
include/block/aio.h
··· 534 534 AioContext *qemu_get_current_aio_context(void); 535 535 536 536 /** 537 + * in_aio_context_home_thread: 537 538 * @ctx: the aio context 538 539 * 539 - * Return whether we are running in the I/O thread that manages @ctx. 540 + * Return whether we are running in the thread that normally runs @ctx. Note 541 + * that acquiring/releasing ctx does not affect the outcome, each AioContext 542 + * still only has one home thread that is responsible for running it. 540 543 */ 541 - static inline bool aio_context_in_iothread(AioContext *ctx) 544 + static inline bool in_aio_context_home_thread(AioContext *ctx) 542 545 { 543 546 return ctx == qemu_get_current_aio_context(); 544 547 }
+1 -1
include/block/block.h
··· 372 372 bool busy_ = true; \ 373 373 BlockDriverState *bs_ = (bs); \ 374 374 AioContext *ctx_ = bdrv_get_aio_context(bs_); \ 375 - if (aio_context_in_iothread(ctx_)) { \ 375 + if (in_aio_context_home_thread(ctx_)) { \ 376 376 while ((cond) || busy_) { \ 377 377 busy_ = aio_poll(ctx_, (cond)); \ 378 378 waited_ |= !!(cond) | busy_; \