From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-stable@nongnu.org, qemu-devel@nongnu.org,
Anton Nefedov <anton.nefedov@virtuozzo.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
"Denis V . Lunev" <den@openvz.org>, Max Reitz <mreitz@redhat.com>
Subject: [PATCH for-4.2 v2 2/3] block: Add bdrv_co_get_self_request()
Date: Fri, 1 Nov 2019 16:25:09 +0100 [thread overview]
Message-ID: <20191101152510.11719-3-mreitz@redhat.com> (raw)
In-Reply-To: <20191101152510.11719-1-mreitz@redhat.com>
Cc: qemu-stable@nongnu.org
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..dd033d0b37 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 *coroutine_fn 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..f75777f5ea 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 *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
*/
--
2.21.0
next prev parent reply other threads:[~2019-11-01 15:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-01 15:25 [PATCH for-4.2 v2 0/3] qcow2: Fix data corruption on XFS Max Reitz
2019-11-01 15:25 ` [PATCH for-4.2 v2 1/3] block: Make wait/mark serialising requests public Max Reitz
2019-11-01 15:25 ` Max Reitz [this message]
2019-11-01 15:25 ` [PATCH for-4.2 v2 3/3] block/file-posix: Let post-EOF fallocate serialize Max Reitz
2019-11-14 16:27 ` Christoph Hellwig
2019-11-14 17:15 ` Max Reitz
2019-11-14 17:16 ` Max Reitz
2020-06-02 14:43 ` Vladimir Sementsov-Ogievskiy
2020-06-02 15:46 ` Max Reitz
2020-06-02 16:16 ` Vladimir Sementsov-Ogievskiy
2020-06-02 16:38 ` Max Reitz
2020-06-02 17:01 ` Vladimir Sementsov-Ogievskiy
2020-06-02 17:08 ` Vladimir Sementsov-Ogievskiy
2020-08-22 17:03 ` Vladimir Sementsov-Ogievskiy
2020-08-22 17:04 ` Vladimir Sementsov-Ogievskiy
2020-08-26 8:23 ` Vladimir Sementsov-Ogievskiy
2020-08-26 11:20 ` Vladimir Sementsov-Ogievskiy
2019-11-01 15:48 ` [PATCH for-4.2 v2 0/3] qcow2: Fix data corruption on XFS no-reply
2019-11-04 8:29 ` Max Reitz
2019-11-04 9:09 ` Max Reitz
2019-11-04 9:45 ` Stefan Hajnoczi
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=20191101152510.11719-3-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=anton.nefedov@virtuozzo.com \
--cc=den@openvz.org \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@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).