aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2019-11-01 16:25:09 +0100
committerMax Reitz <mreitz@redhat.com>2019-11-04 09:32:51 +0100
commitc28107e9e55b11cd35cf3dc2505e3e69d10dcf13 (patch)
tree65d090d70ed9fb9dcc34cce611271dcd4830c30f /block
parent304d9d7f034ff7f5e1e66a65b7f720f63a72c57e (diff)
downloadqemu-c28107e9e55b11cd35cf3dc2505e3e69d10dcf13.zip
qemu-c28107e9e55b11cd35cf3dc2505e3e69d10dcf13.tar.gz
qemu-c28107e9e55b11cd35cf3dc2505e3e69d10dcf13.tar.bz2
block: Add bdrv_co_get_self_request()
Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20191101152510.11719-3-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/io.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/block/io.c b/block/io.c
index 039c0d4..f75777f 100644
--- a/block/io.c
+++ b/block/io.c
@@ -743,6 +743,24 @@ static bool is_request_serialising_and_aligned(BdrvTrackedRequest *req)
}
/**
+ * Return the tracked request on @bs for the current coroutine, or
+ * NULL if there is none.
+ */
+BdrvTrackedRequest *coroutine_fn bdrv_co_get_self_request(BlockDriverState *bs)
+{
+ BdrvTrackedRequest *req;
+ Coroutine *self = qemu_coroutine_self();
+
+ QLIST_FOREACH(req, &bs->tracked_requests, list) {
+ if (req->co == self) {
+ return req;
+ }
+ }
+
+ return NULL;
+}
+
+/**
* Round a region to cluster boundaries
*/
void bdrv_round_to_clusters(BlockDriverState *bs,