Received: from eggs.gnu.org ([2001:4830:134:3::10]:34062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBgfI-00010x-Ce for qemu-devel@nongnu.org; Tue, 29 Nov 2016 06:33:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cBgfF-0003El-7F for qemu-devel@nongnu.org; Tue, 29 Nov 2016 06:33:36 -0500 Received: from mail-wj0-f195.google.com ([209.85.210.195]:36193) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cBgfF-0003Dx-0l for qemu-devel@nongnu.org; Tue, 29 Nov 2016 06:33:33 -0500 Received: by mail-wj0-f195.google.com with SMTP id jb2so17737699wjb.3 for ; Tue, 29 Nov 2016 03:33:32 -0800 (PST) Received: from donizetti.lan (94-39-142-128.adsl-ull.clienti.tiscali.it. [94.39.142.128]) by smtp.gmail.com with ESMTPSA id vr9sm67301750wjc.35.2016.11.29.03.32.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Nov 2016 03:32:30 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 29 Nov 2016 12:32:26 +0100 Message-Id: <20161129113230.32621-1-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 1/5] sheepdog: remove unused cancellation support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org SheepdogAIOCB is internal to sheepdog.c, hence it is never canceled. Signed-off-by: Paolo Bonzini --- 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