From patchwork Wed Apr 20 04:10:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12819722 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FFC5C433F5 for ; Wed, 20 Apr 2022 04:11:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241161AbiDTEOH (ORCPT ); Wed, 20 Apr 2022 00:14:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbiDTEOG (ORCPT ); Wed, 20 Apr 2022 00:14:06 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2076.outbound.protection.outlook.com [40.107.100.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A400167E8 for ; Tue, 19 Apr 2022 21:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S5o1z5GeAor0ho7nk/9i4fMMQjElA+kL2PfRu4LNdaoHTP0eh1W+MseG6E/aR3FDsKBUyUZLG1ivudOX6RzNA8kxlaG68iC8a5b8zWRgO3p/rHfpLRsQNCmdYwD7Tdzc5batpXWr+eilEe/CNWfKZjbq9GXAvad2n5Ei6ly9MXvcRkMmSZ1ZzgMDBEinzSlPhqje8vPAJ01ivEvyYQFpoo/4rFqP8Zp7gdYJg+gsf+2WKBI8hkhAAJsm9lopbC/CLUInqGMasg8V/8sV0uO7HOPXSc98SamXiA5TQylY0FnEA54063VCE7Zid8SAGLeBodwFGi8VkzvIgYTmpkZ5lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Sf2OpQbVTQ8RZLwUAVXaE9Kt6IaF45WsAt/7cpPJfl4=; b=HJ5an3ox8MfMyAFGdMO2EKExoM2ZfzcXU3LN1iKvPaam+mjs+vBdpfm8weOdCadlErW04c8EZ/IIioB5/HFMA5LlgsYBWR6pn0mGxBGYwzdtxMQQAfZr8WdReJOIPQbynLWNMFOtRLPFodTM4B5wclu8E6C1aH7ziIfjrtfBa3Y3V352FOZOSL25euom6Y34pQo0bmoP2r04Uyn+TZt9TnS5OCtRSOo1UGkSQPPvnpDYWFLoDNPHbZuRyo1A3upnjb/rCkZ9tgHrwDXblpy7eUfx3t9y4FGeLfInAD6x6AiyTSqBO7OiyxWcCFIHGOtF5HgDAP09BGVuvO8AvtE2tA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Sf2OpQbVTQ8RZLwUAVXaE9Kt6IaF45WsAt/7cpPJfl4=; b=pQ28YKMxrY0jTpLLc5+0xlkb/TE2y6mUYR1pIZUadE9xURo1p2mO/JAINCsna9VJcqh80qMvcmBXQV1ybAfjYJnWTRFjD3J0S8bVBlz684p06QRT9jGLexY4KM9Wi/CM2tEnNPZS8pE6Rxb/k4q4tWjqNEmz9eRh+mBzHwtvxVEmVisYn7fcMSFnWthpk5TEhzFaeemERQ7oFz29dz0KjmxMcH7FAxpd0azW3V9/E1SBPtZDqpvCkrl29Ss2N28kuSuxJWZfcDiZVqnvt8ADMHY7oC6d6/0decSZvYf7tiJUl0Lh6dOJRqiW4C9w3wSiZ3yEoagpYOZUuAvztJqIyA== Received: from MW4PR02CA0015.namprd02.prod.outlook.com (2603:10b6:303:16d::6) by CH2PR12MB4277.namprd12.prod.outlook.com (2603:10b6:610:ae::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Wed, 20 Apr 2022 04:11:19 +0000 Received: from CO1NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:303:16d:cafe::a3) by MW4PR02CA0015.outlook.office365.com (2603:10b6:303:16d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Wed, 20 Apr 2022 04:11:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by CO1NAM11FT067.mail.protection.outlook.com (10.13.174.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5186.14 via Frontend Transport; Wed, 20 Apr 2022 04:11:18 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 20 Apr 2022 04:11:11 +0000 Received: from dev.nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 19 Apr 2022 21:11:10 -0700 From: Chaitanya Kulkarni To: , , , CC: , , Chaitanya Kulkarni Subject: [PATCH 1/4] virtio-blk: remove additional check in fast path Date: Tue, 19 Apr 2022 21:10:50 -0700 Message-ID: <20220420041053.7927-2-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20220420041053.7927-1-kch@nvidia.com> References: <20220420041053.7927-1-kch@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c8e791b8-a9d1-4343-34c5-08da2283d20b X-MS-TrafficTypeDiagnostic: CH2PR12MB4277:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 97G4+Nv2o2ETXyryL43avsbtJbsj/rn1JwT9BfCgwhXvq9Crn+euBbp/mYFL9y/m6NyxZPpkMGYdKOMBgpR7yPwL4m799zERkhVaFC4CuzwQbFGTFWpLoiHmUDnNKs6Iv4Ozv7cae1BqiMZ4W1MqDmrgaxopGtxM4Gtqfm6xrNwxq6H2SQyPwUd8vTl6nBo4TZw3fGQqTgcJlC5ERYPBoX1EEVJrv44AwyVsiA6oU/VBIkaFxxSosLhDqaa0mE/GikzA67K+HF0yW4ch7TYOVd0WA3RZIN+sAdstAJc9izoV/gX/eMmrGEgxbrv3tFzq20ZhL4J2xTDIrMqGZYbUmO3XorPKcghid28LLbr94bovJ4KqA/b3Xt/eQp2aDNngS+BKm8z5d++AuIJ3PTMSEFqPAIX0x0gnmC5HXBJg42Wn22dJ2lHuUiwlk8VjbS6MSOn7BSdeBU/oDGfyPNgrjsKUFqLxkeyfEzJblxYXLhj4iQKK7kitqv4dKmdnZ9reAFOejBEJPYREipD5zzbDFQUZI9tXJfwGgpPtVtImG+3FHq6R1t+/G6/tX/kL1z5Wu1LR9YuFAdMyy/kX/Hdo8P8w3RJrlcSIayBFD0g7B11XeCmE3I+TWjGc1dug1x+M6Sd+p1eFYzAlcedMWsbybP401Wj6aGMwsVRnzIXl09rII0/xYAZwlDVFR/7W0Axb1mAgKJsefMNu5Vapn07UDg== X-Forefront-Antispam-Report: CIP:12.22.5.234;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(36756003)(110136005)(54906003)(1076003)(70206006)(82310400005)(508600001)(70586007)(40460700003)(316002)(4326008)(81166007)(5660300002)(47076005)(356005)(336012)(36860700001)(426003)(83380400001)(186003)(16526019)(8676002)(107886003)(26005)(8936002)(6666004)(7696005)(2906002)(2616005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2022 04:11:18.5106 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8e791b8-a9d1-4343-34c5-08da2283d20b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.234];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4277 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The function virtblk_setup_cmd() calls virtblk_setup_discard_write_zeroes() once we process the block layer request operation setup in the switch. Even though it saves duplicate call for REQ_OP_DISCARD and REQ_OP_WRITE_ZEROES it adds additional check in the fast path that is redundent since we already have a switch case for both REQ_OP_DISCARD and REQ_OP_WRITE_ZEROES. Move the call virtblk_setup_discard_write_zeroes() into switch case label of REQ_OP_DISCARD and REQ_OP_WRITE_ZEROES and avoid duplicate branch in the fast path. Signed-off-by: Chaitanya Kulkarni --- drivers/block/virtio_blk.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 6ccf15253dee..b77711e73422 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -223,10 +223,14 @@ static blk_status_t virtblk_setup_cmd(struct virtio_device *vdev, break; case REQ_OP_DISCARD: type = VIRTIO_BLK_T_DISCARD; + if (virtblk_setup_discard_write_zeroes(req, unmap)) + return BLK_STS_RESOURCE; break; case REQ_OP_WRITE_ZEROES: type = VIRTIO_BLK_T_WRITE_ZEROES; unmap = !(req->cmd_flags & REQ_NOUNMAP); + if (virtblk_setup_discard_write_zeroes(req, unmap)) + return BLK_STS_RESOURCE; break; case REQ_OP_DRV_IN: type = VIRTIO_BLK_T_GET_ID; @@ -239,11 +243,6 @@ static blk_status_t virtblk_setup_cmd(struct virtio_device *vdev, vbr->out_hdr.type = cpu_to_virtio32(vdev, type); vbr->out_hdr.ioprio = cpu_to_virtio32(vdev, req_get_ioprio(req)); - if (type == VIRTIO_BLK_T_DISCARD || type == VIRTIO_BLK_T_WRITE_ZEROES) { - if (virtblk_setup_discard_write_zeroes(req, unmap)) - return BLK_STS_RESOURCE; - } - return 0; } From patchwork Wed Apr 20 04:10:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12819723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFB95C433F5 for ; Wed, 20 Apr 2022 04:11:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243587AbiDTEON (ORCPT ); Wed, 20 Apr 2022 00:14:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbiDTEOM (ORCPT ); Wed, 20 Apr 2022 00:14:12 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2051.outbound.protection.outlook.com [40.107.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90C06167C3 for ; Tue, 19 Apr 2022 21:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C7zVBMjXxSQQb98rjkAzrACC0i6h1ZaOPRRkXjwtrW4sjFxLFORb042tyCCGRWbR5hT0le54Wy56UK0quOntFdCETucov/KvA/8F7L/J8pydbWukbUiizL+LwEE5Iryv4724DElE0/pPxFUKcaGEw2nD1lN9WMyZ1HbUoEXEjp3I+n9+EKmFgmosbMjUIuRaETQFaTC+M8hNdm7OFznf4chsItHGXf2+vgwlm1bGgZ+obEsFQ/gwJg427a+QJMQ683Sl6vaWLr6E5wtjsLZsD4RQ4eSgKbgxNwFxBOFCT5DWo7UhFrp3yUbQc0L7nC7AvwDzI8rJqvcG/ENDHUozrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qDqO5AwzrUxvTPFHFvDsZOD4YFInJK1DvpkeDXPvFCk=; b=GMer6fPb1WrxGrzQNlnu8JULtsI3VqSeoP6Qi1fKfFY0rfJOtMHY6ybyWMZMjO3vCzWiAkf+PiRyuPonDnhVqN1aMdus/OiHv+q4Dao0a2+FsyRIXVBlF1Et3IcefhyfPrRIp6r87lf5qlfw+Krc6howfn8M36qrSke1RF+7LZRiTKvhZ4PAC2TCnuMAf6itIh8vsoL+dQwM9wTF+Gp5JYUdX2wu7G1aDLluH2eCBf6aSgAOdHlzwIzaTCGZO8OAW31P+w3qWO9uR6PmwvfoW5MF0xqBx6gb7g6ipNHwAvThFQjVQX++LHgN9DiWQNwDfu5EulgQK3MKeZ3Pyo9mGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qDqO5AwzrUxvTPFHFvDsZOD4YFInJK1DvpkeDXPvFCk=; b=JuID19hsu0+0PLtLe7rnYMY2MOKrRsomO7dYguaICnqo6pRNGgQ5iPtI9e9FNm8QLbuYFYdo9yJpXpNzngiECgAgmw7TqnkQNvojyUd+DGc3/0ZCV8NiGsnuebyMXeahO2Y7MVipoFHslE/vC6aJ5fn4j3rkSIPT6pu3m0DxGkRd3x16po/r2d7q10I+plANybufhSmsREcjetrngma9n/zkEyMn+9Uymj3y3SQvnA4hi4+IMUsnZoLKZQd6vsA2WCqsfwKxixukHbXVB1Dj2tT+O+p+Y8dVqDbAod4HgTxNsNt/v0KAnBRoaVl3ec/EdKQx76RtpyA3EwfCYuJiFQ== Received: from MW4P223CA0024.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::29) by DM6PR12MB2778.namprd12.prod.outlook.com (2603:10b6:5:50::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Wed, 20 Apr 2022 04:11:27 +0000 Received: from CO1NAM11FT058.eop-nam11.prod.protection.outlook.com (2603:10b6:303:80:cafe::f8) by MW4P223CA0024.outlook.office365.com (2603:10b6:303:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Wed, 20 Apr 2022 04:11:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by CO1NAM11FT058.mail.protection.outlook.com (10.13.174.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5186.14 via Frontend Transport; Wed, 20 Apr 2022 04:11:26 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 20 Apr 2022 04:11:23 +0000 Received: from dev.nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 19 Apr 2022 21:11:22 -0700 From: Chaitanya Kulkarni To: , , , CC: , , Chaitanya Kulkarni Subject: [PATCH 2/4] virtio-blk: don't add a new line Date: Tue, 19 Apr 2022 21:10:51 -0700 Message-ID: <20220420041053.7927-3-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20220420041053.7927-1-kch@nvidia.com> References: <20220420041053.7927-1-kch@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d8f92c97-9b6b-4bf9-ec03-08da2283d6b0 X-MS-TrafficTypeDiagnostic: DM6PR12MB2778:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f/2KtcVSdN2exa7aI5dcG46zT3kxFKoCrCVe6gGqH7BwqYY/1kVTX7Q0n4RXHJOhN4b7JnHYWjf0S+P3WnSyhK9VlZchGhH4sSFvuQ3kgb5FBO/lkKDvwfrGnuW8mitNVyf5S8rbbk4mb0RyLar3fDI1hyttdXBCCVTPyYXIgbgFoWsDi7Rlhdc6RGpZu5Pfv4J3QfiL7fd+KPyaE5OIMlsaJDQ9bjz+cH4oUuPl9nm00fuO+L7Fjr6KaaLPQwx5C2DvzpsUEu2RnoEFiQ0TE+w72VBFq90hVD2SWBr9618cIZsJ6k+YESWXNCKGqw2EYiqg+eaeUwl9uUiowXoAxW1YcCDzEWM6XNo66UD2zW3sKHFf3Rd5sQ5ozFjetwJTyhJLYTkhsqpkMrvFSmE0eBlTohoZw5leH5Bon9y+jb97G3t6NxrUfEt5LrvpVRgpJgA50P0+TIQO5wVuBNnm+hKO0bZv6zFJ3mz7VwJqdKvc9Q4JvggPJmzWWuNwSruKd7RVmBmd+zpu/+mKS27aOC6DyRW9PnNIMngd4q8DKdV+Bl8+vvZTtG+uTQMqFwOU9tkuhmi/bY4e6cYDzRituQ4sMBrLDYtl8teUgaEXC9+vsnQO+p+25nGUamlPncyuInqsxn4yjiajkzT06W929CZDch5fsaORsz3hYhhOLqOaSIfI61D+oe4DxACTrJyMmmZj+HEEjAygsld/W1S0ZQ== X-Forefront-Antispam-Report: CIP:12.22.5.234;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(7696005)(4326008)(6666004)(8676002)(36860700001)(26005)(70206006)(70586007)(508600001)(82310400005)(316002)(110136005)(16526019)(336012)(47076005)(54906003)(426003)(107886003)(2906002)(36756003)(2616005)(40460700003)(186003)(83380400001)(81166007)(356005)(1076003)(5660300002)(8936002)(4744005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2022 04:11:26.3231 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8f92c97-9b6b-4bf9-ec03-08da2283d6b0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.234];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT058.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2778 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Don't split sector assignment line for REQ_OP_READ and REQ_OP_WRITE in the virtblk_setup_cmd() which fits in one line perfectly. Signed-off-by: Chaitanya Kulkarni Reviewed-by: Stefan Hajnoczi --- drivers/block/virtio_blk.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index b77711e73422..d038800474c2 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -210,13 +210,11 @@ static blk_status_t virtblk_setup_cmd(struct virtio_device *vdev, switch (req_op(req)) { case REQ_OP_READ: type = VIRTIO_BLK_T_IN; - vbr->out_hdr.sector = cpu_to_virtio64(vdev, - blk_rq_pos(req)); + vbr->out_hdr.sector = cpu_to_virtio64(vdev, blk_rq_pos(req)); break; case REQ_OP_WRITE: type = VIRTIO_BLK_T_OUT; - vbr->out_hdr.sector = cpu_to_virtio64(vdev, - blk_rq_pos(req)); + vbr->out_hdr.sector = cpu_to_virtio64(vdev, blk_rq_pos(req)); break; case REQ_OP_FLUSH: type = VIRTIO_BLK_T_FLUSH; From patchwork Wed Apr 20 04:10:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12819724 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8557EC433F5 for ; Wed, 20 Apr 2022 04:11:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243114AbiDTEOX (ORCPT ); Wed, 20 Apr 2022 00:14:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbiDTEOW (ORCPT ); Wed, 20 Apr 2022 00:14:22 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2069.outbound.protection.outlook.com [40.107.92.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E85C3186DE for ; Tue, 19 Apr 2022 21:11:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D6B0zRs/fWhnbf2+Ge457MaKu5+wmoOy3z2vyY1qvelrQ2wNxDvS3NsupGSB8cDgP3rQY7SzfqU+CDaqzDpOgrYhLSta9FFiIfvxYCEV9bMg4a/EKcteY6LhxX/OhUWOeasyrXStwcymgL44xItXnSyLqmi8lAyWhKYurY5CiQI9cXo3Blq1+zVvsCUj1a040QI2jmlbCUOZDyF0jCY5Da85TRF9JPB6bCkaJWjwDefEd4YVhrtakpq82Suu3ueDPQ1/dnxHkNOKE+JKvm3NsjHCv0p70weNDarcW4N2xuIdKql3jg2IUj1lqOBRkAGmjTFWQphFCKqTS/ovog8mOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qBat5LQ0XVMigUVfSsJ8wuxfijoJ6KKRfaPFE8e0xfY=; b=VczPvZk0sk4224w7exT2Zkg/nsGsksb28RsUEeMNb/z4iqA9Nw2sTYgM7Zys1ZtJ47SLfLx9HJDZk+18sWbQtLjriX/hXNj0eIxYYEcJ65zcuBIBKwx9UUTxLIBrHHVWSZT2mjaMqpWKjzVZ3D/ntF9aKaBCebF4QS42QdT4+hHNMAPJJ7vIoDk0LX/ArPn35zU2p6ln2ShjmeIumw9PCMvS9iap4jhALiK3/h81DJKejJ4W+4wS35UDFg4TbjIWTqCFr6OZ0ZAySfpuykqHLtnrYYrEFyQnNpxxyWfeSqyf9GosB+LcbbF94vn68fw55qCwTeDMdx2UToQ8AgL4iA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qBat5LQ0XVMigUVfSsJ8wuxfijoJ6KKRfaPFE8e0xfY=; b=snaDNN1gpfPM/JaWe8ElKAVqZVF+EQNsEjI6HR3QTYSCpKwSDqsiGgIe4fvy7s88bMMIz7jLe0bVj15CFzjYLZtXYwvf3P/OVrtO0kswDYJ4ltJKYqzh+kMkb/U6XoaEik9ITvxWt1km34Ncj/mD9sJWXxQhdlXUSj8VL6FB/1Tf5BkXng95LgC3r5gbmR39ymt5KLEzX3Fa6VAhkRN2ftLfeTS7kQ6Tl+eouLSpdHduO7V6eGtCC+4NsGd7kdlyfNYfVlH/BDjmQcZ7v2PE0hUpUPhyqpn78RqJKupOseeYIStbscrfWf5lIdgqcLPxL2CQ4zsUxRLUtbS59Pnl0Q== Received: from BN1PR10CA0007.namprd10.prod.outlook.com (2603:10b6:408:e0::12) by CH2PR12MB3943.namprd12.prod.outlook.com (2603:10b6:610:2d::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Wed, 20 Apr 2022 04:11:36 +0000 Received: from BN8NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e0:cafe::24) by BN1PR10CA0007.outlook.office365.com (2603:10b6:408:e0::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13 via Frontend Transport; Wed, 20 Apr 2022 04:11:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.236) by BN8NAM11FT048.mail.protection.outlook.com (10.13.177.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5164.19 via Frontend Transport; Wed, 20 Apr 2022 04:11:35 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 20 Apr 2022 04:11:34 +0000 Received: from dev.nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 19 Apr 2022 21:11:33 -0700 From: Chaitanya Kulkarni To: , , , CC: , , Chaitanya Kulkarni Subject: [PATCH 3/4] virtio-blk: avoid function call in the fast path Date: Tue, 19 Apr 2022 21:10:52 -0700 Message-ID: <20220420041053.7927-4-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20220420041053.7927-1-kch@nvidia.com> References: <20220420041053.7927-1-kch@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e28b90db-0785-4376-3e33-08da2283dc60 X-MS-TrafficTypeDiagnostic: CH2PR12MB3943:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kntnGFEvxT2bQDSlLZ7qnPMp0lfL/8o8M3B+zNquNecooNBL6Kb3VQRGSFcMDmSAryead1DJ4srB0ybs/YmEPN3OBIO/aqFvw5GbyWhVv18mjxhb/INsSFd4VvFz/bxX79PTAWRMdYlBBGMRhmAh/CIM5LSacuqKEl7KaWUCWTqyeTH5tJPsUTBDycqe1P3VSMlSsYxFQY3j+StdqegvoR0cDeadoJXkLYD42SUjfmKa8OuTT0qtHWlSDPEXP/s7164dktKpGKpeNKASrouR/znJTxuBPibbkaB5E5CiUFv86nDqak88o+VF1bK5scoDDTD/uJnaaXyvoJXTJVrQD/1rYAMpczO2N4EpgID66OxrdmuOZXIFo2iw3bkAt741WMYwXQTDZJPxLMNxBpHBgGW47pyvW/Fqtc01I4pz3H/TOwl11Q9AaZd4NL1hc5DyLbmY/ndvnZ5jhmFSfmmtXcJTpBQ2VWSbako4ou/ka6RmRHorK4NsX2NhJTG0XsFfAgGUvEPaPn/t4klzHhTssi36JS7Mf1ywVfXfi+VhJQl46t5iKarZ1xyrxjMJ8mh7jWlAbhG+i+5tDtfdVPDFsRtlWA3gGqrrz2oTYyRC3LfOfze56CCSQwumg/FEspSZRgZ3VlqF14eALY181AFjEXO3uFLA2BqMZu6j2FdHWHKfR0U/NPhsGk8ZzgJ1MD8WImXJOOiaeNP2C10R1iF7sg== X-Forefront-Antispam-Report: CIP:12.22.5.236;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(356005)(316002)(70586007)(426003)(110136005)(8936002)(36756003)(336012)(54906003)(8676002)(5660300002)(6666004)(47076005)(40460700003)(70206006)(4326008)(508600001)(2616005)(107886003)(83380400001)(26005)(16526019)(7696005)(2906002)(186003)(36860700001)(1076003)(81166007)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2022 04:11:35.7826 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e28b90db-0785-4376-3e33-08da2283dc60 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.236];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3943 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org We can avoid a function call virtblk_map_data() in the fast path if block layer request has no physical segments by moving the call blk_rq_nr_phys_segments() from virtblk_map_data() to virtio_queue_rq(). Signed-off-by: Chaitanya Kulkarni --- drivers/block/virtio_blk.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index d038800474c2..74c3a48cd1e5 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -178,9 +178,6 @@ static int virtblk_map_data(struct blk_mq_hw_ctx *hctx, struct request *req, { int err; - if (!blk_rq_nr_phys_segments(req)) - return 0; - vbr->sg_table.sgl = vbr->sg; err = sg_alloc_table_chained(&vbr->sg_table, blk_rq_nr_phys_segments(req), @@ -303,7 +300,7 @@ static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req = bd->rq; struct virtblk_req *vbr = blk_mq_rq_to_pdu(req); unsigned long flags; - int num; + int num = 0; int qid = hctx->queue_num; bool notify = false; blk_status_t status; @@ -315,10 +312,12 @@ static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx, blk_mq_start_request(req); - num = virtblk_map_data(hctx, req, vbr); - if (unlikely(num < 0)) { - virtblk_cleanup_cmd(req); - return BLK_STS_RESOURCE; + if (blk_rq_nr_phys_segments(req)) { + num = virtblk_map_data(hctx, req, vbr); + if (unlikely(num < 0)) { + virtblk_cleanup_cmd(req); + return BLK_STS_RESOURCE; + } } spin_lock_irqsave(&vblk->vqs[qid].lock, flags); From patchwork Wed Apr 20 04:10:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12819725 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDFF9C433EF for ; Wed, 20 Apr 2022 04:11:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343980AbiDTEOe (ORCPT ); Wed, 20 Apr 2022 00:14:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbiDTEOd (ORCPT ); Wed, 20 Apr 2022 00:14:33 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2044.outbound.protection.outlook.com [40.107.237.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA583167E8 for ; Tue, 19 Apr 2022 21:11:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Du0Juvs2/8ZZh3vjdJILGfrpofvas/g7Cz4+ldC4bXuJ+Gb6mvsWltrXUiPWekns7evvmVxxI0l+rfvoRfMPxUuycqrv125SIV86lCZ3ilz3i8BqsNAcIM/NLZbrST8yhMvYehhFcFGm069PuXqXt8HPr6E28bZ/iGKwNbxcc5LEr5HDGKQ96fEExksM6sof6LJdA8TwW76zOqozD1A0Dq5jV0xjwIsJPs522Sh6towGwfpnvOajy2Cepx1pikfkyVsEvK8DONbxJn4cZODKyLbEwgTMR5bRHQI8cngNL6n2nYPEq4MTkGYlkw9EqjR6hN//pjQ8+UV0SpYLvgXEbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/NFXay19HcQli6BmmwJwW7oPLncJnPjFRcAVf/HxwHE=; b=kwOt+i7h9RRCDfBK+s4KA0UB2zoE9SrjWctK6L+ij9XJ3vtBT77fNNoS0z2J/TWBiRukJKJPXqOUGD2IXQog0HWljwVeK/EynHMAeK8SKzLV3gylQXt3hy56EO3iG7WmwsqERj5jt9FH7Rfg+r4lBXSgPiOIIfsc5FjC860xn3wRrBk6WMSH5sTt+mURdYe54Aj8sFqMWYDUbTPBpKwYJMImx+UyZbtObS1a2Aw25CcJ624mKr2ivh9oStdQm8Y8Zu0Pr92t1VE3oPdpEYhSDzeQ9jxIA0qNsOA7D1ZL2xFSKPoNIjgIXuW2KBR5vJyiUsxA6PuSJj8lDEgrUteCIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/NFXay19HcQli6BmmwJwW7oPLncJnPjFRcAVf/HxwHE=; b=EQ647FAhTgGpfwgEWHa0eoieFl5NFOBgctUUvq3L5h8AkeSOUhAwbhxwDRRf1ZxIiNDbNE4KY0/b6qnUjoKi/yzW1gLqu+0PMxFQGA7NmikrBO0XweHv+618RMaDw3jgly6VG0HoAVuyoRw0WbPJ1qD2XlIgaet/wkY3Qb3gFJWPSQDIBvVMdjwcqR/SYnvAe+iYZep2N0lyfxo4kzvmD8f4FERSFZ31X+lSF26CBDSmYZ6N0Ra5O886E6eUjZgg21IQZnteKz0dVoDUcRZ96V6XLzOk6W3TU2I4q0xkfwBCNHt5HsBA9kWNVRkarWUWmojB5l5hZG8RA+EXjMWbCQ== Received: from DM6PR03CA0080.namprd03.prod.outlook.com (2603:10b6:5:333::13) by MN2PR12MB3181.namprd12.prod.outlook.com (2603:10b6:208:ae::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Wed, 20 Apr 2022 04:11:47 +0000 Received: from DM6NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:5:333:cafe::51) by DM6PR03CA0080.outlook.office365.com (2603:10b6:5:333::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14 via Frontend Transport; Wed, 20 Apr 2022 04:11:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by DM6NAM11FT005.mail.protection.outlook.com (10.13.172.238) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5186.14 via Frontend Transport; Wed, 20 Apr 2022 04:11:46 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 20 Apr 2022 04:11:46 +0000 Received: from dev.nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 19 Apr 2022 21:11:45 -0700 From: Chaitanya Kulkarni To: , , , CC: , , Chaitanya Kulkarni Subject: [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX() Date: Tue, 19 Apr 2022 21:10:53 -0700 Message-ID: <20220420041053.7927-5-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20220420041053.7927-1-kch@nvidia.com> References: <20220420041053.7927-1-kch@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: be68a78a-a169-4ab3-78da-08da2283e2d9 X-MS-TrafficTypeDiagnostic: MN2PR12MB3181:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 66E4u127PoDRbKPLnn9isfBHRgPq6nB8YQYllgdz4lCWjJUTqgARbzCHetUt5NJokPtSjAxI3rWhc+g8wK7jwemxdrl5KETz03euydDoqcl1an4F9rp0TP1OcvskuZV5WIsW9G8cFlD+u4rFmsE4brnCXH01ALAaNeGtuFRR37ClZsg+Pf1+tlTsJL06jogbFicM2fD4cB1c3TKHnxDgZ/1SEjiKSQgBpC6gwYzwy1TDLIAZ4feLnOgFeehC6wqALbspXU+D5w7ILQnqj7ExJYo9UZPBaZv0iZSmYT1YPxyoX4Y0nQg+do2Rlv4/nlUVCCzuMn7L8M93wwKSDlKuUuE0zJrcys8B4rquN3QcO0if/TbssxbJBBZsmo3t072RHb4kuTxxdsQfbxql28FhLt9ymC6homBNCDFHqO7+lmVJFhkDAzdi6+ySwDVTevDFsZx4h6zYomgDSgPR7DIGIEEeusrf1OdUPDs+yizj/3L8aCgmdxVSL9GcGqLBrBiMCfYO5G/X9Ku0XISRO0GgHVxZLftk70Lm2y5MeV53u0HFNpG9Ajt7EK6o6T9z2A7xpi5S0dzSvfF1nPPMZQJ/0XOpi/wcldJY9MLhfkdP2pUXsfrtE0EZW+m/RrC7w3XFR7DMhOcQ3vm9buJ0u6WKSSq7njmVhTP0mxGwA7dAJLtdOmK4BOUBabDtiRQk/DuoqpSMX6tTy/E1q92TadPPEw== X-Forefront-Antispam-Report: CIP:12.22.5.238;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(110136005)(81166007)(54906003)(356005)(8936002)(316002)(82310400005)(70586007)(70206006)(4326008)(8676002)(36860700001)(16526019)(186003)(40460700003)(1076003)(5660300002)(107886003)(26005)(426003)(336012)(2616005)(83380400001)(47076005)(6666004)(7696005)(508600001)(36756003)(2906002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2022 04:11:46.6903 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: be68a78a-a169-4ab3-78da-08da2283e2d9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.238];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3181 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Replace deprecated ida_simple_get() and ida_simple_remove() with ida_alloc_max() and ida_free(). Signed-off-by: Chaitanya Kulkarni Reviewed-by: Stefan Hajnoczi --- drivers/block/virtio_blk.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 74c3a48cd1e5..e05748337dd1 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -411,7 +411,7 @@ static void virtblk_free_disk(struct gendisk *disk) { struct virtio_blk *vblk = disk->private_data; - ida_simple_remove(&vd_index_ida, vblk->index); + ida_free(&vd_index_ida, vblk->index); mutex_destroy(&vblk->vdev_mutex); kfree(vblk); } @@ -720,8 +720,8 @@ static int virtblk_probe(struct virtio_device *vdev) return -EINVAL; } - err = ida_simple_get(&vd_index_ida, 0, minor_to_index(1 << MINORBITS), - GFP_KERNEL); + err = ida_alloc_max(&vd_index_ida, minor_to_index(1 << MINORBITS), + GFP_KERNEL); if (err < 0) goto out; index = err; @@ -911,7 +911,7 @@ static int virtblk_probe(struct virtio_device *vdev) out_free_vblk: kfree(vblk); out_free_index: - ida_simple_remove(&vd_index_ida, index); + ida_free(&vd_index_ida, index); out: return err; }