qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.9 v3 0/5] Sheepdog cleanups
@ 2016-11-29 11:32 Paolo Bonzini
  2016-11-29 11:32 ` [Qemu-devel] [PATCH 1/5] sheepdog: remove unused cancellation support Paolo Bonzini
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Paolo Bonzini @ 2016-11-29 11:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: jcody, qemu-block, Hitoshi Mitake, Liu Yuan

Cleaning up the code and removing duplication makes it simpler to
later adapt it for the multiqueue work.

Tested against sheepdog 1.0.  I also tested taking snapshots and reverting
to older snapshots, but the latter only worked with "dog vdi rollback".
Neither loadvm nor qemu-img worked for me.

Paolo

        v1->v2: placate patchew
        v2->v3: rebase

Paolo Bonzini (5):
  sheepdog: remove unused cancellation support
  sheepdog: reorganize coroutine flow
  sheepdog: do not use BlockAIOCB
  sheepdog: simplify inflight_aio_head management
  sheepdog: reorganize check for overlapping requests

 block/sheepdog.c | 289 ++++++++++++++++---------------------------------------
 1 file changed, 83 insertions(+), 206 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 1/5] sheepdog: remove unused cancellation support
@ 2016-11-29 11:32 Paolo Bonzini
  2016-11-29 11:32 ` [Qemu-devel] [PATCH 2/5] sheepdog: reorganize coroutine flow Paolo Bonzini
  0 siblings, 1 reply; 15+ messages in thread
From: Paolo Bonzini @ 2016-11-29 11:32 UTC (permalink / raw)
  To: qemu-devel

SheepdogAIOCB is internal to sheepdog.c, hence it is never canceled.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/sheepdog.c | 52 ----------------------------------------------------
 1 file changed, 52 deletions(-)

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 4c9af89..0b30524 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -347,7 +347,6 @@ struct SheepdogAIOCB {
     Coroutine *coroutine;
     void (*aio_done_func)(SheepdogAIOCB *);
 
-    bool cancelable;
     int nr_pending;
 
     uint32_t min_affect_data_idx;
@@ -486,7 +485,6 @@ static inline void free_aio_req(BDRVSheepdogState *s, AIOReq *aio_req)
 {
     SheepdogAIOCB *acb = aio_req->aiocb;
 
-    acb->cancelable = false;
     QLIST_REMOVE(aio_req, aio_siblings);
     g_free(aio_req);
 
@@ -499,57 +497,8 @@ static void coroutine_fn sd_finish_aiocb(SheepdogAIOCB *acb)
     qemu_aio_unref(acb);
 }
 
-/*
- * Check whether the specified acb can be canceled
- *
- * We can cancel aio when any request belonging to the acb is:
- *  - Not processed by the sheepdog server.
- *  - Not linked to the inflight queue.
- */
-static bool sd_acb_cancelable(const SheepdogAIOCB *acb)
-{
-    BDRVSheepdogState *s = acb->common.bs->opaque;
-    AIOReq *aioreq;
-
-    if (!acb->cancelable) {
-        return false;
-    }
-
-    QLIST_FOREACH(aioreq, &s->inflight_aio_head, aio_siblings) {
-        if (aioreq->aiocb == acb) {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-static void sd_aio_cancel(BlockAIOCB *blockacb)
-{
-    SheepdogAIOCB *acb = (SheepdogAIOCB *)blockacb;
-    BDRVSheepdogState *s = acb->common.bs->opaque;
-    AIOReq *aioreq, *next;
-
-    if (sd_acb_cancelable(acb)) {
-        /* Remove outstanding requests from failed queue.  */
-        QLIST_FOREACH_SAFE(aioreq, &s->failed_aio_head, aio_siblings,
-                           next) {
-            if (aioreq->aiocb == acb) {
-                free_aio_req(s, aioreq);
-            }
-        }
-
-        assert(acb->nr_pending == 0);
-        if (acb->common.cb) {
-            acb->common.cb(acb->common.opaque, -ECANCELED);
-        }
-        sd_finish_aiocb(acb);
-    }
-}
-
 static const AIOCBInfo sd_aiocb_info = {
     .aiocb_size     = sizeof(SheepdogAIOCB),
-    .cancel_async   = sd_aio_cancel,
 };
 
 static SheepdogAIOCB *sd_aio_setup(BlockDriverState *bs, QEMUIOVector *qiov,
@@ -569,7 +518,6 @@ static SheepdogAIOCB *sd_aio_setup(BlockDriverState *bs, QEMUIOVector *qiov,
     acb->nb_sectors = nb_sectors;
 
     acb->aio_done_func = NULL;
-    acb->cancelable = true;
     acb->coroutine = qemu_coroutine_self();
     acb->ret = 0;
     acb->nr_pending = 0;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH for-2.9 v2 0/5] Sheepdog cleanups
@ 2016-11-18 16:42 Paolo Bonzini
  2016-11-18 16:42 ` [Qemu-devel] [PATCH 2/5] sheepdog: reorganize coroutine flow Paolo Bonzini
  0 siblings, 1 reply; 15+ messages in thread
From: Paolo Bonzini @ 2016-11-18 16:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: jcody, qemu-block, Hitoshi Mitake, Liu Yuan



Cleaning up the code and removing duplication makes it simpler to
later adapt it for the multiqueue work.

Tested against sheepdog 1.0.  I also tested taking snapshots and reverting
to older snapshots, but the latter only worked with "dog vdi rollback".
Neither loadvm nor qemu-img worked for me.

Paolo

        v1->v2: placate patchew

Paolo Bonzini (5):
  sheepdog: remove unused cancellation support
  sheepdog: reorganize coroutine flow
  sheepdog: do not use BlockAIOCB
  sheepdog: simplify inflight_aio_head management
  sheepdog: reorganize check for overlapping requests

 block/sheepdog.c | 289 ++++++++++++++++---------------------------------------
 1 file changed, 83 insertions(+), 206 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH for-2.9 0/5] Sheepdog cleanups
@ 2016-11-18 15:54 Paolo Bonzini
  2016-11-18 15:54 ` [Qemu-devel] [PATCH 2/5] sheepdog: reorganize coroutine flow Paolo Bonzini
  0 siblings, 1 reply; 15+ messages in thread
From: Paolo Bonzini @ 2016-11-18 15:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, jcody

Cleaning up the code and removing duplication makes it simpler to
later adapt it for the multiqueue work.

Tested against sheepdog 1.0.  I also tested taking snapshots and reverting
to older snapshots, but the latter only worked with "dog vdi rollback".
Neither loadvm nor qemu-img worked for me.

Paolo Bonzini (5):
  sheepdog: remove unused cancellation support
  sheepdog: reorganize coroutine flow
  sheepdog: do not use BlockAIOCB
  sheepdog: simplify inflight_aio_head management
  sheepdog: reorganize check for overlapping requests

 block/sheepdog.c | 285 ++++++++++++++++---------------------------------------
 1 file changed, 81 insertions(+), 204 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-02-01  5:35 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-29 11:32 [Qemu-devel] [PATCH for-2.9 v3 0/5] Sheepdog cleanups Paolo Bonzini
2016-11-29 11:32 ` [Qemu-devel] [PATCH 1/5] sheepdog: remove unused cancellation support Paolo Bonzini
2016-11-29 11:32 ` [Qemu-devel] [PATCH 2/5] sheepdog: reorganize coroutine flow Paolo Bonzini
2016-11-29 11:32 ` [Qemu-devel] [PATCH 3/5] sheepdog: do not use BlockAIOCB Paolo Bonzini
2016-11-29 11:32 ` [Qemu-devel] [PATCH 4/5] sheepdog: simplify inflight_aio_head management Paolo Bonzini
2016-11-29 11:32 ` [Qemu-devel] [PATCH 5/5] sheepdog: reorganize check for overlapping requests Paolo Bonzini
2016-12-21 14:07 ` [Qemu-devel] [PATCH for-2.9 v3 0/5] Sheepdog cleanups Paolo Bonzini
2017-01-04  4:07   ` Jeff Cody
2017-01-04 11:42     ` Paolo Bonzini
2017-01-04 16:47       ` Jeff Cody
2017-01-31  1:48         ` Paolo Bonzini
2017-02-01  5:35           ` Jeff Cody
  -- strict thread matches above, loose matches on Subject: below --
2016-11-29 11:32 [Qemu-devel] [PATCH 1/5] sheepdog: remove unused cancellation support Paolo Bonzini
2016-11-29 11:32 ` [Qemu-devel] [PATCH 2/5] sheepdog: reorganize coroutine flow Paolo Bonzini
2016-11-18 16:42 [Qemu-devel] [PATCH for-2.9 v2 0/5] Sheepdog cleanups Paolo Bonzini
2016-11-18 16:42 ` [Qemu-devel] [PATCH 2/5] sheepdog: reorganize coroutine flow Paolo Bonzini
2016-11-18 15:54 [Qemu-devel] [PATCH for-2.9 0/5] Sheepdog cleanups Paolo Bonzini
2016-11-18 15:54 ` [Qemu-devel] [PATCH 2/5] sheepdog: reorganize coroutine flow Paolo Bonzini

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).