From nobody Mon Feb 9 01:20:30 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.zohomail.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 1516401331779990.9986007339884; Fri, 19 Jan 2018 14:35:31 -0800 (PST) Received: from localhost ([::1]:49938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecfFz-0001TU-20 for importer@patchew.org; Fri, 19 Jan 2018 17:35:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecfCf-0007jw-Rd for qemu-devel@nongnu.org; Fri, 19 Jan 2018 17:32:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecfCe-0005IH-0J for qemu-devel@nongnu.org; Fri, 19 Jan 2018 17:32:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45082) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ecfCd-0005FN-Qh for qemu-devel@nongnu.org; Fri, 19 Jan 2018 17:32:03 -0500 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 079D913D17; Fri, 19 Jan 2018 22:32:03 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-231.bos.redhat.com [10.18.17.231]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6595E64443; Fri, 19 Jan 2018 22:32:02 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 19 Jan 2018 17:31:56 -0500 Message-Id: <20180119223159.29890-2-jsnow@redhat.com> In-Reply-To: <20180119223159.29890-1-jsnow@redhat.com> References: <20180119223159.29890-1-jsnow@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.30]); Fri, 19 Jan 2018 22:32:03 +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] [PULL 1/4] ide: pass IDEState to trim AIO callback 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: peter.maydell@linaro.org, Anton Nefedov , jsnow@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" From: Anton Nefedov It will be needed to handle invalid requests Signed-off-by: Anton Nefedov Message-id: 1512735034-35327-2-git-send-email-anton.nefedov@virtuozzo.com Signed-off-by: John Snow --- hw/ide/core.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index 1ea5812b7e..875f7b442d 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -382,7 +382,7 @@ static void ide_set_signature(IDEState *s) =20 typedef struct TrimAIOCB { BlockAIOCB common; - BlockBackend *blk; + IDEState *s; QEMUBH *bh; int ret; QEMUIOVector *qiov; @@ -425,6 +425,8 @@ static void ide_trim_bh_cb(void *opaque) static void ide_issue_trim_cb(void *opaque, int ret) { TrimAIOCB *iocb =3D opaque; + IDEState *s =3D iocb->s; + if (ret >=3D 0) { while (iocb->j < iocb->qiov->niov) { int j =3D iocb->j; @@ -442,7 +444,7 @@ static void ide_issue_trim_cb(void *opaque, int ret) } =20 /* Got an entry! Submit and exit. */ - iocb->aiocb =3D blk_aio_pdiscard(iocb->blk, + iocb->aiocb =3D blk_aio_pdiscard(s->blk, sector << BDRV_SECTOR_BITS, count << BDRV_SECTOR_BITS, ide_issue_trim_cb, opaque); @@ -466,11 +468,11 @@ BlockAIOCB *ide_issue_trim( int64_t offset, QEMUIOVector *qiov, BlockCompletionFunc *cb, void *cb_opaque, void *opaque) { - BlockBackend *blk =3D opaque; + IDEState *s =3D opaque; TrimAIOCB *iocb; =20 - iocb =3D blk_aio_get(&trim_aiocb_info, blk, cb, cb_opaque); - iocb->blk =3D blk; + iocb =3D blk_aio_get(&trim_aiocb_info, s->blk, cb, cb_opaque); + iocb->s =3D s; iocb->bh =3D qemu_bh_new(ide_trim_bh_cb, iocb); iocb->ret =3D 0; iocb->qiov =3D qiov; @@ -900,7 +902,7 @@ static void ide_dma_cb(void *opaque, int ret) case IDE_DMA_TRIM: s->bus->dma->aiocb =3D dma_blk_io(blk_get_aio_context(s->blk), &s->sg, offset, BDRV_SECTOR_SIZE, - ide_issue_trim, s->blk, ide_dma_cb= , s, + ide_issue_trim, s, ide_dma_cb, s, DMA_DIRECTION_TO_DEVICE); break; default: --=20 2.14.3