From nobody Sun Feb 8 13:53:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1497635577857626.1585944947471; Fri, 16 Jun 2017 10:52:57 -0700 (PDT) Received: from localhost ([::1]:60161 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLvQW-0003N2-GR for importer@patchew.org; Fri, 16 Jun 2017 13:52:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLvCd-0006WF-Mp for qemu-devel@nongnu.org; Fri, 16 Jun 2017 13:38:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLvCc-000290-TJ for qemu-devel@nongnu.org; Fri, 16 Jun 2017 13:38:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48164) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dLvCa-00021b-BE; Fri, 16 Jun 2017 13:38:32 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 432EC6408F; Fri, 16 Jun 2017 17:38:31 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-50.ams2.redhat.com [10.36.116.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id D2E4686D28; Fri, 16 Jun 2017 17:38:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 432EC6408F Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 432EC6408F From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 16 Jun 2017 19:37:09 +0200 Message-Id: <1497634636-20230-25-git-send-email-kwolf@redhat.com> In-Reply-To: <1497634636-20230-1-git-send-email-kwolf@redhat.com> References: <1497634636-20230-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 16 Jun 2017 17:38:31 +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 v2 24/31] qed: Remove recursion in qed_aio_next_io() 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: kwolf@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Instead of calling itself recursively as the last thing, just convert qed_aio_next_io() into a loop. This patch is best reviewed with 'git show -w' because most of it is just whitespace changes. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- block/qed.c | 63 +++++++++++++++++++++++++++++++--------------------------= ---- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/block/qed.c b/block/qed.c index db80987..e762169 100644 --- a/block/qed.c +++ b/block/qed.c @@ -1280,45 +1280,46 @@ static void qed_aio_next_io(QEDAIOCB *acb) size_t len; int ret; =20 - trace_qed_aio_next_io(s, acb, 0, acb->cur_pos + acb->cur_qiov.size); + while (1) { + trace_qed_aio_next_io(s, acb, 0, acb->cur_pos + acb->cur_qiov.size= ); =20 - if (acb->backing_qiov) { - qemu_iovec_destroy(acb->backing_qiov); - g_free(acb->backing_qiov); - acb->backing_qiov =3D NULL; - } + if (acb->backing_qiov) { + qemu_iovec_destroy(acb->backing_qiov); + g_free(acb->backing_qiov); + acb->backing_qiov =3D NULL; + } =20 - acb->qiov_offset +=3D acb->cur_qiov.size; - acb->cur_pos +=3D acb->cur_qiov.size; - qemu_iovec_reset(&acb->cur_qiov); + acb->qiov_offset +=3D acb->cur_qiov.size; + acb->cur_pos +=3D acb->cur_qiov.size; + qemu_iovec_reset(&acb->cur_qiov); =20 - /* Complete request */ - if (acb->cur_pos >=3D acb->end_pos) { - qed_aio_complete(acb, 0); - return; - } + /* Complete request */ + if (acb->cur_pos >=3D acb->end_pos) { + qed_aio_complete(acb, 0); + return; + } =20 - /* Find next cluster and start I/O */ - len =3D acb->end_pos - acb->cur_pos; - ret =3D qed_find_cluster(s, &acb->request, acb->cur_pos, &len, &offset= ); - if (ret < 0) { - qed_aio_complete(acb, ret); - return; - } + /* Find next cluster and start I/O */ + len =3D acb->end_pos - acb->cur_pos; + ret =3D qed_find_cluster(s, &acb->request, acb->cur_pos, &len, &of= fset); + if (ret < 0) { + qed_aio_complete(acb, ret); + return; + } =20 - if (acb->flags & QED_AIOCB_WRITE) { - ret =3D qed_aio_write_data(acb, ret, offset, len); - } else { - ret =3D qed_aio_read_data(acb, ret, offset, len); - } + if (acb->flags & QED_AIOCB_WRITE) { + ret =3D qed_aio_write_data(acb, ret, offset, len); + } else { + ret =3D qed_aio_read_data(acb, ret, offset, len); + } =20 - if (ret < 0) { - if (ret !=3D -EINPROGRESS) { - qed_aio_complete(acb, ret); + if (ret < 0) { + if (ret !=3D -EINPROGRESS) { + qed_aio_complete(acb, ret); + } + return; } - return; } - qed_aio_next_io(acb); } =20 static BlockAIOCB *qed_aio_setup(BlockDriverState *bs, --=20 1.8.3.1