[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 3/3] block: Assert we're running in the right thread
From: |
Kevin Wolf |
Subject: |
[RFC PATCH 3/3] block: Assert we're running in the right thread |
Date: |
Tue, 12 May 2020 16:43:18 +0200 |
tracked_request_begin() is called for most I/O operations, so it's a
good place to assert that we're indeed running in the home thread of the
node's AioContext.
Signed-off-by: Kevin Wolf <address@hidden>
---
block/io.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/block/io.c b/block/io.c
index 7808e8bdc0..924bf5ba46 100644
--- a/block/io.c
+++ b/block/io.c
@@ -695,14 +695,17 @@ static void tracked_request_begin(BdrvTrackedRequest *req,
uint64_t bytes,
enum BdrvTrackedRequestType type)
{
+ Coroutine *self = qemu_coroutine_self();
+
assert(bytes <= INT64_MAX && offset <= INT64_MAX - bytes);
+ assert(bs->aio_context == qemu_coroutine_get_aio_context(self));
*req = (BdrvTrackedRequest){
.bs = bs,
.offset = offset,
.bytes = bytes,
.type = type,
- .co = qemu_coroutine_self(),
+ .co = self,
.serialising = false,
.overlap_offset = offset,
.overlap_bytes = bytes,
--
2.25.3
- Re: [RFC PATCH 1/3] block: Factor out bdrv_run_co(), (continued)
[RFC PATCH 2/3] block: Allow bdrv_run_co() from different AioContext, Kevin Wolf, 2020/05/12
[RFC PATCH 3/3] block: Assert we're running in the right thread,
Kevin Wolf <=
Re: [RFC PATCH 0/3] block: Synchronous bdrv_*() from coroutine in different AioContext, Thomas Lamprecht, 2020/05/14
- Re: [RFC PATCH 0/3] block: Synchronous bdrv_*() from coroutine in different AioContext, Kevin Wolf, 2020/05/14
- Re: [RFC PATCH 0/3] block: Synchronous bdrv_*() from coroutine in different AioContext, Vladimir Sementsov-Ogievskiy, 2020/05/19
- Re: [RFC PATCH 0/3] block: Synchronous bdrv_*() from coroutine in different AioContext, Denis Plotnikov, 2020/05/19
- Re: [RFC PATCH 0/3] block: Synchronous bdrv_*() from coroutine in different AioContext, Kevin Wolf, 2020/05/19
- Re: [RFC PATCH 0/3] block: Synchronous bdrv_*() from coroutine in different AioContext, Denis Plotnikov, 2020/05/19
- Re: [RFC PATCH 0/3] block: Synchronous bdrv_*() from coroutine in different AioContext, Kevin Wolf, 2020/05/19