From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Anton Nefedov <anton.nefedov@virtuozzo.com>,
qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PATCH for-4.2 3/4] block: Add bdrv_co_get_self_request()
Date: Fri, 1 Nov 2019 11:00:18 +0100 [thread overview]
Message-ID: <20191101100019.9512-4-mreitz@redhat.com> (raw)
In-Reply-To: <20191101100019.9512-1-mreitz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
include/block/block_int.h | 1 +
block/io.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 32fa323b63..4fc531f9b2 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -1001,6 +1001,7 @@ void bdrv_unapply_subtree_drain(BdrvChild *child, BlockDriverState *old_parent);
bool coroutine_fn bdrv_wait_serialising_requests(BdrvTrackedRequest *self);
void bdrv_mark_request_serialising(BdrvTrackedRequest *req, uint64_t align);
+BdrvTrackedRequest *bdrv_co_get_self_request(BlockDriverState *bs);
int get_tmp_filename(char *filename, int size);
BlockDriver *bdrv_probe_all(const uint8_t *buf, int buf_size,
diff --git a/block/io.c b/block/io.c
index 039c0d49c9..e9205994a8 100644
--- a/block/io.c
+++ b/block/io.c
@@ -742,6 +742,24 @@ static bool is_request_serialising_and_aligned(BdrvTrackedRequest *req)
(req->bytes == req->overlap_bytes);
}
+/**
+ * Return the tracked request on @bs for the current coroutine, or
+ * NULL if there is none.
+ */
+BdrvTrackedRequest *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
*/
--
2.21.0
next prev parent reply other threads:[~2019-11-01 10:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-01 10:00 [PATCH for-4.2 0/4] qcow2: Fix data corruption on XFS Max Reitz
2019-11-01 10:00 ` [PATCH for-4.2 1/4] Revert "qcow2: skip writing zero buffers to empty COW areas" Max Reitz
2019-11-01 10:22 ` Vladimir Sementsov-Ogievskiy
2019-11-01 12:40 ` Eric Blake
2019-11-01 14:01 ` Max Reitz
2019-11-01 15:42 ` Kevin Wolf
2019-11-01 16:02 ` Max Reitz
2019-11-01 10:00 ` [PATCH for-4.2 2/4] block: Make wait/mark serialising requests public Max Reitz
2019-11-01 10:00 ` Max Reitz [this message]
2019-11-01 10:00 ` [PATCH for-4.2 4/4] block/file-posix: Let post-EOF fallocate serialize Max Reitz
2019-11-01 10:20 ` [PATCH for-4.2 0/4] qcow2: Fix data corruption on XFS Max Reitz
2019-11-01 10:28 ` Vladimir Sementsov-Ogievskiy
2019-11-01 11:12 ` Max Reitz
2019-11-01 11:16 ` Vladimir Sementsov-Ogievskiy
2019-11-01 11:20 ` Max Reitz
2019-11-01 12:34 ` Max Reitz
2019-11-01 13:09 ` Vladimir Sementsov-Ogievskiy
2019-11-01 13:36 ` Denis Lunev
2019-11-01 13:40 ` Max Reitz
2019-11-01 13:30 ` Max Reitz
2019-11-01 15:06 ` Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191101100019.9512-4-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=anton.nefedov@virtuozzo.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).