From patchwork Fri Dec 8 12:10:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10102433 Return-Path: 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 1C25D60360 for ; Fri, 8 Dec 2017 12:13:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F08DA28AB8 for ; Fri, 8 Dec 2017 12:13:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E501428C06; Fri, 8 Dec 2017 12:13:08 +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 4EAB728AB8 for ; Fri, 8 Dec 2017 12:13:07 +0000 (UTC) Received: from localhost ([::1]:36792 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNHWc-0000iM-I0 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 08 Dec 2017 07:13:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNHVN-0007NB-5Q for qemu-devel@nongnu.org; Fri, 08 Dec 2017 07:11:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eNHVJ-000449-Tn for qemu-devel@nongnu.org; Fri, 08 Dec 2017 07:11:49 -0500 Received: from mail-he1eur01on0126.outbound.protection.outlook.com ([104.47.0.126]:59386 helo=EUR01-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eNHVJ-00043g-HH; Fri, 08 Dec 2017 07:11:45 -0500 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=pgydEVKFTd8EUx8iDwhFoKXzF312gSOWv4EQ2uu0jxU=; b=anySSmitinkmC4Tc9caiQ9Mocn9IWHmxH3SPWcWKi7JFQvmyYe4vTG9KT0IsF+X2E1mJVeTriGGTExUe1NC99/81taakQAWVe87ajCtUQPlsVZfg1q6ZIL66YwzvNPdiBJpV7IAavK/dwX3IuWaRUVxPO7BshNwrtNAcZmxnkBM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by VI1PR0801MB1998.eurprd08.prod.outlook.com (2603:10a6:800:8a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Fri, 8 Dec 2017 12:11:42 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Fri, 8 Dec 2017 15:10:32 +0300 Message-Id: <1512735034-35327-2-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512735034-35327-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1512735034-35327-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: AM5PR0602CA0015.eurprd06.prod.outlook.com (2603:10a6:203:a3::25) To VI1PR0801MB1998.eurprd08.prod.outlook.com (2603:10a6:800:8a::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e8259669-26c3-4c3f-a7f2-08d53e34d811 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307); SRVR:VI1PR0801MB1998; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1998; 3:9xqlpaPXMLhZ6bl/mb3ht3kw+fQbr6BdxNP2s2DbQ5B4skkQswqsa+8lKq3zxufHNXBRLqLMGrP1QgvZmDMEImWnCWQZ05KletxIO9KiSn0rtxUaAIGy+2RNpLScMyQkoUpvQtmt6qRteahDcJD25uDhjrjmAj9Q3FZjj+bOG3g4jaEbKSUyIIU9I9B60NTGJNmy9st4uo5scH3JMuONh6o/E9u+LroicKFKXYwI+vc5ZeHJ/0gwuItx5LgaYKZ0; 25:SEFxvTtqyQHhwdkkwjstaERwYyEfABQhImkupDKyN6uT4q3AFuFenkeDi9/Ft3d+b3jQvm9BWmST7Ite8679jGvkOyLbgkWs3IxzT6Tt8tWtmHo7+ypc7oIrBoC+hTyOi6cSC3H9Np749WS5uC4xM8zMdufXKXH69Y3I6mc4GN4f4ol8kfupqRvVcHXrlhetOA0gKZg8F3K4m3oM3foV2YgREIuM3kzpg+tjJ1+n9tIGUUp0LgusCfrEAGxtiIQ4QIkOUpogSdDCUb3JE3FNKzFat4nvhHSAJn3a1YMFtVBJv1lT8x0NUcQwo+B50io65tEhtiOHiNYhPDhdijKJzw==; 31:KwjIy9YmpOc6oMuqovWJNIp2HOcbm6vGGEIPevGc7Nk92zUhg1UhB0fDRiqcufBD0Vj5/KhGMYgL0EDuv5AHKdZ0+u3/tCzCP9+8+ZvIyuFLBSyAC1zgWs0Ilky+TZvd60O5Kx0vAJm303EHV6MdCMXIbYHw5K6moYGuZ1GONIbdZ50h19GJ6LUFDvYwAF4+f3M4Mes1ZvV+aErudNwuZ146OBwn5rl6aStjbQzY4ew= X-MS-TrafficTypeDiagnostic: VI1PR0801MB1998: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1998; 20:CpvIj/l5pW0X7n947UReqzlM6R9eFX1KU2/mDt3dMgcfoJ8Xyyp77InzDCaF5fh5t88QyADuWz3iZq3AYEQmsDsSYUVyw97UeCCkFIV9wtmo3Wj14DWy/YZUkDpx35ekvlRaGzh668WxOYkOH30rYD3VkTyrJrn7ea04nRa7ilafWzlgrVTiu2VeTdEVQiTeaBKgI6kiMCQPC9lCQoUJcecUv4aW67hCARsNVNxNAdY4dHHk89ZajQnqj3wBDRCfXdHni1BhabBO2tdlXRRxROHmLeMRjAF0aCSkaCYaPCGdaBBaKvCvbjjYRNaZfal3lQ0TVSa1TGyf9OO8oQhP1IahSR8+9kF88gsUXM8IurZWf4/5HTfhHrNSegWX1xf9duSPyGbUaPprBWW2rYe8M/UD3wL/U0NVxi8q37pJZSg=; 4:kkhF0w1F2C6o1W7ohe1wrJRm4co21zg4HfoBsmsRZdsS4ba0Vb+WcSb7nnyWbbSXueHbMtK4YfyKHiEclFiILUf79VsuK7cPRBkZjKZ1gOSxWvW9bNpHxgA9+9+hA74KFNd/YoKeXaMNbtK6m3C1cSEMyEddGUaYSylZvNg1rm2qQFKBVJft4ZYPPmSDgGJTBW279uogLn8YZk5Pnbv9UorQBsy8hC1fekIbHHQFVOuM6lMvYEJZEOCpOK6vouQkOuBl1iTQC+W6T4IFTZwWyA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(3231022)(93006095)(93001095)(3002001)(10201501046)(6041248)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(20161123562025)(6072148)(201708071742011); SRVR:VI1PR0801MB1998; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR0801MB1998; X-Forefront-PRVS: 0515208626 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400002)(346002)(376002)(366004)(189003)(199004)(50466002)(47776003)(69596002)(3846002)(25786009)(55236003)(97736004)(36756003)(16526018)(51416003)(6116002)(478600001)(6512007)(48376002)(76176011)(6486002)(52116002)(16586007)(316002)(6506006)(2950100002)(305945005)(5660300001)(68736007)(8676002)(7736002)(107886003)(50226002)(86362001)(6916009)(575784001)(2361001)(2351001)(4326008)(81156014)(53416004)(2906002)(53936002)(6666003)(105586002)(8936002)(66066001)(81166006)(33646002)(106356001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1998; H:xantnef-ws.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; VI1PR0801MB1998; 23:ggZiZwYAiwxOWgy5o53TqjpJD4jkGdvhXRh8N75?= =?us-ascii?Q?bjeHJxKhcP9nTjyxhU5YehRt5uwvcLq3HFWCmvWnxdzLW+eLVFtZ8QC7CAtu?= =?us-ascii?Q?EwbTW9buwEPnfklAzIaZPJFOTgbsMqeikLArDDyJxvt63u+ONwZMCNmuVrPi?= =?us-ascii?Q?7esm6MdT3gkY2xIY5Rbqv+3MMildFTgIPcih7aL/TxyDMCQU1uq2CoOVXHaf?= =?us-ascii?Q?x+UzK/a353AAK0et3qiyljihI7rYuBDJU75EwUztYg3MpiWqSGfo/8fnaF57?= =?us-ascii?Q?pPJPayZfdJLuOvxEkJGSF3ewm0jsaIthKhg4ZNkpCbvetxa2YdmYNJPvH9JU?= =?us-ascii?Q?uodLtbV4eyK70R8whbehX6fk8xEGI7EnpwrQV0cOGogn62WRIt6HmdO8xtgH?= =?us-ascii?Q?sq+pv/emxsXom19DD3xrf5t0xnqfQ4JnanD5Bz+DGzwkxR10rEv1IeXQi8IY?= =?us-ascii?Q?qpMkhzrqePNidUdjIpkjR0+X9ax7EzgALkyFocz8F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4HskcWMTsirnbVucKOL4NJFsnlwyR7PabFuuJ3e4hkvG1SzsKp6fwuo/TJn0eFkD45OUtrRnBZQ8BuWdr+oyVZVKclgWJjCLaAWs9VNNp8HfSy1SKQJwq0YDmPdDoUhbuH14NtGXhqWM3O/DPWnror0cwkbynlCBhRzxlWdtMt6qS+s7zl1xOHaiZbc1xO203ovp54=; 5:dDUVzv2rIATTKNnUUVthNIiwVLD+teo0uSZ8W4ymgU6NOl3Er3qioohQ03+AMuEdDHRHUVVK8dsUhiGr8q5pvLnCjxagUW+50wvSkV7OnieI/VWHkYoTjw6+KDoX1xh8z2K12rVTXAd2zCGQeCTEy1Y7FLnV+JM17KEm/sAXfMI=; 24:ogr/b4eKoW0EFPeYw/RHyoZwoM4MvOfRN90RYzxMQYuuabJp+F5bs8M0nosRayzOPVS08hMb18ILlHnbGrA1jfG60V9WWPgWO5/f81/0CL4=; 7:w1Vu9DOYxhHW1VkOAoUL4q2TshgiSAjB6hE4+GMZi4odFSfOgS+OhjlBdEAg5Pql67+/HlWArx4lpqzjKW0Va9wYBHl1FaIkJtzd8k0ol0AVteS+YZpoLD/Xov2bi8WdEpk4NBd/j0HVENGCaclMpd/ekZh2OdPNZfJLyjpTEiJY0tush4nfoxFLp3iGyLVpBWWmFeG/W0r9DwOdXWQNdwp0lCzR9ctGSXwSFVKwOzjRmYIqKfHq0Pm1zx2ycw7w SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1998; 20:KhqvNMS4aIuIzgXQpJwV1+9yfDRlXKqEnWmmqBs796AOVOSSrVx2kEnBTbdXVj880sp+knZ4jbVTL6l2KODBYu+GUjqxveUfL9RarPHBhSwzjS6x9nYMu2h319MFVzNu94cWoRcyYPVlfPBQl3WHu+FUf9D/i6X3gy0pIdGsg9g= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2017 12:11:42.3300 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e8259669-26c3-4c3f-a7f2-08d53e34d811 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1998 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.0.126 Subject: [Qemu-devel] [PATCH 1/3] 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: Anton Nefedov , jsnow@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP It will be needed to handle invalid requests Signed-off-by: Anton Nefedov --- 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 471d0c9..02a6b2c 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -383,7 +383,7 @@ static void ide_set_signature(IDEState *s) typedef struct TrimAIOCB { BlockAIOCB common; - BlockBackend *blk; + IDEState *s; QEMUBH *bh; int ret; QEMUIOVector *qiov; @@ -426,6 +426,8 @@ static void ide_trim_bh_cb(void *opaque) static void ide_issue_trim_cb(void *opaque, int ret) { TrimAIOCB *iocb = opaque; + IDEState *s = iocb->s; + if (ret >= 0) { while (iocb->j < iocb->qiov->niov) { int j = iocb->j; @@ -443,7 +445,7 @@ static void ide_issue_trim_cb(void *opaque, int ret) } /* Got an entry! Submit and exit. */ - iocb->aiocb = blk_aio_pdiscard(iocb->blk, + iocb->aiocb = blk_aio_pdiscard(s->blk, sector << BDRV_SECTOR_BITS, count << BDRV_SECTOR_BITS, ide_issue_trim_cb, opaque); @@ -467,11 +469,11 @@ BlockAIOCB *ide_issue_trim( int64_t offset, QEMUIOVector *qiov, BlockCompletionFunc *cb, void *cb_opaque, void *opaque) { - BlockBackend *blk = opaque; + IDEState *s = opaque; TrimAIOCB *iocb; - iocb = blk_aio_get(&trim_aiocb_info, blk, cb, cb_opaque); - iocb->blk = blk; + iocb = blk_aio_get(&trim_aiocb_info, s->blk, cb, cb_opaque); + iocb->s = s; iocb->bh = qemu_bh_new(ide_trim_bh_cb, iocb); iocb->ret = 0; iocb->qiov = qiov; @@ -901,7 +903,7 @@ static void ide_dma_cb(void *opaque, int ret) case IDE_DMA_TRIM: s->bus->dma->aiocb = 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: