From patchwork Tue Aug 21 09:46:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10571301 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8421017E0 for ; Tue, 21 Aug 2018 09:54:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7349929D50 for ; Tue, 21 Aug 2018 09:54:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66E7A29D5B; Tue, 21 Aug 2018 09:54:03 +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=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,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 F2F4D29D56 for ; Tue, 21 Aug 2018 09:54:02 +0000 (UTC) Received: from localhost ([::1]:52009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3MQ-0002G8-7q for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Aug 2018 05:54:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3FW-0003t2-9a for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs3FS-0007ya-0N for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:54 -0400 Received: from mail-eopbgr40139.outbound.protection.outlook.com ([40.107.4.139]:61210 helo=EUR03-DB5-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 1fs3FR-0007xB-KK; Tue, 21 Aug 2018 05:46:49 -0400 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:X-MS-Exchange-SenderADCheck; bh=za7pgJpKccaHDb0Z5jtn1/vb5HiwwuKkPXx4Tot31DI=; b=ZRsTt8xtU4NrjLEYgQDBTNlUw/Dt6KyPPZ4owuCoBa1qQtMz93jk76VO6UbVVMithe6G4oEBAcPckcU3PyeZ0JdBmaUTFPuTC2U7CTKkbimBpCVacRYCP87cYSngab4w27DCBEZXHQw29EIi1ZgOe3RrkTezz7Na/BQ/fxBfEfg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (185.231.240.5) by AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.22; Tue, 21 Aug 2018 09:46:46 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 12:46:15 +0300 Message-Id: <1534844779-118784-5-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR08CA0076.eurprd08.prod.outlook.com (2603:10a6:7:2a::47) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a248cbe9-483d-4280-385c-08d6074b032a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3347; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 3:Iyf/u+03sjmm9twh+9TZftLLq1PMQrJkhe4reJD+Axg5xqmW8wSQA2EPwWaUmMO7NV7k+MMclXGtFjjJkVfOxVd51LNgHkAvqxMRjmy75r9/jt2dgvgTmVcIHQptzRNtCqYdj00/TFxVYBnpB42f/XKrEu86FsLm41t9Xk+CjY28bfyCXBndwoC4dzQEYaQyKB7+MzdQQCqdtN3zkeoREZPa60089JVkH1bWBYTxVsoK5kkKMvvv8gNCFoqlzCxw; 25:ZPc0vB7Cxns5RDe30lXwj9Sgkcwd6kqhzxLPslSa/KUgfQ7IeBXOX7dXsfmT8KbUgf+fdUELmAkBudlQEf/jOx2snvAJzKwd/4nuhJ3zxbRWeote1Xm3S+AcaxnLXnwOrFqP8fjiofKL/BWaMZdWs+xszGwa6Qxe56mt4vNn1+52cEePLurpzv6nWBl02+2Tc3K7B1A7O2HJp7Gd3pulfnyA0zicy0oyjT5+lncoTnwPbvLdJeGXxkA0W/PXPuabNDrza+sKbuhJMDaERXPFz7QWk20j2b2f1uPwCnRF8RYP3NjNFY07H3+kGS/+MGkk3ZvH5BCLbEwvi8pwUy5Nrg==; 31:BPWBL85jRhMGZ0+dKuzDe4RGh7oeCSDKbX+sgEqfQ7WfgIhtY18tlDKyZvUmH+dn4jpAGGp5S1XrC8WIhqZcAVB2HOzrPAH7JQHxaxbC4nryYxyhAdPEhcybICp/F2eXCdIFAHHJVuHfjs1BD4FyKIFKOrdFwtdK0L0tYVZIwe1w0667b3YgQddd9XerOVABDS4rXXo/B4yOOAwTQy9ExtNFolWQlTRN7QELc74X7Nc= X-MS-TrafficTypeDiagnostic: AM0PR08MB3347: X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:yiaTTLdF3a9OqfiP8APwcBDfO7wNhxn29lKGCXU+Htj0TkOHZ71qCygPHyoUVjMhVK9qr1LB6rE8cj7y2ftN0bZE8i+HnrB5G2iuBEWujkA30h2lV0Z9qwYK69ymSuRpWCNJ6sLGSNI79NEql6WtX/yECUB+YOCqlSaka9w10m3nyAOKBl3Xic6/W/Eo4B3pOZ3k+b0svIpmg11+axtRC0auD/1rnrtcDJk5SRTVLzr7UwBew8Wp0i3itneeiroBtUAChPJuOrC/irnNniefM+9xrJY7ad0jwl0X7tJ3dgMQK8I0wKnBWoXFDYAaRgzAbYxFBE92HPXl67y1hprh5OeknsVxqzWlmR3g9qgusmHRZsvIreVM+5IJF7H3dk3OrhLnLupitRw9rBcIVw4U8hdP85aADeg+CzXtNEdhkJvwFKE9bOB5lLv3uG277iSOfTmFfjwjqRUqhFj68fz4fgHjVS4+M9boHFqE/PVY3flzw4t+t4z2wmZreecnI0Ea; 4:AyXgh8OAhcW1dRDI4Z3hfh7sNhyoKzXLmpEmoFu82yeUXdIceMInSOliRaiKRyv22xDVkprjxpTOnAvyygmvHg1QBgsH7u+QK6xUTkyA2BlmvuLmv9nc8tyos/ZqHld96zlj7kgutw4pwMOVU3S+zyormy0oE0q15EfvwPV5shapk2QOiRvckdHSxW89Q6q/n5FA+88Nsg6Jb3SM+BeuWOoC3JJ9OIJUdcsfCL7MPnAL3yBK7gbwTilTKvdCUBY7GHHC3aGlEDR/Lx2FWCelyQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201708071742011)(7699016); SRVR:AM0PR08MB3347; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3347; X-Forefront-PRVS: 0771670921 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(396003)(376002)(366004)(346002)(199004)(189003)(36756003)(305945005)(53416004)(105586002)(51416003)(48376002)(50226002)(8936002)(6116002)(7736002)(956004)(3846002)(69596002)(50466002)(68736007)(186003)(106356001)(2616005)(16526019)(16586007)(47776003)(486006)(476003)(52116002)(446003)(66066001)(86362001)(107886003)(76176011)(2351001)(4326008)(316002)(5660300001)(25786009)(53936002)(478600001)(2361001)(6506007)(386003)(2906002)(6916009)(6486002)(6512007)(81156014)(81166006)(97736004)(6666003)(11346002)(8676002)(26005)(7416002)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3347; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3347; 23:NklrFhYWDACXKfyCT/AM/hwnIl1SN0DKSHS27Dv6w?= TmJbNTwFwGzmvmas7Qu8Nj0aoiaJRSF10+N3dG9E8p8XfS429gmevgwjTpbiyaGa2sJgK9zFLgGf7syKfuW1DAciS5R0cfqvJrczpl1+eBN6QbfHRNrV2f07Mv7MREeKirAC97Chfbzdx/1bYSiK6wfYAiaAD7uyWNU/B/+AZJIydofnWcFbKBcKtjdiLNtm0xJFdRsulbazMVjd4Qqs1MAmbavO+CC1bX4s8zO7FG5FwqU7GpDojQrToP7Wov8dvnjE6V7gdxb4tn+8ILZg8bV9pUapPGHkxTN8llk4LNM4rLgekiR4f6zvJA2HcO7aE4jVuhNMI2Pog2vxhyn1lBcs14RsB2C0/bzKAqDyGRoCPXdaRtKIIJz/rvRK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ZXHwtJROdXPTfg7yTgGcYhIuAyXzPOwBeB7+6u72VMNubukLAPQk2QMLCAPAc9vWcokHWsd7sISgKqocTcClK7Pk SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:vORTpsjvFpLNCngTab+pRIqlJNzyK+ZkFR17/T0wZod5lzrjvPM9zHFzXfKSlBnKOkvglG0Wx5SXlbpA0FL1o9g2X8nMaxA7rpzH6zyfC1UaL5oNNup/9BBn73Eo87yQQVD1XFPyDU3QtfWpiu1oNKuU1/w784csY7xaQUPLORc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2018 09:46:46.5606 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a248cbe9-483d-4280-385c-08d6074b032a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3347 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.4.139 Subject: [Qemu-devel] [PATCH v4 4/8] 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 , famz@redhat.com, den@virtuozzo.com, qemu-block@nongnu.org, armbru@redhat.com, mreitz@redhat.com, berto@igalia.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 5ae7baa..d41eea1 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1653,8 +1653,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)) { @@ -1662,16 +1660,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;