From patchwork Mon Nov 20 16:51:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10066773 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 DC8C2603FA for ; Mon, 20 Nov 2017 16:58:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE7A529407 for ; Mon, 20 Nov 2017 16:58:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C30A329442; Mon, 20 Nov 2017 16:58:01 +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 36C7629407 for ; Mon, 20 Nov 2017 16:58:01 +0000 (UTC) Received: from localhost ([::1]:58268 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGpOS-0000Wl-GQ for patchwork-qemu-devel@patchwork.kernel.org; Mon, 20 Nov 2017 11:58:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGpI5-0002gl-UG for qemu-devel@nongnu.org; Mon, 20 Nov 2017 11:51:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGpI1-0003qT-Da for qemu-devel@nongnu.org; Mon, 20 Nov 2017 11:51:26 -0500 Received: from mail-eopbgr20123.outbound.protection.outlook.com ([40.107.2.123]:50533 helo=EUR02-VE1-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 1eGpI1-0003qB-1t; Mon, 20 Nov 2017 11:51:21 -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=6aBeib1e8HDd3HFvtF/+XW70A1mwvg56qRQ9ZyI5WmU=; b=InFBo08UHApkR1rNOUKQTgXHQoaez+WE/HvCbCd+BoVd3I2mVLfogW1cT18Cj4zxbnnltf1msJ11p394LBXOZSj1aRGDlLuo5dmt/6TjBOa9WJ8LNiyMTdoi7J72iqT0149wXrbBrPB1ptAZq8nFF4geMwgDGNIrw7NuYWjnWj0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by AM5PR0801MB1988.eurprd08.prod.outlook.com (2603:10a6:203:4b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Mon, 20 Nov 2017 16:51:18 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Mon, 20 Nov 2017 19:51:00 +0300 Message-Id: <1511196664-85304-4-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511196664-85304-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1511196664-85304-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0202CA0042.eurprd02.prod.outlook.com (2603:10a6:3:e4::28) To AM5PR0801MB1988.eurprd08.prod.outlook.com (2603:10a6:203:4b::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1a72a0c1-c03c-4b09-7dce-08d53036ec18 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(2017052603258); SRVR:AM5PR0801MB1988; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1988; 3:zZtUZw8pnhsZEqF6ZCr2kb82dlbflkdwx7BeNNX5qgYDkNFBT+jVvaiKxmnDV8vp1UCP+ItGpkLUmGpR/8vIUlbGvq0ZdGmCJWm9ZEZ2cW2nFmGvqJtErtWRGQiWj2EyOW2H0FEpBCCLdzKKa5d1+h60rNNAoTpwqjopEENTKzEl5SnArqKG+8IwfpmulPluNzjA+iNra4phQtg4BjDmB7V+9vdaN7AxVke4W9cYW3NqtRgEQqKRhEzPFEf0qDDr; 25:v8UudVn6terRH2AqzEJN3sncm07vtIbLfqCovWyn6VEvwJgwPYoE5fWG+lXx0wJOJD9WxXLYuO6T9w2sbKi3HayHkCwvLCvFge/EUV1/9b/0KJRcLYF1OlkMxr8OjBoPrm088CupFY49v63XKbmL9YntAQyW8+0bCgfcvY9lC4kNapW84tjkWY1tyMbxtVdhSvAkZGA7fPOofDz77hPOJ0adpP5yZSF9Z60EZRS3d4+qcQ9yYmG07qFep+Pn2xNpu4rgwSKOZW8cF1vt790HFqnlFV0qbdHXJrq5JwmB6o+fVluHU0QZ5hTJ4XjbWSl4Pse+MMbv5T1lFQUswZE9sw==; 31:dW77g4qCv7g6I8VEAvxl5D0L+8j9jeIIQp+SQ2y/xq5fgs3LljCVvs6GrIkdB+v5cpGYs8bx9fWiikSGu4J15lJKGT3OfFJ0CvxgVahdZ/hRJT+Px5S9ediK32U2SlKUDkWoLXBtEcTM5TrHhSvPbUR6SavHIIOmWwCme3q+xzG/Xyno4boEVXUr3G1omo31XMnrFNAimDmTSItzyPGBXMZcdFAW/nSefvLbW5pk/KA= X-MS-TrafficTypeDiagnostic: AM5PR0801MB1988: X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1988; 20:NzrBCD8WbN9YmcOeoQDG2vsYRGALedvh0MB0F7cxIGcbqTpXEtLBMf6zY1wtjdLcvFYHETBLR6lIuWUGZn1LPeFHvdNrILMS34XlO4EO/TxtJXt+iQkbP2lTHCcpO5t3m7bUWQazY/ScIlGDjhSVw4KCdApH5xNLEl2AqP1+YsxwW61br+aswavgRzkRENFTxy6Vmg8Rzbi0EI10Vmev0LeeggQjVKkAileHjH1V+L9QqZdUCo176gyPhnwBwmyqXliQcDQx8cSvWDivvbjkD35CNb4wZoFvNE6GEGczKgLkL6GHTuk0Ax0Syuh3+UwIMKlNapD4z65eihO67U4whB0/bkDFzdW4xzDPmCTbTaw1uKwoa6XMYkngNvTuGeqz3uTnm9vOkUY2Gm3OGW0bFApLj8sxQqemNKfmOLXM084=; 4:KboiKv/vA2njOHj2ABtcT8sJoj1YCqmOSc85k0Do2rO4hnBDEuHCZFISa5dUkuOQ0q7dGWdbsMn1JCJIPNsDOqzKv0WLQ3kLdMz3NI9TIAr10L1C8mizbHrbfMjszDWSz6L6gUvSRo/zVffGmfx3upBD4v6mWsm54BalDAPQBjHssLYcMtuc4r2/PrA0LXR+Kzh/5xyiGZiEn0vOOs/UuYgLDf1qdgMhjeQjzTKq/MW6qi+Iryg6wHcDiF3fogWdI2Djiqs9lVP/yQCkSXT0Pw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(3231022)(6041248)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM5PR0801MB1988; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM5PR0801MB1988; X-Forefront-PRVS: 04976078F0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(376002)(346002)(189002)(199003)(6506006)(6486002)(25786009)(189998001)(6512007)(16586007)(86362001)(50226002)(478600001)(316002)(68736007)(8936002)(69596002)(16526018)(50986999)(55236003)(76176999)(47776003)(5003940100001)(48376002)(50466002)(7736002)(305945005)(106356001)(101416001)(105586002)(66066001)(2906002)(3846002)(2950100002)(6666003)(53416004)(97736004)(5660300001)(107886003)(8676002)(81166006)(6116002)(33646002)(4326008)(81156014)(36756003)(53936002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0801MB1988; 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; AM5PR0801MB1988; 23:Y/gd6s28cS3++vHf3hkQ8o6pqL3btAmTdOKNTrH?= =?us-ascii?Q?2WOubspAk8yQkWWR9Gd94AzWHy8nYbkIJowIKOEGi5Gh95GsoGFo0PIko6fO?= =?us-ascii?Q?y7D4l/By+6k4RimTkUlnZDw8nloc59tn5/Vo1FbpwbaziaXcC5bOQ41b4wz/?= =?us-ascii?Q?Qpu9BbebYqMAgO6mZ2iEQtKukP6GX0OCDDX6l00tIMnG5K1bBcgSsh4hOMwf?= =?us-ascii?Q?jFYpVWARz1SDu7muAR89GoiKeWtKvbHNCZ7MPimKSEZruSyXKuS1kGP+ffzS?= =?us-ascii?Q?ZWuienqRRYffHZtXO0LyCC61flk1hex6yhO4y5el/eAYKXr89dFrRZhah8l8?= =?us-ascii?Q?9J0QKjcdU1ek3v7Qfd8bGYMsMVundPnBnCValogKWmCI+1kXDJR1d9xDavyB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FLuKNgQthTRAZiGKLYvC2WHoZdTIxtIKMYbOwFc/yGrCfj9cLWJ9zLNJKBGnCBIRDisP7Hb3guG7Y8yNtJyaAOd8k1tRNKlXAyFupyh89U8D9vPkArJ9q3VQjTRRPCAv54MgBjlTMlR1FcEGc1Hv1vW9KA88ix/AuXYV1bywTBlA9TZp1TNO43Al3K572wz1k2uHPwlwrx5a3D3M5XttatCagReZJx3GqfHMHsAi5yPBr2etgBICnxTpAY4=; 5:O1VqIZlABr5jtQHLeOjT3sCCB9OHzdh03uURRpXEoqJoYimmpoG3MfJSnGZjuTUcIRqWgjLbUVDgrH5up9sXSkEdlWb9SUqDoPEapFBX5VPX9aF7u6enkvEARGifzpGH+RuboCwQt2g+bm8tOBHbZVWizwu3YPOPtRk4fURnt9g=; 24:FH5bUaRIOm10P6XhUvTTzzafLmpdl5ApVz9WCDIbGQHF4xTwTV4dzBw5m2woWwbV3f5orCjhDfKlLocRqZimHYZX37RWnGQaKtYnbq2r69U=; 7:LloBxKvETsaStLIKNC5qp1KrU0bC7DRQnwxFI+b0iSTcOPkITeX5JSphZ8vRNDCggV6tDwhqgB5eV1IxYmUX1cYIfM+nqI1L8Dl1kH0Uc4+Yd9svESORwc26ikvywpFMt0UEYaDigyDdh/2tVjVIimEzWERTr86cVKjqj3hD56UhGBfhI5QSXcM2QbSbz0qNDQ+HqCju06qgWeGIw4FKz+DvHNdYRD3YLAcx2tBoERELKUtGDKGk13XBRrmq6qf2 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1988; 20:wvQmaLG3BDlCtt3Q5TdxFGue83SPHWlpcBpvJuDI3eTVTuHeYlEuTVsV5SIW3pqFGxBokBgerAgGAAMQU3Ffc+QJkxErA03DeZrxNHKw6pwDe66XIgGgXB3+xTj7tXox2FA8qp1SwuyG+9ZlJkB2mBzWLvzRaZuVgFcJaj/fQ88= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2017 16:51:18.3157 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a72a0c1-c03c-4b09-7dce-08d53036ec18 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1988 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.2.123 Subject: [Qemu-devel] [PATCH 3/7] scsi: store unmap offset and nb_sectors in request struct 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, Anton Nefedov , den@virtuozzo.com, armbru@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP it allows to report it in the error handler Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- hw/scsi/scsi-disk.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 1243117..3882052 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1625,8 +1625,6 @@ static void scsi_unmap_complete_noio(UnmapCBData *data, int ret) { SCSIDiskReq *r = data->r; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); - uint64_t sector_num; - uint32_t nb_sectors; assert(r->req.aiocb == NULL); if (scsi_disk_req_check_error(r, ret, false)) { @@ -1634,16 +1632,16 @@ static void scsi_unmap_complete_noio(UnmapCBData *data, int ret) } if (data->count > 0) { - sector_num = ldq_be_p(&data->inbuf[0]); - nb_sectors = ldl_be_p(&data->inbuf[8]) & 0xffffffffULL; - if (!check_lba_range(s, sector_num, nb_sectors)) { + r->sector = ldq_be_p(&data->inbuf[0]); + r->sector_count = ldl_be_p(&data->inbuf[8]) & 0xffffffffULL; + if (!check_lba_range(s, r->sector, r->sector_count)) { scsi_check_condition(r, SENSE_CODE(LBA_OUT_OF_RANGE)); goto done; } r->req.aiocb = blk_aio_pdiscard(s->qdev.conf.blk, - sector_num * s->qdev.blocksize, - nb_sectors * s->qdev.blocksize, + r->sector * s->qdev.blocksize, + r->sector_count * s->qdev.blocksize, scsi_unmap_complete, data); data->count--; data->inbuf += 16;