[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/14] block: minimize bs->reqs_lock section in tracked_request_en
From: |
Kevin Wolf |
Subject: |
[PULL 03/14] block: minimize bs->reqs_lock section in tracked_request_end() |
Date: |
Mon, 4 Sep 2023 16:36:32 +0200 |
From: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20230808155852.2745350-2-stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/io.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/block/io.c b/block/io.c
index 76e7df18d8..4f32d6aa6e 100644
--- a/block/io.c
+++ b/block/io.c
@@ -593,8 +593,14 @@ static void coroutine_fn
tracked_request_end(BdrvTrackedRequest *req)
qemu_co_mutex_lock(&req->bs->reqs_lock);
QLIST_REMOVE(req, list);
- qemu_co_queue_restart_all(&req->wait_queue);
qemu_co_mutex_unlock(&req->bs->reqs_lock);
+
+ /*
+ * At this point qemu_co_queue_wait(&req->wait_queue, ...) won't be called
+ * anymore because the request has been removed from the list, so it's safe
+ * to restart the queue outside reqs_lock to minimize the critical section.
+ */
+ qemu_co_queue_restart_all(&req->wait_queue);
}
/**
--
2.41.0
- [PULL 00/14] Block layer patches, Kevin Wolf, 2023/09/04
- [PULL 02/14] iotests: adapt test output for new qemu_cleanup() behavior, Kevin Wolf, 2023/09/04
- [PULL 01/14] block/vpc: Avoid dynamic stack allocation, Kevin Wolf, 2023/09/04
- [PULL 04/14] block: change reqs_lock to QemuMutex, Kevin Wolf, 2023/09/04
- [PULL 05/14] qemu-img: omit errno value in error message, Kevin Wolf, 2023/09/04
- [PULL 08/14] qemu-img: Update documentation for compressed images, Kevin Wolf, 2023/09/04
- [PULL 06/14] block/iscsi: Document why we use raw malloc(), Kevin Wolf, 2023/09/04
- [PULL 03/14] block: minimize bs->reqs_lock section in tracked_request_end(),
Kevin Wolf <=
- [PULL 07/14] block: Be more verbose in create fallback, Kevin Wolf, 2023/09/04
- [PULL 11/14] block-backend: process I/O in the current AioContext, Kevin Wolf, 2023/09/04
- [PULL 10/14] block: remove AIOCBInfo->get_aio_context(), Kevin Wolf, 2023/09/04
- [PULL 12/14] block-backend: process zoned requests in the current AioContext, Kevin Wolf, 2023/09/04
- [PULL 14/14] block: Remove unnecessary variable in bdrv_block_device_info, Kevin Wolf, 2023/09/04
- [PULL 09/14] vmdk: Clean up bdrv_open_child() return value check, Kevin Wolf, 2023/09/04
- [PULL 13/14] block: Remove bdrv_query_block_node_info, Kevin Wolf, 2023/09/04
- Re: [PULL 00/14] Block layer patches, Stefan Hajnoczi, 2023/09/06