From patchwork Tue Feb 15 11:51:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12746974 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 99F4BC433F5 for ; Tue, 15 Feb 2022 11:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229707AbiBOLvj (ORCPT ); Tue, 15 Feb 2022 06:51:39 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237411AbiBOLvi (ORCPT ); Tue, 15 Feb 2022 06:51:38 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2058.outbound.protection.outlook.com [40.107.244.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0323EDEED for ; Tue, 15 Feb 2022 03:51:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G39ZOQi8ZAmMI/o+0KdCBMcWGXGi0k12pEV6r+pCvjZVaKuxwFnN5aNx7JRF73qaKkCvME+aC265IQjEOEAuXc+VUF7GLCLoGAvaa3nmicdUZgLXqQSLbxFk+saq+V4R+2NIqMZ0Ff6sRxGdjAabMPJTIsd9d+yj36aEfC8yjQ2ZxKpr6XCRIaHTloyUl0AFy8CMA0Sh2MpFG5HxIa958Od9SABuribuCBRGqx7v1qShF2d7W1+1vdKgH6Z+12F//bZCM6w7m9nGabLV/qbR/oH28mr9aCZAz7Vbl7u2nfS+/1k6+MbCIsk+0oGR40WXzgN74rECxMDORwIuTkJOsQ== 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=jcz2fh/9i6/EbRPkqP+gdhL0pMYnnOhoKwwO+bvKdUU=; b=GnhQiQIK8s+fU91hhjiTkFzEURVfBQ57aBCEc4d7X/lox6rnlRSkqOhO8RuOSS3yf+xE+mjFNyliWsIcX327djWPAOOC0vRCmfSIPSerdq0FCKOom6S9riK1uCWpI+a06sT1OQn94I+GPwL9/S+q8tzeXA0JN9cZmnrBRqIGkcBsoArJ9WIRj2LfAGrkY6XZjwlWq4KX8qIOsS/saFSgzUq6faXy3T4wO1Q/aMzwO8E4fAwHCl6maZTtLwU4yIyc2RmKTiKOPmg5Uy6DBplFoTpwZMltnH8os6sPBM5+oh2HMTHLxiMMCL9EMILxURWMq3QLZp8fI6JB2OK7bMFIJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=oracle.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=jcz2fh/9i6/EbRPkqP+gdhL0pMYnnOhoKwwO+bvKdUU=; b=t3l7IY4eCMgMriRhaFST2K8dhILPDYGfda/SERyzvP1Rg0o/IJIJjH2KCD0B+uBlmbYYdwDrKIl/DoGCz03b0GMtPDIPPliUpbptSulpmDySda5qOM7Fu6b1YMv58BsmpAz9ll9IYThG0HLtGCdVhktVWedsm1nF3idfFLW8tbdg5cON0BFqF/BifnLVFQp/bLzFl00BQ165f2l1PBM7fMty+zea0QWBV3PHq0Wrf2GP9IBM4MnLM+XVRCsoDg7cdQU7FsR6dhTWx7Tjhs2fl3eNjG+vQaAqU1Pc3ip2QBlsFWhVYN8E2cVZPd0OsOOQZXygVXZhob+el+eM1kn4cg== Received: from DM5PR18CA0074.namprd18.prod.outlook.com (2603:10b6:3:3::12) by BN6PR12MB1123.namprd12.prod.outlook.com (2603:10b6:404:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Tue, 15 Feb 2022 11:51:26 +0000 Received: from DM6NAM11FT055.eop-nam11.prod.protection.outlook.com (2603:10b6:3:3:cafe::7) by DM5PR18CA0074.outlook.office365.com (2603:10b6:3:3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15 via Frontend Transport; Tue, 15 Feb 2022 11:51:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by DM6NAM11FT055.mail.protection.outlook.com (10.13.173.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4975.11 via Frontend Transport; Tue, 15 Feb 2022 11:51:26 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 15 Feb 2022 11:51:25 +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.9; Tue, 15 Feb 2022 03:51:24 -0800 From: Chaitanya Kulkarni To: CC: , Chaitanya Kulkarni , Himanshu Madhani Subject: [PATCH V2 1/4] loop: use sysfs_emit() in the sysfs xxx show() Date: Tue, 15 Feb 2022 03:51:01 -0800 Message-ID: <20220215115104.11429-2-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20220215115104.11429-1-kch@nvidia.com> References: <20220215115104.11429-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: fc0386d1-9a99-4b65-170b-08d9f0797f08 X-MS-TrafficTypeDiagnostic: BN6PR12MB1123:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:561; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PvC8g3MlVIGesk+Dgju8tnL9gfCxA2Gifp4XO8OsRcBKM7VMZnDiykdO9Mi6nSvfh4PlP2mzRLcOSw5mIMr5kO6fkTMphe/vKDh3pG7zVk4Cf1aaUZwOMeDrUih1rYmUkk62kQ5Rydy6QuF1C4jgfMNY/gkixDF/CwDIOiJno4OJMVWYIAbTJ3C/1cpfTfaWc79yiy2WWvV+F/hmfoyGcEtyCzM9ZbQ/JBgbzViyKwMkZn5EGql6FTOVdQfEdvHL1NP8u32VlAh0sh1z0NHZbCEsbTnmDIOL7NqfCnj6Q4QAtyyyFrETZm2QFtA5ElMJgJttvzYyrjVq8JQDeOhJdUJO2Zm+tIR7AYCeQ8m/ARonf8VFApMu04hN93OWAhczq2ZI1E27OhnLLJP2LBCk9EZTgI3QF46nBdgQK3MqIxNKvB+EafRokYUzUKyF+LU+fo9WZWAxoaQve+QpBhiM401OPYs8QtobQLesUyO2rCwUJ4XM17ATDA+vRQno2npJlxECUr6SqH9SR7JOD/5uOtHutguEuxROvrxghPuE4diXF6PzbEUCaiIlARiRh027/s3bfD6/zkZ09r7T61CjWvkzF+rv+1Xfg7CvF8YpBqxxTmTIa1hxqQHkVXZjspJafBq6tlGBTdexpJkb9I+Nam5B97q3F33vo9Yfc/RqHSFtVSs2hvxbnkck67IpTCwT0VInp2yFtfL9CFgmlVya3enGtt3RLLFp6XupFHJMuK4= X-Forefront-Antispam-Report: CIP:12.22.5.235;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(26005)(186003)(6666004)(1076003)(336012)(36756003)(40460700003)(16526019)(54906003)(36860700001)(508600001)(6916009)(7696005)(426003)(2616005)(82310400004)(83380400001)(356005)(5660300002)(316002)(81166007)(2906002)(8676002)(70206006)(47076005)(4326008)(8936002)(70586007)(13513002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2022 11:51:26.1487 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fc0386d1-9a99-4b65-170b-08d9f0797f08 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.235];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT055.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1123 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org sprintf does not know the PAGE_SIZE maximum of the temporary buffer used for outputting sysfs content and it's possible to overrun the PAGE_SIZE buffer length. Use a generic sysfs_emit function that knows the size of the temporary buffer and ensures that no overrun is done for offset attribute in loop_attr_[offset|sizelimit|autoclear|partscan|dio]_show() callbacks. Signed-off-by: Chaitanya Kulkarni Reviewed-by: Himanshu Madhani --- drivers/block/loop.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index bdea448d2419..a55e5eda1d17 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -680,33 +680,33 @@ static ssize_t loop_attr_backing_file_show(struct loop_device *lo, char *buf) static ssize_t loop_attr_offset_show(struct loop_device *lo, char *buf) { - return sprintf(buf, "%llu\n", (unsigned long long)lo->lo_offset); + return sysfs_emit(buf, "%llu\n", (unsigned long long)lo->lo_offset); } static ssize_t loop_attr_sizelimit_show(struct loop_device *lo, char *buf) { - return sprintf(buf, "%llu\n", (unsigned long long)lo->lo_sizelimit); + return sysfs_emit(buf, "%llu\n", (unsigned long long)lo->lo_sizelimit); } static ssize_t loop_attr_autoclear_show(struct loop_device *lo, char *buf) { int autoclear = (lo->lo_flags & LO_FLAGS_AUTOCLEAR); - return sprintf(buf, "%s\n", autoclear ? "1" : "0"); + return sysfs_emit(buf, "%s\n", autoclear ? "1" : "0"); } static ssize_t loop_attr_partscan_show(struct loop_device *lo, char *buf) { int partscan = (lo->lo_flags & LO_FLAGS_PARTSCAN); - return sprintf(buf, "%s\n", partscan ? "1" : "0"); + return sysfs_emit(buf, "%s\n", partscan ? "1" : "0"); } static ssize_t loop_attr_dio_show(struct loop_device *lo, char *buf) { int dio = (lo->lo_flags & LO_FLAGS_DIRECT_IO); - return sprintf(buf, "%s\n", dio ? "1" : "0"); + return sysfs_emit(buf, "%s\n", dio ? "1" : "0"); } LOOP_ATTR_RO(backing_file); From patchwork Tue Feb 15 11:51:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12746975 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 03C56C433F5 for ; Tue, 15 Feb 2022 11:51:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236138AbiBOLvu (ORCPT ); Tue, 15 Feb 2022 06:51:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237360AbiBOLvt (ORCPT ); Tue, 15 Feb 2022 06:51:49 -0500 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2068.outbound.protection.outlook.com [40.107.101.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08AEE69CFF for ; Tue, 15 Feb 2022 03:51:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hz8JkgSKM8gdLnLf6OFYXgpI6Wxd3zFoBnjD0Msvc+lgEPMDybu0aYhlcN0ERdvFeEuFmah4qa8WXNiQZmqtXLAaoRTzkVSjwvzO7pNIUJ1R4XnQq5RiJD/VDilRZgaVNOxixI1qCg2pnDRsyY5MGYkm7vQj9F9IjoSxP4uYTVR/W6WTerpPxXd+3JpSyaPUiqNupEWSslcwco1nU/hdI7cIuO+EBLc+xp0C6mQeog6XdNDFGVTCHse6nx6ysx6tV7Y+YYT9Nh43X1UbLjazQ2AkFSAgWqn6ah7cgxqKToPYxMFFNx1FY4ocK9WkltHp0vT6WXCgnTxVvQ31KSdLjw== 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=tPRL8HISYCbWUWa86yzKyPNqFQr5skJ1vmQY5DJJ4s4=; b=BsAZjOHLt03EprLr/N6PHi7S33kEXbYYvF43cD9MPdXj1rbqhaiJ2R8TKIbvg3cO2OlsATOL24tRrHHNkP24SRPBiRmW+Qx6yaG8Wd6TETFOuF63rLn5n5xNqit3ooMzCHCKP/DzKlqxwKwyF5xLBEAHykWVtAi++C8MohKVl5BnZiX3jwzGNuHqx4EPQ396uNMGHYALZpYGO3nok7cJD1sKZSSANIMGVTESzuCRU47mxZ4q7+NP9OSJTDN9PBPOvLIYEOlFNx8l4K3kOChrsM6t93/gAFbB/p0DVtlY6k1m7faIsgAyjK+Rh0vquBBXvauu8JTMjdQIwTdPwXTE3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=oracle.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=tPRL8HISYCbWUWa86yzKyPNqFQr5skJ1vmQY5DJJ4s4=; b=uGVs9s6OxPNM5ufBnRq9KavB8gG2UclDx6e4Ef3wQqS/t1dZl5ZdTj/GMe4DMM6Im7Ag1pPlnBer4m7QkpMtvKZbsfTJesEYWmC0BsTzm9PxWj4SIaC+XkpB1Ep88+QPjBvKdVY9YNEWiwS7dCzK87Qf/k8bTFuQrV3UoVQQNyM3B6xiGDUIQ6H8uYeu8IM+T5Q49xwn0Swn8hyOSIDY6JMkST3QnTi96DcfvsJ5LMLBw6DbSLltiENzfoRHArT1RIOif9ABsmjnT/DWPv/sXnzCk1yMY7+Ln1UAknBOxugqj4li28B06DSbT/+o9U37Fvm5hVbQpBH8JVwWcH7i7Q== Received: from BN1PR14CA0013.namprd14.prod.outlook.com (2603:10b6:408:e3::18) by DM4PR12MB5794.namprd12.prod.outlook.com (2603:10b6:8:61::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15; Tue, 15 Feb 2022 11:51:38 +0000 Received: from BN8NAM11FT066.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e3:cafe::de) by BN1PR14CA0013.outlook.office365.com (2603:10b6:408:e3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14 via Frontend Transport; Tue, 15 Feb 2022 11:51:38 +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 BN8NAM11FT066.mail.protection.outlook.com (10.13.177.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4975.11 via Frontend Transport; Tue, 15 Feb 2022 11:51:38 +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.18; Tue, 15 Feb 2022 11:51:37 +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.9; Tue, 15 Feb 2022 03:51:36 -0800 From: Chaitanya Kulkarni To: CC: , Chaitanya Kulkarni , Himanshu Madhani Subject: [PATCH V2 2/4] loop: remove extra variable in lo_fallocate() Date: Tue, 15 Feb 2022 03:51:02 -0800 Message-ID: <20220215115104.11429-3-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20220215115104.11429-1-kch@nvidia.com> References: <20220215115104.11429-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: 7b319606-6b32-4bb5-9a11-08d9f0798643 X-MS-TrafficTypeDiagnostic: DM4PR12MB5794:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tHJuKWjQhiIRT+h018CgXbs320aP0rorVTuHQ5EKeqCbkLYvZuv1cEFZtqakjDFxEK4ntL4/GZ+F9PZTc0A6xfTBvTknj0gaQSnRJmZ5RewG0RZcfjgxCwjx5IqE0nCugLDplm6LCc53J1dLMhvRKLhCk97SwIBHM9ss2PMbjVfm0M+ApoCQQskVBf/IvxWoVaS9GfqKv+zIEDSIjrrmAxXaM/C+CDfjYSUCg+NagsZEsfv850LWMarfY99EXhGOEQZOlDCuNG1v1KIrZ8RqLObIvJeeXH2AZlC0GE8v0LQStLvJOjgtK6qIoHaXa0I7a3ygy1dVOkaOpIi6Ll3stROnXvcYS3ClgF2jyqyrZ3ePlkiepsHxp3dS7XE52fBfj9X/lKBQeg5CQU2ParmBrOeuINP2+G0L5j0UN6ESHxQeka0s8UuB8702pAuBZ2nLkBpOjltc9CC3nQIx8LJDlnDzKmN4PZKhBhBG1gTjDJ6laiwRbACIwjHkYuube3nTa+1ZIIPrPxV0UaGet7/NBuKHq7G6rLkEf6sgSmQfgAQDJmCYOcQ+vQbBirDoDVHna4H+lspfgGLdYdyMPQdfp49UgEE2kJEVTSR7OhwRZFbZsXtMDQckkDEaWgoFuI2WdLcbm8ffBGg6JsduCVmyOy+Gc0/864n91yMaTgSNzX0h7oJbqjhJNqRerekcu4RI9KcVlSHY4ZM8kHh+G+yyZg== X-Forefront-Antispam-Report: CIP:12.22.5.238;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(7696005)(6666004)(36756003)(508600001)(40460700003)(6916009)(81166007)(4326008)(8676002)(70206006)(70586007)(356005)(54906003)(316002)(47076005)(1076003)(16526019)(82310400004)(426003)(26005)(2616005)(4744005)(83380400001)(186003)(2906002)(8936002)(5660300002)(336012)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2022 11:51:38.2203 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b319606-6b32-4bb5-9a11-08d9f0798643 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: BN8NAM11FT066.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5794 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The local variable q is used to pass it to the blk_queue_discard(). We can get away with using lo->lo_queue instead of storing in a local variable which is not used anywhere else. No functional change in this patch. Signed-off-by: Chaitanya Kulkarni Reviewed-by: Himanshu Madhani --- drivers/block/loop.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index a55e5eda1d17..77c61eaaa6e4 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -308,12 +308,11 @@ static int lo_fallocate(struct loop_device *lo, struct request *rq, loff_t pos, * a.k.a. discard/zerorange. */ struct file *file = lo->lo_backing_file; - struct request_queue *q = lo->lo_queue; int ret; mode |= FALLOC_FL_KEEP_SIZE; - if (!blk_queue_discard(q)) { + if (!blk_queue_discard(lo->lo_queue)) { ret = -EOPNOTSUPP; goto out; } From patchwork Tue Feb 15 11:51:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12746977 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 65A7EC433EF for ; Tue, 15 Feb 2022 11:52:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237383AbiBOLwW (ORCPT ); Tue, 15 Feb 2022 06:52:22 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235055AbiBOLwV (ORCPT ); Tue, 15 Feb 2022 06:52:21 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2058.outbound.protection.outlook.com [40.107.223.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20FFB985B6 for ; Tue, 15 Feb 2022 03:52:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QWLdtkimiNfpHDUSTha2SXLdm8XGiQtCkWsOGcoqipJtDuQ69WXAS9WV8jE/OiTI1MPWCgA5xpKJLBpHZ8nMiu4vyGqqnCW7CdbPJMwuN4HAklvsMolrugj0PqT5NtBpGS3fCu487Mob1rH+bHqhwtEtn2FvwA9U9H/xxnnthCW6nVd6ni69d3e2bMSlmgQmXFbcMFdmOaiBTk1odn8CpG7HFNldFCzf/bX0j+qcaqVYnt8HwF00x9aIAvTf6gYwqpSFDYf8oLpBM/8jjKhb5n0qlB1pvuTbHwHTjtxHvtDnyOHVZW62GCSB9UgyH1kM6qeXWV1F4mP193ASC/GTQw== 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=oBaNSjKaFgvWSO7NQJV5wU9zY8iE7LQJaYZZRHkKAwQ=; b=gT3u+JMf1/6OnwOFQZ+AxMtPilRhC1lKLs5A797DNUfc93uSXaiz6JN9VMqIkaGiB+dpZNj7VyfL7G3Z7CjwBmhnhLN9TkNywciZII5jgYwLxfy/LshvVKfQD4vwDEbLa99XyODn4LwhqY0oNYViIS3r4s7TIurT+q99dsR7djoQo4Y6vmvG34je3MIFWn5iN7vChjcjOXm5SkilR7BcIwDoTX4++iQB2cAj7vM5PlQ6O20Qv0v3tSqXivAUn4kdWiukzkKGg5UZ/uR5nCHL29KDEAfeHPwntVxgjE7L5D1X0I86tCI9VIWTIgc19ySm0DRWyw3e2sZmWFz3f/PDlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=oracle.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=oBaNSjKaFgvWSO7NQJV5wU9zY8iE7LQJaYZZRHkKAwQ=; b=YIve1Sz0PXefZxfvRVXH44FnOB37k8Bi7tbKhJUkKsTHhduCm0THHPHlDvXTvQQcrUMqXkSGnsZ4DAWkSDkLsqDwSM/QGX5/L0bXmYYLK+I3P+j/1WnimF3LDWga6cNn4fpnofKca9SBAGYIUx5g05wyjPWouVFJYDDNX0+CYQUrYGiIHc1HeTCcDnyz15VvgrsZ6j6NqvaOewofODfjhTncluYugMchlbN9RnP4KTIs8+SBXHKc0WWdH0bEv4CE+TDFEHcpOUDsZyOxyrOXQeBYgG/f2iF7nA3a6+8oyXsOpr3ehWStIArMZuX+hykv61cnyVsbaCp+p+xdGFjIEg== Received: from DM6PR03CA0061.namprd03.prod.outlook.com (2603:10b6:5:100::38) by BYAPR12MB2869.namprd12.prod.outlook.com (2603:10b6:a03:132::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.15; Tue, 15 Feb 2022 11:52:09 +0000 Received: from DM6NAM11FT006.eop-nam11.prod.protection.outlook.com (2603:10b6:5:100:cafe::38) by DM6PR03CA0061.outlook.office365.com (2603:10b6:5:100::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.14 via Frontend Transport; Tue, 15 Feb 2022 11:52:09 +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 DM6NAM11FT006.mail.protection.outlook.com (10.13.173.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4975.11 via Frontend Transport; Tue, 15 Feb 2022 11:52:09 +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.18; Tue, 15 Feb 2022 11:51:48 +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.9; Tue, 15 Feb 2022 03:51:47 -0800 From: Chaitanya Kulkarni To: CC: , Chaitanya Kulkarni , Himanshu Madhani Subject: [PATCH V2 3/4] loop: remove extra variable in lo_req_flush Date: Tue, 15 Feb 2022 03:51:03 -0800 Message-ID: <20220215115104.11429-4-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20220215115104.11429-1-kch@nvidia.com> References: <20220215115104.11429-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: 57945a5a-44d0-4bb8-7c4d-08d9f07998b1 X-MS-TrafficTypeDiagnostic: BYAPR12MB2869:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4zAhTCoEIelmfuv8FPQWE8aNzfiE0WLREPkvhdynqENGCMU1TNeJYiRaA2QkobOSZrFpMFa18WaYpHi87/zrHDLTJQn9hwauJDK+3lleNABsp1Tbk2epz5NUFQvJYmKkPhWnniZnTIrzRli5gweT1QxreRgWM6bHX8EA3BsvoYElgsOwV/sWb0IhDOMugUrXoQR3L9cPapvUXAAMC+PH0RufNkt5Q2c/gc64SAIruXl2O6jlDWtRjjjuhE9nQUU9xNLnaLFhr/GplbVrPRvj/Pj3YpsaSHzCwOrjRrf1MMYMa8ywmVIndveil/YUyHVib4m2cg2B/8oK6ihmfqdWFLTiqoljQOxpTE38tre5IrQxd6aQTlOVFQRezpTls2DJv+nVkvRS10+Ij0zpYNGM5rS1AAqHV9h7/2FLUHAav7wmmmQ0K45rcoU8zIUxSWX54Xw/LJFmPcLJ0cnYAX2TqForef2zFYADWeKEC6F1LA+mOiWKzF5aPv92LyIKIipn90GTiFdHEN5e2Mz6OgvQ8+TOy8tQb2eoU1LS2KDYp1nIMvOLPk5ZSoBPH5QvyDJ8qYB6qB/YYVd0nflFQQHB26vJ/jJU49b2V1gW7HDHuB/O8wUePN5APndqjaBl6GGF0zBY91dt+tAX+NkOfSzf4Re7p1PYKtPGK0F5mSZ8hmtA3/Je1csfU3saRFB5SQOpoRgX16zPQ4wWwUKYp96CRA== X-Forefront-Antispam-Report: CIP:12.22.5.234;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(16526019)(508600001)(6666004)(7696005)(1076003)(2616005)(426003)(186003)(26005)(336012)(356005)(70206006)(70586007)(81166007)(5660300002)(82310400004)(54906003)(4744005)(6916009)(40460700003)(36860700001)(36756003)(316002)(47076005)(2906002)(4326008)(8676002)(83380400001)(8936002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2022 11:52:09.1707 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57945a5a-44d0-4bb8-7c4d-08d9f07998b1 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: DM6NAM11FT006.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2869 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The local variable file is used to pass it to the vfs_fsync(). We can get away with using lo->lo_backing_file instead of storing in a local variable which is not used anywhere else. No functional change in this patch. Signed-off-by: Chaitanya Kulkarni Reviewed-by: Himanshu Madhani --- drivers/block/loop.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 77c61eaaa6e4..18b30a56bfc4 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -326,8 +326,7 @@ static int lo_fallocate(struct loop_device *lo, struct request *rq, loff_t pos, static int lo_req_flush(struct loop_device *lo, struct request *rq) { - struct file *file = lo->lo_backing_file; - int ret = vfs_fsync(file, 0); + int ret = vfs_fsync(lo->lo_backing_file, 0); if (unlikely(ret && ret != -EINVAL)) ret = -EIO; From patchwork Tue Feb 15 11:51:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12746976 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 66948C433EF for ; Tue, 15 Feb 2022 11:52:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237371AbiBOLwO (ORCPT ); Tue, 15 Feb 2022 06:52:14 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235055AbiBOLwN (ORCPT ); Tue, 15 Feb 2022 06:52:13 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2070.outbound.protection.outlook.com [40.107.92.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F483985B0 for ; Tue, 15 Feb 2022 03:52:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UV+F/JJnO1HMfNKZgk4xNiwGdlrP/6i5G6nT7vqGhjweZrBlAJMQ5XmrUMJsbX8J9hchCDNwbjXSYAodZWxJuL/fvsHgIvjYRKUEUWc3NpwzFzvQ5rg/2n+s3utPbje2zLbTSBSCS46YvMjdySjtX6Ew6hQIi/rK5h/Rr7knpPd5BgAAbeDGeOnIV5Pq/4gxsdwnBdkmJXrY8wsNzWRhjvi+vHcZuMDxXOAdQTs0qFpe5oCR++7BlEXkCbodxE+FT73NSaLcv30T9jISqUANULqpTTReiciDManGr/ZBNFIjc6yFKS7dK73//4SS0hxTjDmCGRbpKqsD0ufG1kukBg== 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=ZirCYQgO91Xa3Ta75VHvK+haR/Ieo9cvEFnC1t/Ya0k=; b=Ep1E/1KgorUD2gKm/hJNHM8UBnXuisOq5dYc5AL9F7qZQibahDXkCKBLDkeodoua5/ENAB0Z8JeZ1jnyW0L+aoNCWvV0OY32yy40qqNJtLY3rkGnzOO1l8lv/aWq+rR/Np92NwUiSBwjJFQDBogYwfyP7W/mz2kOJFzb2uQ8iOaHNItnSva7KMaJG7egtySAYfY57qYLPw/5URMfsRJ5J3IHWpeerfL3hCwc4GmSQKu+KK+dEkXylq1iLLtBEvCt+WCMLJB8r6wcil/xQvM2QFF80de55qefrDkf/JnIukJjRFOlU8DTyozOgkVz5MnCuxUzA+k8NJkG/3xmZTA9/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=oracle.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=ZirCYQgO91Xa3Ta75VHvK+haR/Ieo9cvEFnC1t/Ya0k=; b=MlA4s2QfvCJ8aH8WgzmeOZ+BwhNSONWu2HZB7fFgVXxgc5F9EzYns2x4JTkpzAcFBXJz59jsI8mQvKndsTrgov85hcK1ijNBCQhSg3CcCO241k0LnmiZJkHe1+yLsu/xzpzihLxUjXkzsGmKP4wlAUSXB7Vay1vUFdqPRh/0gyzWr8ZFC186n5/8hBgaNyBz2/BZcDrhP4alHgz3tfSBL50/oXO8YFJzAqHQya/apX6nMm1RKi5D6WL+zyZGbd2Qz/tAPvHKDPSktKixOx48njSYgH1YbumP+8ViuVFU0R4/rTarg9ZleEJ3ZGrgBMQSTapQ92U1rl4CbuzV47NAPw== Received: from DM5PR2201CA0014.namprd22.prod.outlook.com (2603:10b6:4:14::24) by CY4PR12MB1301.namprd12.prod.outlook.com (2603:10b6:903:3e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15; Tue, 15 Feb 2022 11:52:02 +0000 Received: from DM6NAM11FT021.eop-nam11.prod.protection.outlook.com (2603:10b6:4:14:cafe::35) by DM5PR2201CA0014.outlook.office365.com (2603:10b6:4:14::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.17 via Frontend Transport; Tue, 15 Feb 2022 11:52:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by DM6NAM11FT021.mail.protection.outlook.com (10.13.173.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4975.11 via Frontend Transport; Tue, 15 Feb 2022 11:52:02 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 15 Feb 2022 11:51:59 +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.9; Tue, 15 Feb 2022 03:51:58 -0800 From: Chaitanya Kulkarni To: CC: , Chaitanya Kulkarni , Himanshu Madhani Subject: [PATCH V2 4/4] loop: allow user to set the queue depth Date: Tue, 15 Feb 2022 03:51:04 -0800 Message-ID: <20220215115104.11429-5-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20220215115104.11429-1-kch@nvidia.com> References: <20220215115104.11429-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: fa1065c7-2381-4e26-d2b6-08d9f0799476 X-MS-TrafficTypeDiagnostic: CY4PR12MB1301:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2582; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wWjWKDtVjdiuJrBZ7W4ZDJqEPn6wQcJ+Ax+NN1U/PKDuWkS+3wGnFCIGegHmS1q+CewjQ+yoaOp3YDtrERqvuIXzeEYLwgQORmdyDE1k6N7yWbJ62/GaCXV/6NDvYmb4IKpw7MUzjHWuYoz0oubCVaBQIKz9k91Pl+TB1GwkiTqPIDAnU8njue48Ly/lkiqJ6oDPxj/1F3QJ78OVpZfDWkjVmERcX8l/7H76IHkhSAffNrVWPzcaJi7zQt+F9X6pt0RdOPcjQcUz5JTg94A33LJLOyWdtuN0FR8BIwSuyL1XKDlJLHpINIijpAGPoq6VfZqmmrwnfoUmX3YY2es4Xfd+TKe2tb38Swc6NDRrcWeyDNhouegTzXFDZ6TqQuJFyQvu5drCoU9NmDm8yI6bm/Vs8H4e4ILisB9heSqoXcF0nbRFilk2KnHIqxMaxT5aTLSUEL3MMbPyo+GgLAKldMyWQNreIzMt/4OWxZRHwcs/XF3C2kmJ+YJYCKsNw4fvJwd7H6pc0puApuBL+YNj2VM8OX8E0gK1jgtsBaqZZGaIBuSV00wDJ36pcnTQUp8Ft2dovOGVU2dsIw3AKf0b9OcygCURy8zOscDpF3t/xyN4sPfNFBhOyAc13qKFUyXsS6JCkYobdGgRLLze28MMqKK71zfHKx6I+i4MxytEWuj3n1ZYrZ5GPPYrq28HB+p4EOt89X33EujNfrxwnb8/ZA== X-Forefront-Antispam-Report: CIP:12.22.5.235;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(6916009)(54906003)(4326008)(8936002)(316002)(36756003)(36860700001)(508600001)(356005)(8676002)(70586007)(70206006)(81166007)(47076005)(2906002)(16526019)(40460700003)(336012)(6666004)(426003)(5660300002)(1076003)(7696005)(2616005)(83380400001)(186003)(26005)(82310400004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2022 11:52:02.0910 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fa1065c7-2381-4e26-d2b6-08d9f0799476 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.235];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT021.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1301 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Instead of hardcoding queue depth allow user to set the hw queue depth using module parameter. Set default value to 128 to retain the existing behavior. Signed-off-by: Chaitanya Kulkarni Reviewed-by: Himanshu Madhani --- drivers/block/loop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 18b30a56bfc4..fd2184d63c11 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1785,6 +1785,9 @@ module_param(max_loop, int, 0444); MODULE_PARM_DESC(max_loop, "Maximum number of loop devices"); module_param(max_part, int, 0444); MODULE_PARM_DESC(max_part, "Maximum number of partitions per loop device"); +static int hw_queue_depth = 128; +module_param_named(hw_queue_depth, hw_queue_depth, int, 0444); +MODULE_PARM_DESC(hw_queue_depth, "Queue depth for each hardware queue. Default: 128"); MODULE_LICENSE("GPL"); MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR); @@ -1979,7 +1982,7 @@ static int loop_add(int i) lo->tag_set.ops = &loop_mq_ops; lo->tag_set.nr_hw_queues = 1; - lo->tag_set.queue_depth = 128; + lo->tag_set.queue_depth = hw_queue_depth; lo->tag_set.numa_node = NUMA_NO_NODE; lo->tag_set.cmd_size = sizeof(struct loop_cmd); lo->tag_set.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_STACKING |