From patchwork Fri Nov 18 15:54:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 696651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tL2tJ0CD1z9t1d for ; Sat, 19 Nov 2016 03:06:32 +1100 (AEDT) Received: from localhost ([::1]:37569 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7lgL-0000PC-46 for incoming@patchwork.ozlabs.org; Fri, 18 Nov 2016 11:06:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7lVP-0007rg-Ln for qemu-devel@nongnu.org; Fri, 18 Nov 2016 10:55:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7lVO-0007sQ-KO for qemu-devel@nongnu.org; Fri, 18 Nov 2016 10:55:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41932) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c7lVK-0007ka-Ig; Fri, 18 Nov 2016 10:55:06 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5D824C01094F; Fri, 18 Nov 2016 15:55:05 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-43.ams2.redhat.com [10.36.112.43]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAIFt1ku001948; Fri, 18 Nov 2016 10:55:03 -0500 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 18 Nov 2016 16:54:56 +0100 Message-Id: <20161118155500.11050-2-pbonzini@redhat.com> In-Reply-To: <20161118155500.11050-1-pbonzini@redhat.com> References: <20161118155500.11050-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 18 Nov 2016 15:55:05 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/5] sheepdog: remove unused cancellation support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hitoshi Mitake , Liu Yuan , jcody@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" SheepdogAIOCB is internal to sheepdog.c, hence it is never canceled. Cc: Hitoshi Mitake Cc: Liu Yuan 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 1fb9173..d2b14fd 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;