From patchwork Fri Nov 30 14:47:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10706465 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 EA6AC13BB for ; Fri, 30 Nov 2018 14:52:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB9BB301C8 for ; Fri, 30 Nov 2018 14:52:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFBA1301C2; Fri, 30 Nov 2018 14:52:40 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 3D3DC301C6 for ; Fri, 30 Nov 2018 14:52:40 +0000 (UTC) Received: from localhost ([::1]:60540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSk9m-0002CF-SD for patchwork-qemu-devel@patchwork.kernel.org; Fri, 30 Nov 2018 09:52:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSk4q-0005O6-LL for qemu-devel@nongnu.org; Fri, 30 Nov 2018 09:47:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSk4l-00041K-RM for qemu-devel@nongnu.org; Fri, 30 Nov 2018 09:47:32 -0500 Received: from mail-eopbgr10122.outbound.protection.outlook.com ([40.107.1.122]:9818 helo=EUR02-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 1gSk4l-00040d-Fu; Fri, 30 Nov 2018 09:47:27 -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:X-MS-Exchange-SenderADCheck; bh=DkOqU1DyDlHK6JW4A6sk8maRkyy/ocl+4g4LyztTaxg=; b=ClgrVHXPAfxrvI48XxeKKg7YT3BNSp3a08bYWXaTUjdA/QSyBpwnxWj3qy9dwQT6b+VJQUu3iGLprq18lGM+SUlon3C+gvUDtOxord6tgkUFVsY7OOT3AuhemSZI2dCrLlp/auJ+auF8XhCWwFhkdIMDHsoS0KAcyhfBMxr+t8E= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB3410.eurprd08.prod.outlook.com (20.177.109.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1361.16; Fri, 30 Nov 2018 14:47:22 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01%2]) with mapi id 15.20.1361.022; Fri, 30 Nov 2018 14:47:22 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v6 5/9] scsi: store unmap offset and nb_sectors in request struct Thread-Index: AQHUiLuaYuu4HwBWN0SSc8Rqxnbjyw== Date: Fri, 30 Nov 2018 14:47:22 +0000 Message-ID: <20181130144705.77454-6-anton.nefedov@virtuozzo.com> References: <20181130144705.77454-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181130144705.77454-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR05CA0208.eurprd05.prod.outlook.com (2603:10a6:3:f9::32) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB3410; 20:0+fND0ifs8ecy8z6placOn7Ei+/HYzxALhAGkuAIhA4EkvHmN8sumlQF4DmdyCLr3zvUa1KgpOizlSi4neIXfcwSsv8+TDaWvlmHsSEppD9n0NfxY9Zsl+6oQDVXozAZ8S0xgPoNHsuKcyqYmGz7WZVCYBV72J24pD/HhBJwE/c= x-ms-office365-filtering-correlation-id: 427dd198-b452-4e86-8d81-08d656d2bc7f x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3410; x-ms-traffictypediagnostic: AM0PR08MB3410: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(3231453)(999002)(944501410)(52105112)(10201501046)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB3410; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3410; x-forefront-prvs: 087223B4DA x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39850400004)(366004)(396003)(346002)(136003)(376002)(189003)(199004)(1076002)(66066001)(52116002)(106356001)(6116002)(3846002)(7416002)(26005)(105586002)(25786009)(256004)(102836004)(2351001)(386003)(186003)(97736004)(99286004)(76176011)(5660300001)(36756003)(6506007)(14454004)(44832011)(2906002)(6436002)(5640700003)(6512007)(6486002)(478600001)(8936002)(68736007)(8676002)(7736002)(2501003)(81166006)(446003)(486006)(11346002)(305945005)(2616005)(81156014)(107886003)(476003)(53936002)(6916009)(4326008)(54906003)(316002)(86362001)(71190400001)(71200400001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3410; H:AM0PR08MB3347.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 6sXNi4eW7AcCbjaZsqwLYiPolia8YVM1yOXk5Uv5M8UujITUI6G2PmCYWDs6c5Uwuyx5/Y14rEaHrCtZa7PobQAguD4srS5eFuu2xd8KhNc5oW1CcMdpcfWiTDEbQUZU3p3m6F/9LWQI1F0EXrwIVi65I857RK/3im5LWHfTEo7QVWtgWElaMb5vEk8H6uS+NeP3fYLN7gbXtqBclUOtSIKJr5BC1expKo0QRlGOHCteMeizVDnLeObNAqpWxnEhB39Fq2iCi/RViUY2ZA1Jpo1q+McQf4N9CE/vU4MRz3aYhnWISAzjfaVYhDtF+t4kkYNgMSh7cLYkrVU1eygcL5zbBWJ/LWYjPl0aVcwKNKk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 427dd198-b452-4e86-8d81-08d656d2bc7f X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2018 14:47:22.7252 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3410 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.1.122 Subject: [Qemu-devel] [PATCH v6 5/9] 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" , Vladimir Sementsov-Ogievskiy , "famz@redhat.com" , Denis Lunev , "qemu-block@nongnu.org" , "armbru@redhat.com" , "mreitz@redhat.com" , "berto@igalia.com" , Anton Nefedov , "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 0e9027c8f3..b1133e6293 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1604,8 +1604,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)) { @@ -1613,16 +1611,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;