[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH for-4.2 3/4] block: Add bdrv_co_get_self_request()
From: |
Max Reitz |
Subject: |
[PATCH for-4.2 3/4] block: Add bdrv_co_get_self_request() |
Date: |
Fri, 1 Nov 2019 11:00:18 +0100 |
Signed-off-by: Max Reitz <address@hidden>
---
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
[PATCH for-4.2 2/4] block: Make wait/mark serialising requests public, Max Reitz, 2019/11/01
[PATCH for-4.2 3/4] block: Add bdrv_co_get_self_request(),
Max Reitz <=
[PATCH for-4.2 4/4] block/file-posix: Let post-EOF fallocate serialize, Max Reitz, 2019/11/01
Re: [PATCH for-4.2 0/4] qcow2: Fix data corruption on XFS, Max Reitz, 2019/11/01
- Re: [PATCH for-4.2 0/4] qcow2: Fix data corruption on XFS, Vladimir Sementsov-Ogievskiy, 2019/11/01
- Re: [PATCH for-4.2 0/4] qcow2: Fix data corruption on XFS, Max Reitz, 2019/11/01
- Re: [PATCH for-4.2 0/4] qcow2: Fix data corruption on XFS, Vladimir Sementsov-Ogievskiy, 2019/11/01
- Re: [PATCH for-4.2 0/4] qcow2: Fix data corruption on XFS, Max Reitz, 2019/11/01
- Re: [PATCH for-4.2 0/4] qcow2: Fix data corruption on XFS, Max Reitz, 2019/11/01
- Re: [PATCH for-4.2 0/4] qcow2: Fix data corruption on XFS, Vladimir Sementsov-Ogievskiy, 2019/11/01
- Re: [PATCH for-4.2 0/4] qcow2: Fix data corruption on XFS, Denis Lunev, 2019/11/01
- Re: [PATCH for-4.2 0/4] qcow2: Fix data corruption on XFS, Max Reitz, 2019/11/01