Message ID | 20160825134421.20231-14-pbutsykin@virtuozzo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B892560459 for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 25 Aug 2016 15:18:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9DD229370 for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 25 Aug 2016 15:18:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E97129373; Thu, 25 Aug 2016 15:18:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6261A29370 for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 25 Aug 2016 15:18:53 +0000 (UTC) Received: from localhost ([::1]:56779 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org>) id 1bcwQd-0001EC-Ju for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Aug 2016 11:18:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <pbutsykin@virtuozzo.com>) id 1bcwQN-0001CP-B8 for qemu-devel@nongnu.org; Thu, 25 Aug 2016 11:18:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <pbutsykin@virtuozzo.com>) id 1bcwQM-0005RX-8d for qemu-devel@nongnu.org; Thu, 25 Aug 2016 11:18:35 -0400 Received: from mail-db5eur01on0123.outbound.protection.outlook.com ([104.47.2.123]:18400 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <pbutsykin@virtuozzo.com>) id 1bcwQG-0005PB-Dg; Thu, 25 Aug 2016 11:18:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=dHrouZFQzkltDZQN9nBFRHxUu7vnvzT520yLatzTfW4=; b=SOd6fqvf+jlu0AomgQ4bvJhXqm6oUJeWqnE451r2NXtHQZDRyObwHqVhHRTpbt21iHkLmiB1ZiKWvtexC5Lc7dLZ1i63Cuj3XQwidp/GQ8wHxw4w/zMZ+dQadqVGLNhbGIE3Hp6qI2RXbZJNdesXoS7QjLtA6FsqwCDkR1hssVQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pbutsykin@virtuozzo.com; Received: from pavelb-Z68P-DS3.sw.ru (195.214.232.10) by DB6PR0802MB2549.eurprd08.prod.outlook.com (10.172.251.147) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.9; Thu, 25 Aug 2016 13:45:39 +0000 From: Pavel Butsykin <pbutsykin@virtuozzo.com> To: <qemu-block@nongnu.org>, <qemu-devel@nongnu.org> Date: Thu, 25 Aug 2016 16:44:12 +0300 Message-ID: <20160825134421.20231-14-pbutsykin@virtuozzo.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20160825134421.20231-1-pbutsykin@virtuozzo.com> References: <20160825134421.20231-1-pbutsykin@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [195.214.232.10] X-ClientProxiedBy: AMSPR02CA0013.eurprd02.prod.outlook.com (10.242.225.141) To DB6PR0802MB2549.eurprd08.prod.outlook.com (10.172.251.147) X-MS-Office365-Filtering-Correlation-Id: 65207f38-4d59-457d-4670-08d3ccee1a57 X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2549; 2:uIL1jETWkSiTxa84633xVlWgVCm07egrRTj6UEjie2tKAZVPYNOi0JB8mDXxkvbN7+FbzgbpqbQnvWXtRSKNJzvHH/tEdnZk1dj3rt1AglKuJtZ/jAde9T0ktudFztaHoiwN5TJcSSnDz/r4YeW5YidFCMzBU65ARhdfBCBJ8/6Uoox/O5ezHxAzCf+s/q67; 3:U0fzMs6m01tboZL1//Tg5knNFrxcTaeJoOZX9BltkvFYyW6sI3bhcYnckW8ud77bt3/Qm9CEsiOXCngA+FIukUPHfgeFlYmBTx/m1YLP/b6yTS1FVhZPDe+haplC/XDh X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0802MB2549; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2549; 25:RJK7LocbT6EPTRJkgj+3o4mImOprh1RpStxE87zYXgyC3sjydBlId4sw8GlaIKV8LzV29lqCFWy6zhwRkFtbjqcrFH+nVMkZc4c6FlFkJp+xfhQSOhekS7YpSJ5N4XoKLhL2Q82PpYVsNqHVErMYzADqWTsRzvCM0ULMv7DB2tbij2prWmmAxmjXgiHG1dvbQbqK6EfpSuZL1dHEOy0rA4/2XUZCSpeAt+duRvjhrQaJdoPj1/JXtu/ZCwnBojhZwrcPQ7xXIPyUp7MBUzMiBEWLcFPjxBA+I9u3e+BQYzKbUMYuGcKXGOSEqAjqINmVXjyLzCsPxWKKxjecyQd4WXc/soL5dgxLlhQMZxRWmYZGdWwQtyintPbB987w+b4SF7R+TYDDhws5qBZKfvtBpUQz/sCqEbVAHa5U84504gS3rfB5yVT/LPk+HSaTisk0a0+5oITOF7L/Gr6YFNPP+8Fko7KedJtVcaWMeQG0b8xWWL5BKF3zHUq76NW5tNMG6lXPWq6ZlSE9q0tXzawqp0ApA0qh3f4hrU/4dOzo50mNMcohgeFTg4qt+MZs8Xx+hsODfZUUzbS8R+t0RuVNZyleZQCb4qvvgw+fr02kAmLaO0F+k2Dyg3t4+y1VVFmehaHKGu9goTrr0dFJylQ8686nGLRh22MovzNpTDhwGL1jiFafBw4/+KNoFqPegEPxVzh5MhFIK7AhQ1mvl9X4Aw==; 31:BQBxt9Yb1w3OkLtrXjBou2QAgO8QqMzwLHP2yrd0EQ+68gsPt2ZDDZJ976IqK4y0sSEOrj27ejWTLLfDqRXS/7f98zDbiPrhpRmP3JtimS5/c8xe6oTL6GIMQNJGq+ael9Z6b4FKRatcvqqfFac1G7DpFK1zPX9yXDIJBlND5uo239ojv4yLZbFmNNH9jkRXWF/gFOvndThoUJTiqiICjN+DI/4BCaDCKFa0YV19x2M= X-Microsoft-Antispam-PRVS: <DB6PR0802MB254930B53D1A9EAC00CE2E87ACED0@DB6PR0802MB2549.eurprd08.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6043046)(6042046); SRVR:DB6PR0802MB2549; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0802MB2549; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2549; 4:4DljFzy6idChufGM2I9Qmm+ELW8Qyhwc/3jX4PFQ0tQNnWs00pedZkzKS4eMt19bKu0gefC5wXeJVmbfUPp8Lazkmu2B5U0OFerSz+Sk4aTI63eknlSiBnWEVcLnC0YEO5DHKDfMOp0hjDEi+XlVWZ56lkfJWP6ylWZJutuMRPWa3iE3VBAwvnX7/RnGKMEKAV4h5WUImEzjxAtGzvhpa3U7S1986MOVc1wHNS0q2nCK0bxjtJ4aZ34GuBakhU+LGQ5jilWGQcqFBRvdPkPegG0k4sAfHh9pywx3dENFOL1Hgxdr8zHkhdy/mnUXjRJbJ2oUt62eXLOwovkaP4dTQp+h+y1wihV+j0IjVdYhDec3r5hHlqXUPqoQTqzRloZtUilTeXB7WJwrFbtBVTsEjD46RTxA8EO3LZCKNIklink= X-Forefront-PRVS: 0045236D47 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(199003)(86362001)(33646002)(1076002)(69596002)(5003940100001)(42186005)(68736007)(189998001)(92566002)(66066001)(106356001)(47776003)(6116002)(3846002)(586003)(36756003)(5001770100001)(97736004)(2906002)(4326007)(2950100001)(5660300001)(76176999)(48376002)(53416004)(105586002)(50466002)(81156014)(8676002)(50226002)(77096005)(81166006)(19580405001)(50986999)(229853001)(101416001)(7846002)(7736002)(305945005)(19580395003)(41533002)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0802MB2549; H:pavelb-Z68P-DS3.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0802MB2549; 23:ytxNa3Wrl6m0PK7vNibHwPrtaPjUrNBhtYWPiAC?= =?us-ascii?Q?ntb5pEpflVEDiH0tIpkCGeCc7Z7lDjpaCZ6S6mUddsyNtdlTpbhsZQ4D6jqI?= =?us-ascii?Q?aOyaLHuCCcNSaytyVuTcWUt9r682/m/IPIg0gPv4V+zKANhgRpVgTi/79AHD?= =?us-ascii?Q?dAgjAO6jPRjVutLPLcBQTjvI7vCuNLij1wJbnxbZiuK9X5g+sUrIVou1UG8M?= =?us-ascii?Q?KWxDzxpRvmCdnhXKBMvUUcE9ssRLgD84C5lUJB4m9aN+XmOHKm/9/hBqxZ5h?= =?us-ascii?Q?PVZvVnaNsZeSY4koYAQ5I3M3DcaQ4WJNxV3KiNT/izJj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+7HIgU6mZM=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2549; 6:nPDzUy3vhw1h9YMIs78I6nmd/fiPMgBPotxBZQdomZ3fRgzm4T6BZjH87209yK0e1ydX5F+ZncOHzPc7xF7D1l4cj/G0ZXsrNHYv3QKyY6ux7b3CdUmIlEQ8vNonyy1vaJLznUog42QuJ2PJdVgp4MycQMx8kd+dS9LpeRXlVBvdNRK0cnSodm7LqWi039XDGqziKJX48mEGaOQutGl48N5d1BLlWHLhGsW53TdV5CWgmWlFJfH3vg09l2Y035q3GjXCf0bvQS/lVjeiOCrODQZIT/eBiwkAIc0LPst3pWWhol5YgiA1ijX/+mByjE9g; 5:gbpjJx8y4NruJnXKlrP7pq6YMunBpQkrdZw/ApcSftHGMQjlx9SVai3P8ue+dwPL9r+W1O8jNiPmQTmc6i8O7lwKZrzyCMD3XcIacoe8ssnOY9QqeD3xrMlUuOAM4D/tWlp2rkmVpR4ZjhNgrl09Ow==; 24:LR4wKyw9Nazs95VGHQeqWfEJ8HjYSsmyLrmvaoteLxjATj6nocIH+2PUcpc0v5Tnzm02MVK2HzR8fdtkNv9SJyPzGlWpknJkOv4qjwxxjFQ=; 7:/sWwCrvUimWc49yzr3LYGDz3TJBJcnseOEXPbOJRSDOTZ+ok1te90n3Rm9z98lDijuGAKd4WfXcgDKnC+mmbxC5mIfdGrWYYDmbLyAUs0ch4xq93AI8/5Dmcl+xheWDA4BWUWiPpxyJOxLwlxzJV7Fdo/J8r35865i1z96Ged6zK1+PGqkQEo1M3sjIbJfDcYVc+gHyoO0URqVDs6eCYAfwpdpIYQRFq5IttDpDyUMzz4Dj22sTsZLXrG0GUiIiq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2549; 20:hswIssWOE+2gBCCJrG75W4DSH2L77aEMDFeWW21XOJM5rlscQxPTEDx/Y+X9DS4Q8Xaid0WQIZERvXL2Zs4leOjcNBR6WzxgDPKKiovBMhjlFzy4hRPoyCYN1SDMx9A7qjvrD81UKUY5QRdUwxeuLsfjUX/3BGgM8c9c6Yng6JI= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2016 13:45:39.8796 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2549 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.123 Subject: [Qemu-devel] [PATCH RFC 13/22] block/pcache: add generic request complete X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: kwolf@redhat.com, den@openvz.org, jsnow@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/block/pcache.c b/block/pcache.c index 435f2b4..1ff4c6a 100644 --- a/block/pcache.c +++ b/block/pcache.c @@ -105,6 +105,7 @@ typedef struct PrefCacheAIOCB { CoMutex lock; uint32_t cnt; } requests; + uint32_t ref; QEMUBH *bh; int ret; } PrefCacheAIOCB; @@ -505,9 +506,11 @@ static void pcache_aio_bh(void *opaque) static void complete_aio_request(PrefCacheAIOCB *acb) { - acb->bh = aio_bh_new(bdrv_get_aio_context(acb->common.bs), - pcache_aio_bh, acb); - qemu_bh_schedule(acb->bh); + if (atomic_dec_fetch(&acb->ref) == 0) { + acb->bh = aio_bh_new(bdrv_get_aio_context(acb->common.bs), + pcache_aio_bh, acb); + qemu_bh_schedule(acb->bh); + } } static void pcache_node_submit(PrefCachePartReq *req) @@ -585,9 +588,7 @@ static void pcache_aio_cb(void *opaque, int ret) pcache_merge_requests(acb); } - acb->common.cb(acb->common.opaque, ret); - - qemu_aio_unref(acb); + complete_aio_request(acb); } static PrefCacheAIOCB *pcache_aio_get(BlockDriverState *bs, int64_t sector_num, @@ -603,6 +604,7 @@ static PrefCacheAIOCB *pcache_aio_get(BlockDriverState *bs, int64_t sector_num, acb->requests.cnt = 0; acb->qiov = qiov; acb->aio_type = type; + acb->ref = 1; acb->ret = 0; QTAILQ_INIT(&acb->requests.list);
his change allow us to generalize the completion of all requests. Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com> --- block/pcache.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)