qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, eblake@redhat.com, mreitz@redhat.com,
	vsementsov@virtuozzo.com, jsnow@redhat.com, kwolf@redhat.com
Subject: [PATCH 08/11] block/reqlist: add reqlist_wait_all()
Date: Wed,  4 Aug 2021 16:17:47 +0300	[thread overview]
Message-ID: <20210804131750.127574-9-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20210804131750.127574-1-vsementsov@virtuozzo.com>

To be used in the next commit.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 include/block/reqlist.h | 2 ++
 block/reqlist.c         | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/include/block/reqlist.h b/include/block/reqlist.h
index 2de86be300..59d5c24cda 100644
--- a/include/block/reqlist.h
+++ b/include/block/reqlist.h
@@ -39,6 +39,8 @@ BlockReq *reqlist_find_conflict(BlockReqList *reqs, int64_t offset,
                                 int64_t bytes);
 bool coroutine_fn reqlist_wait_one(BlockReqList *reqs, int64_t offset,
                                    int64_t bytes, CoMutex *lock);
+void coroutine_fn reqlist_wait_all(BlockReqList *reqs, int64_t offset,
+                                   int64_t bytes, CoMutex *lock);
 void coroutine_fn reqlist_shrink_req(BlockReq *req, int64_t new_bytes);
 void coroutine_fn reqlist_remove_req(BlockReq *req);
 
diff --git a/block/reqlist.c b/block/reqlist.c
index c41415c16a..939437621d 100644
--- a/block/reqlist.c
+++ b/block/reqlist.c
@@ -68,6 +68,12 @@ bool coroutine_fn reqlist_wait_one(BlockReqList *reqs, int64_t offset,
     return true;
 }
 
+void coroutine_fn reqlist_wait_all(BlockReqList *reqs, int64_t offset,
+                                   int64_t bytes, CoMutex *lock)
+{
+    while (reqlist_wait_one(reqs, offset, bytes, lock)) { }
+}
+
 /*
  * Shrink request and wake all waiting coroutines (may be some of them are not
  * intersecting with shrunk request).
-- 
2.29.2



  parent reply	other threads:[~2021-08-04 13:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04 13:17 [PATCH RFC DRAFT 00/11] Make image fleecing more usable Vladimir Sementsov-Ogievskiy
2021-08-04 13:17 ` [PATCH 01/11] block/block-copy: move copy_bitmap initialization to block_copy_state_new() Vladimir Sementsov-Ogievskiy
2021-08-04 13:17 ` [PATCH 02/11] block/dirty-bitmap: bdrv_merge_dirty_bitmap(): add return value Vladimir Sementsov-Ogievskiy
2021-08-04 13:17 ` [PATCH 03/11] block/block-copy: block_copy_state_new(): add bitmap parameter Vladimir Sementsov-Ogievskiy
2021-08-04 13:17 ` [PATCH 04/11] block/copy-before-write: add bitmap open parameter Vladimir Sementsov-Ogievskiy
2021-08-04 13:17 ` [PATCH 05/11] block/block-copy: add block_copy_reset() Vladimir Sementsov-Ogievskiy
2021-08-04 13:17 ` [PATCH 06/11] block: intoduce reqlist Vladimir Sementsov-Ogievskiy
2021-08-04 13:17 ` [PATCH 07/11] block/dirty-bitmap: introduce bdrv_dirty_bitmap_status() Vladimir Sementsov-Ogievskiy
2021-08-04 13:17 ` Vladimir Sementsov-Ogievskiy [this message]
2021-08-04 13:17 ` [PATCH 09/11] block/copy-before-write: add cbw_snapshot_read_{lock, unlock}() Vladimir Sementsov-Ogievskiy via
2021-08-04 13:17 ` [PATCH 10/11] block/copy-before-write: add cbw_snapshot_discard() Vladimir Sementsov-Ogievskiy
2021-08-04 13:17 ` [PATCH 11/11] block: introduce fleecing block driver Vladimir Sementsov-Ogievskiy

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=20210804131750.127574-9-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=eblake@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).