From patchwork Wed Apr 30 18:24:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 344277 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 12877140099 for ; Thu, 1 May 2014 04:32:04 +1000 (EST) Received: from localhost ([::1]:58478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WfZIX-0001i2-Vi for incoming@patchwork.ozlabs.org; Wed, 30 Apr 2014 14:32:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WfZBc-0007pa-Au for qemu-devel@nongnu.org; Wed, 30 Apr 2014 14:24:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WfZBV-0003MK-Jv for qemu-devel@nongnu.org; Wed, 30 Apr 2014 14:24:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WfZBV-0003MD-Cb for qemu-devel@nongnu.org; Wed, 30 Apr 2014 14:24:45 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3UIOihH019806 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 30 Apr 2014 14:24:44 -0400 Received: from noname.redhat.com (ovpn-116-113.ams2.redhat.com [10.36.116.113]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3UIO4j2011903; Wed, 30 Apr 2014 14:24:43 -0400 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Wed, 30 Apr 2014 20:24:00 +0200 Message-Id: <1398882243-14783-29-git-send-email-kwolf@redhat.com> In-Reply-To: <1398882243-14783-1-git-send-email-kwolf@redhat.com> References: <1398882243-14783-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com Subject: [Qemu-devel] [PULL 28/31] curl: Remove unnecessary explicit calls to internal event handler X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Matthew Booth Remove calls to curl_multi_do where the relevant handles are already registered to the event loop. Ensure that we kick off socket handling with CURL_SOCKET_TIMEOUT after adding a new handle. Signed-off-by: Matthew Booth Tested-by: Richard W.M. Jones Signed-off-by: Kevin Wolf --- block/curl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/curl.c b/block/curl.c index 50bd05f..fd2756e 100644 --- a/block/curl.c +++ b/block/curl.c @@ -535,7 +535,6 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags, curl_multi_setopt(s->multi, CURLMOPT_TIMERDATA, s); curl_multi_setopt(s->multi, CURLMOPT_TIMERFUNCTION, curl_timer_cb); #endif - curl_multi_do(s); qemu_opts_del(opts); return 0; @@ -564,6 +563,7 @@ static const AIOCBInfo curl_aiocb_info = { static void curl_readv_bh_cb(void *p) { CURLState *state; + int running; CURLAIOCB *acb = p; BDRVCURLState *s = acb->common.bs->opaque; @@ -612,8 +612,9 @@ static void curl_readv_bh_cb(void *p) curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range); curl_multi_add_handle(s->multi, state->curl); - curl_multi_do(s); + /* Tell curl it needs to kick things off */ + curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &running); } static BlockDriverAIOCB *curl_aio_readv(BlockDriverState *bs,