From patchwork Wed Oct 30 11:19:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13856344 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF4481990CD for ; Wed, 30 Oct 2024 11:19:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730287157; cv=fail; b=t3JVKccNOb+jGr1Mzlt9cwBJM4bO9cOvJhOz0Zd0AYvZezFoxA0C5uQDZsFsRcZIejzA6d+g1WwkZbbaWedMzDpfJ99sqh++eJXWpxfsptKqMe668D5DIkz3MHsXDOwGr7ZP9piKwa0tp1WlzlkKJQ1SsBwdV5EVfO2rHuChcWY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730287157; c=relaxed/simple; bh=IjZ0e14H9VTZ8CcXdmRKclcBP/MrvGtnEWXSucugl9I=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=b11yx27NRkRVt/ZcVO6hGvctfoIVRSJqdWbwLV0/faYlbDEEzhakoCAWWTfiYFiivVvG/gAAZVTNp+NiAhnKak0LYtFRN01WLOrgXO6zSgG1cak7Db+1h+FpR/ExjmIary1WXFCju/heZE3n96b2H/O6SwIXMjjfNdveusMGHYY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=E7pypDR1; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=JuAKatEC; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="E7pypDR1"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="JuAKatEC" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49U1fmaZ002394; Wed, 30 Oct 2024 11:19:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=corp-2023-11-20; bh=KsQycY+lCRrTBSa7 pJ5A6SBaNu71TWTrqsRed1coVL8=; b=E7pypDR1CPZ2/nLkV8wZbwfSehRPQ7nw bRl6BeUJXUThsRI3IQ3znRc4U0vWohJyRLdl7OI9BQtrAMFJ+h2m4yOvi5EbT+wK sGYmGppP8Fc0CshA6yuFAegk+sqX6eycQcIQNESCB+EcsIzIu5S/2j1McizR6l0K tt5T0UOqyjABR+U0sQDqMXUhMYtRAkJdUqaIxMhRJpR76amAemCZ4jlsOIg8gFdx tBjV+ebKSOEEQ4FbgBsUTe1f7HgUv5rpfjnb6cjiEbTwJofi68uaeQNkB/1esY0q 7q+woEECvQeJ+54iNTQR4B0v3IujMJ8u8K3jUT11+dIBta1H9fTItA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grgmftfp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Oct 2024 11:19:09 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49U96I5u010152; Wed, 30 Oct 2024 11:19:08 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42hn8y5jw4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Oct 2024 11:19:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=t+tpoct5k5g8Kg5NfSept1AlrCK7Bsz9edT29k1ckO/1mp7n+R131gcQbWZ8niAmD5GqanYrSE8PDnXd55eQI6sNHP5H3jq7e0YuZMoT7eM7AfVn+2ieRW4UPDnij9FEe02FmpXTqEJslMWFlgp/hN6LEfRH2J9nKNt79YRW1AdUcY4DbEnTucIQQeHnXU7sF9iElr1GDxvdIe8De6XsygSe6OYUUOuQj4et8qxusfGYA5A8uw6fWhjh5G5bE8RTiLsjus0zqQ0GulHObCRnJiuJB7sBKtrJ6TQfKGltN5xpJs1yczZicozuOf+Jpzjzs6yotljYgCwXz1lR4aUsIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=KsQycY+lCRrTBSa7pJ5A6SBaNu71TWTrqsRed1coVL8=; b=rJvi+RAQYJOb4vC2zJeZqsYSAyLlGd35pBjmqG69407PHyGD5VsQ/HAgvgS++9HmOLm+IpJPbTkr3KMYLwTIJi3ke4Y62cjUW5tTz3vnV4dFAhLLyAFl0skuXsPAsNo1SYPYBEQItcs/jmKq/M0bm1Lc1kRxWXGMCvq7P+YV3VHxVl1IHQJADMB4Rlf+nuvs82pPCY885ncpnC9GdY79sRuAWwan5gH0ClYynHLtFxovootqMXQXe8DRrdoM4Ns2D3QkzpPYbn3sGr9PROSzsLBcbBQrCD/7GtkHle+nkUnJyp/UCmeUWjFnZ5Td3KR6H/v+0x0cLIT47sx5wJCaXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KsQycY+lCRrTBSa7pJ5A6SBaNu71TWTrqsRed1coVL8=; b=JuAKatECBFMG/yG0guFUH7pZyhz9Ta/w1FpBHpXBnExEMhU1OzME+1KWvdxsa24saJSRxDJliUlL9xiYnW04kqmBlNTF5dJqzazmaB24e72ZIBTtQj6uSxSot/FkLuyPa9QOJB1KexszEcno3A0J+OUYvQSH+hFbX11kIAjbBvg= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by MN2PR10MB4206.namprd10.prod.outlook.com (2603:10b6:208:1df::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 11:19:06 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%5]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 11:19:06 +0000 From: John Garry To: axboe@kernel.dk, hch@lst.de Cc: linux-block@vger.kernel.org, John Garry Subject: [PATCH] loop: Use bdev limit helpers for configuring discard Date: Wed, 30 Oct 2024 11:19:00 +0000 Message-Id: <20241030111900.3981223-1-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 X-ClientProxiedBy: BN9PR03CA0615.namprd03.prod.outlook.com (2603:10b6:408:106::20) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|MN2PR10MB4206:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e53e48c-87b5-49a9-bdca-08dcf8d4aa77 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: WcL1iOYgRwYvRqmrxMo1yGBf83JaE3PiKt982MPvp17o1CpZgVdNH33Pt70sIFofQGnfqgf+4n3AbI4ss8cWRwYfPzzutrrd3vo4w8x/LRqfgGRelDpJCP3cTV40Aw0mqnYrl88rlHfi3ArjetnWmzIpuw/bEcLng3d/vZolwiV/ZqGhL9aN0gJvzUdJ73sxb/SYME4NvukhxcsUE9Zqy9L+SlYkJvZeb+ly7zLRek1uWUzQ0hCBiMTtAn3u0vj7aPwqmm+4QcSvTd/eUZhWUGwuGWsklaSdDBsRF4WkwQbTBKcbMZvTrH2zs4p/l9gGitH0bF2KNwqxdyTMTYoaunsEcLGkFSB5o679MoPE/vH2aXCi1FA2wRT47lvrLlIR4iy/TAS6R6Q9uq8R0NHaEhRiF5VKCwUu+y7Gru92ukZCQEaH8hhG2BuQc/+iKEgQe8LH7P/MJ2i2inS4lyRI3Cy/HqUXqo+Ds6elF+OPPiIbadyCs+ATADX9RwsPkZWWECgIcoONB8h3FsMnzT+K3RH4AWTOlajydEcaSXe1ojwFewnwSUX/SluGMvsdx6xAVNLsGQfWPqXEwjK0Ixelm6sf924I+Mj4r3NM4bywqQ+yMSHhf+UhWQIdM4jMCBZ077wKgSS60gaA7R6wsSUEwkWK9k77SmXX82e0Xzb2AlvPipWrplqCvNisOm4+c8tSvYEyKe/wijWHmLGd3pY4kslASDZEOpOf6Pa1zWqhfsg1yArMvS16H3NhbSEOY4jE9J6jo2/WHAfbvIC7qsIgJ3lay8Y7dh+Cl7VinRwoevWhq0OuP1kh9s7A38Z552epd8TCgvGTY2W77ujqzXzoULFDJuYqqfvm8A7q+ZBfGSn+bSZUCY2zdLH3OjWQXQD6vY85GnXaJ3rX2Xq70+NMDmWrsK0oFtqXXzeUSYBc0uOeoLSA3ifiHj+bnL+WgzILzBxVsEOWKJGnYF8DEJDk4mNMWiKs11FmKE9/avxUhQkSQTIBGJNbHE1tCY0OlE/gLDpV93I5WJB9TT0xQ/U2fcOFLhZkkpYHHoY9g2dtaavgyhjZhyqehaVnCHSXWhdBcAzG2Kv6WsbNTgBoX2PPLZRk809E31StWpyWQePM5wZ2sC6mKszq18cqf2A/uhYxATi1TIfNn4+UvXWZxuszNWGvXgtRu0TW3FxG1nNbhLr2HD10el7xOOUcuNpGQjaNdMRNw1q3pRRnEiKxFOA62wcDYEHbam1iZkto0J6bbjLmnfQs+A/rDM5GeiOZxnyeC0YHpSOYbFAjnnA1T1xKKZAH/XzWFotMHlbDue2Oosc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NC3EbALAYtyYp4sl1nMCtAKhY/yDDUYooKxZ+MPbt2FlzmwjgDJFqjmKqgY96vx0P6Bavlxah8U9mKL3IS+Kt/Mw+cddlc4UeNFWmIK6sWJj3S0hBPH+RZW9Dy7M02cdHD9ESgSzh70gTm/Pv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TRUSJcRyBgjGfqt0zOLC+veodtw9vwuX56cwBL+QCzy0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e53e48c-87b5-49a9-bdca-08dcf8d4aa77 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 11:19:05.8795 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FGCdBsPhTorilnKWdRm9glrbE8PMnnWD4NoYYGu72Ol4nWwaGSku3Gv1ZE7atMkbFTKcpVXQsFXS1cZjdKg+rQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4206 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-30_09,2024-10-30_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410300088 X-Proofpoint-GUID: DRR77gLAjVamr0AHQHp3vaSoVMhkT4Id X-Proofpoint-ORIG-GUID: DRR77gLAjVamr0AHQHp3vaSoVMhkT4Id Instead of directly looking at the request_queue limits, use the bdev limits helpers, which is preferable. Signed-off-by: John Garry diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 78a7bb28defe..7719858c49bb 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -786,11 +786,11 @@ static void loop_config_discard(struct loop_device *lo, * file-backed loop devices: discarded regions read back as zero. */ if (S_ISBLK(inode->i_mode)) { - struct request_queue *backingq = bdev_get_queue(I_BDEV(inode)); + struct block_device *bdev = I_BDEV(inode); - max_discard_sectors = backingq->limits.max_write_zeroes_sectors; - granularity = bdev_discard_granularity(I_BDEV(inode)) ?: - queue_physical_block_size(backingq); + max_discard_sectors = bdev_write_zeroes_sectors(bdev); + granularity = bdev_discard_granularity(bdev) ?: + bdev_physical_block_size(bdev); /* * We use punch hole to reclaim the free space used by the