From patchwork Fri Jul 5 11:51:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13725028 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 5434C149DF4; Fri, 5 Jul 2024 11:52:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720180332; cv=fail; b=SEy3hp2sqJr+NfxGAsP7e5rf4WpM/+KIzoskDct5g5RDysFFfwyznCXP6RP4gq/1xYOhNvl9YTovh24rC2JnmUr+ALSRK6i6Qv9Zz0EVn882IKn/+x+KaEfM/bGsmhNfpfZbXIDYosi+kkAIxwzhYfi2kS3Lr7qAHqs3MuvX1q8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720180332; c=relaxed/simple; bh=ncHA8SwfItHsbOL4yv3d6NBtLPJrYNNnxtzRWXb5q7o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=EtaLKqn2S0UOr1U8rpqWKQuNkG/kopbWxFCk67qUMBBhaF70kAnU9dbSAKOYIXMxAmVWpue7QiEmsGMVI71qcc9RL+wN9fF24jT68ACbfrxiQfJIWz1ILnWiT3ScKH+O/FTwIECqJfzCwjA2737D282vDh+LWg4ddIQzMRG3UVE= 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=E3OCYe3S; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=PVTWdxSb; arc=fail smtp.client-ip=205.220.165.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="E3OCYe3S"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="PVTWdxSb" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 465BfUkx018372; Fri, 5 Jul 2024 11:51:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=c9CMuLYa5e9ILib0LpTRq4VURr7DXr6TolNKz+p3t0A=; b= E3OCYe3SGFNdmaeb4IIDN2anQr5aor2mFKWBCNRwct2yhhpLRoYjovnQYooUeUgi w9WV6fElhx6PW9g8Z9lb7QfS/fp12xUcA8uTxljcTh//oAiOa01M6J6uTVjLSzhQ +4eGgHeIo45UTrZQsn5R5cwG25QMQnFssRI/3YdKrYAQ7JFUxtUSszICTujPC/1Y L1dupJk6qlyKSZgQKFtuszf6iG4sO/mYhQ55qMoUpXvbypyk4QiJ7U/oRCyl5+Bo 7/Rz5Oazre82euzmmf3cXtkltUokTuhDpS5QjkF/sfmbH/ftbAN8iBG9k3q4u2xT 1VfMF9csCKUgrv2taza33A== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 402attksfg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Jul 2024 11:51:46 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 465BDgUU024718; Fri, 5 Jul 2024 11:51:46 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4028qbsb77-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Jul 2024 11:51:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DT0UyDd8YohoB9jA6QKfwAH5ZKPpZZObo7+F7bZbfIpkL8CfmPyBlnPJAWX52yIQqQx7pahFxBw80PSiye48qrW47FFDkgxWqSNCwasPKw+r1+ixAvx9DTDtQAZ48qIhAlug8two4wthzkj4OgInOvcckOmUOv7rxorkkSyaXN2iTv3KpGAC80galE/oG9Rdgl2u1GPdde7jqGV3j0Rvehz2tPNVcYYRkVhAfQxG9Y/OlAXowO94k0wb6Azq5M769HhCzDzECpNzg9WHFILMBBXYnop6bpHoW6IGazHCWY8R3XDxotepzSzBpazCd30enQedR6p0fgZm1XPXgfxOXQ== 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=c9CMuLYa5e9ILib0LpTRq4VURr7DXr6TolNKz+p3t0A=; b=IAO6PnfGbNfANDQDjrH9DIAeNvtYb82hD0BM+FrKsdODNrG3yLfSmp8GljINUGYp7rnifLePvtJCQEsFI72YInoWyOusRNjUDXyRkwJfeVlYHvkc7ZOV8dGLcFNVLccDZ8BMhDFjqvECm86A53rjqBmGNDWQ1Lfdi1gs2I1LVKFxYvRUT7A44MgVRSpFuChYFFSFF1H0Ig6pEKUaotZlyt/WyebXqfv6zefUXVuvLptDgzI7ayicuOW9xQ5HfHI1ieR0+/urqA798rakfJlEatG0aVhH9WXYsT0XLSy7VM4Jo1l+jbU5OTyrznsb5mm7u5rK7FuHl5sl2neVBtKjwg== 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=c9CMuLYa5e9ILib0LpTRq4VURr7DXr6TolNKz+p3t0A=; b=PVTWdxSbl2F4FNdgN4CxsMUYTnmhDNNLesEkP82yaULvJBHWQJ8xO9UU1vHP6EcDEg4no/8ArR0+BODn6Hbl3HCmGdi/Fv1k8xWCBEmRgBBfhrL4p7YM+htmOrjEqYnI6PhcqZq4SF2v6kSADhyEduI0tNQ29kGM+7nPIAD88KI= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DS0PR10MB8080.namprd10.prod.outlook.com (2603:10b6:8:1f7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.27; Fri, 5 Jul 2024 11:51:44 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%6]) with mapi id 15.20.7741.025; Fri, 5 Jul 2024 11:51:44 +0000 From: John Garry To: axboe@kernel.dk, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, hare@suse.de, kbusch@kernel.org, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, John Garry Subject: [PATCH 1/5] virtio_blk: Fix default logical block size fallback Date: Fri, 5 Jul 2024 11:51:23 +0000 Message-Id: <20240705115127.3417539-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240705115127.3417539-1-john.g.garry@oracle.com> References: <20240705115127.3417539-1-john.g.garry@oracle.com> X-ClientProxiedBy: MN2PR15CA0035.namprd15.prod.outlook.com (2603:10b6:208:1b4::48) 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_|DS0PR10MB8080:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fd3ae65-49c5-4c3d-e29c-08dc9ce8d752 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|366016|921020; X-Microsoft-Antispam-Message-Info: MwJWf+AI811iC4lwx+1z8pmxmu1UOn0wI7B/GOJjFFAOmBODRtnFvuU0qIsp3YrlFvmnKs4AuOdIvtG0JzPoApcanIf+0KMATZGOhmNkVDwn0EG00eU0u8vIYgPuhobcnmnlLx2goKhHPjrnhDDs0iuCniZIXBa0mF5Pj/hDG0Aqjt4rsWiM9JtVd3v6HHmdwO3i0Kz877BH1kXAfqpXU5YnhjSMYxek9j4L9SM8zgqYBf0tEZk3H+ASOA048L6/GrtyACTrRGNcGEfUhTW3C3MtP6++YLfKkjP9/2mNA8zLcHsMFr0aDAYmBP/CT1H50VlFmiNJquMncka5mHDzA5no54k083mjKkfefSaTUZgUiPfyppZysscoEOJrX3NTRTTMKI6D8Wngr5n8F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:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(366016)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w+1lupItHkvERglqKTJLAYZG3LjwdDauLKyccOWwRNy6C6ESoPvVbxw4gbbENPNIpWfElA+j2s+vNMJJO088ekKy87PyGBHajijfEm0C80RXqWzKWZwHtmDllHKZdEZ4fWdzhekkxOaKQe+KkBeIzGiWe9moXoo4ApRWKOnl/ZfGSYA0adBEEOSwTBBZSpTrgHLpLzxmapXBZ850puV2iDSkZuCni5YWurfd+VaLi3AzE2nsgLTdOL679g0ERWLw65vVu3HIETLJcxx8NDm04BQiNpXfHABNgsB7f8iSeB/1l8VPHtPxwSTvEIKCr10hOIOhfk3g9zlqwGO8HnleLxFWlrFW7bCoMpvEWD8WcvPzQLgg5ms2z+ynqhY28V/gtwBYA+Jl0lJcrDydXikJYVGDTmMnCoLgHI4svw0coOR94Qv4JMCybATX921qT/t2OElyIvWb72EieB3f7zwEa5gCCnbtC5mh4a8cUzM9k6YKWgb6zKgpSlD3jEbX606xoqokhVWL7APL3KyL7kQ+com27OE54hkiFzg5n/FnZ1pp2ETR55LLTtgrfCHqogyMY+IO7YPOXrZ72t3EHWUVwS1UCPwoxmM88Wxc7Fm0+YURN/DTwgn9pvNXAwLBz1RqJsGFjac/WsgCIuAkHXkWIXAlau4Ivh8XHdsDlhUJWjM2DyMm05hvyMk31GB8TC/SR0y6XtabJBnFNZ50sNiNlRd+BzUjVLK9VZE1DCU4WhqDune/NIjT6PPPzKnBiNrTMpUrJRtekUpNwhcUy/Kc6aFjI+9gp++vBprwjWrefP7eDOrw0SD2SDZCLQo6BIrjaYwM3sxjdLUYpDlWvEQpu/42QtNBkG7YhXIexM+R7AJslZoBZHDUWndlOgwRGZBe5rsMMOquQ5Jxvd/6qIbOnuey7rIy454TDgYW76HbXvQ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SRfa6yVVERTM9/OpvMvpxDIf2Il5VZv5PSCAEMHdd+830tNBb+NnEPyLnfnQdpAgyTE6lBxFSW74Ruos77d3CiJG67EhrXPOL8/ruGgYPD3qIRG/ZmO4WrGRz61FXSX/uC6Fbl8VkdOr7HuFgnsv+XgacxuVkSLqy7FzFPHNNzXFzlocF8Ut7rjyfpJn8RSBxwSOnnEO9lsMS4/2HNC8d5Y4Evks4pDwp1DppCCnKoMmv7Rg7gyhK3etZKerYT881Qd/WeQJZqKuGY6ITTisjqDupanDt6SQglmGNnMpHS6wvvKk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fd3ae65-49c5-4c3d-e29c-08dc9ce8d752 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2024 11:51:43.9597 (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: EWZ2qPAo01n6YheNkcD+biSde5yD3tNkyYD7Wk7eTRp5i5t021rmrpauuMyvCr8pFZn/YSk6wcAh/QMBW/2jjQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB8080 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-05_08,2024-07-05_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2407050088 X-Proofpoint-GUID: LePd1kwQhJeBcKEmJPgNa98ueFmK7FK5 X-Proofpoint-ORIG-GUID: LePd1kwQhJeBcKEmJPgNa98ueFmK7FK5 If we fail to read a logical block size in virtblk_read_limits() -> virtio_cread_feature(), then we default to what is in lim->logical_block_size, but that would be 0. We can deal with lim->logical_block_size = 0 later in the blk_mq_alloc_disk(), but the code in virtblk_read_limits() needs a proper default, so give a default of SECTOR_SIZE. Fixes: 27e32cd23fed ("block: pass a queue_limits argument to blk_mq_alloc_disk") Signed-off-by: John Garry Reviewed-by: Christoph Hellwig Reviewed-by: Stefan Hajnoczi --- drivers/block/virtio_blk.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 84c3efd0c611..f11b0c3b2625 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -1250,7 +1250,7 @@ static int virtblk_read_limits(struct virtio_blk *vblk, struct queue_limits *lim) { struct virtio_device *vdev = vblk->vdev; - u32 v, blk_size, max_size, sg_elems, opt_io_size; + u32 v, max_size, sg_elems, opt_io_size; u32 max_discard_segs = 0; u32 discard_granularity = 0; u16 min_io_size; @@ -1291,44 +1291,43 @@ static int virtblk_read_limits(struct virtio_blk *vblk, /* Host can optionally specify the block size of the device */ err = virtio_cread_feature(vdev, VIRTIO_BLK_F_BLK_SIZE, struct virtio_blk_config, blk_size, - &blk_size); + &lim->logical_block_size); if (!err) { - err = blk_validate_block_size(blk_size); + err = blk_validate_block_size(lim->logical_block_size); if (err) { dev_err(&vdev->dev, "virtio_blk: invalid block size: 0x%x\n", - blk_size); + lim->logical_block_size); return err; } - - lim->logical_block_size = blk_size; - } else - blk_size = lim->logical_block_size; + } /* Use topology information if available */ err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY, struct virtio_blk_config, physical_block_exp, &physical_block_exp); if (!err && physical_block_exp) - lim->physical_block_size = blk_size * (1 << physical_block_exp); + lim->physical_block_size = + lim->logical_block_size * (1 << physical_block_exp); err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY, struct virtio_blk_config, alignment_offset, &alignment_offset); if (!err && alignment_offset) - lim->alignment_offset = blk_size * alignment_offset; + lim->alignment_offset = + lim->logical_block_size * alignment_offset; err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY, struct virtio_blk_config, min_io_size, &min_io_size); if (!err && min_io_size) - lim->io_min = blk_size * min_io_size; + lim->io_min = lim->logical_block_size * min_io_size; err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY, struct virtio_blk_config, opt_io_size, &opt_io_size); if (!err && opt_io_size) - lim->io_opt = blk_size * opt_io_size; + lim->io_opt = lim->logical_block_size * opt_io_size; if (virtio_has_feature(vdev, VIRTIO_BLK_F_DISCARD)) { virtio_cread(vdev, struct virtio_blk_config, @@ -1422,7 +1421,7 @@ static int virtblk_read_limits(struct virtio_blk *vblk, lim->discard_granularity = discard_granularity << SECTOR_SHIFT; else - lim->discard_granularity = blk_size; + lim->discard_granularity = lim->logical_block_size; } if (virtio_has_feature(vdev, VIRTIO_BLK_F_ZONED)) { @@ -1453,6 +1452,7 @@ static int virtblk_probe(struct virtio_device *vdev) struct virtio_blk *vblk; struct queue_limits lim = { .features = BLK_FEAT_ROTATIONAL, + .logical_block_size = SECTOR_SIZE, }; int err, index; unsigned int queue_depth; From patchwork Fri Jul 5 11:51:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13725026 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 6FFA2149DFA; Fri, 5 Jul 2024 11:52:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720180331; cv=fail; b=ckjIon77WfoAlovVKqXh0fzk/JFzvjRA1a3JaqG9R5h2lfl6gJKueQddnMCZHMi1fdiFv6/9H3KsTWTvU+YBAlXN1IKU/VCXxSwFULK3qbRPitqhNQJ5ZI3NXWtx8gbHo8z3Nat9/8gfEqBQseMaeQkKUAZB/91zFAW4PX3S9jk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720180331; c=relaxed/simple; bh=bvZdbws/YR9PlUnSIEyrRFeX2cx5WWkxJYf+wY+iB8o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Otb26cgDotZ8Sns59Gk/U6zgRVu94TQ4F4iLBtz7lGLpINZpqDK4yv3giz7N2N0N29wHec4qyRlGsSBjmnt1PuFPdL5qG7/puZsxgQYzBGvkrIBilq7ocLm6KZFcL7LqE+hnukoy9/uHs02ww2KF9ZK+HbBtGbugCADOw4RhK64= 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=L3ASgCNi; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=UA0e0vbK; arc=fail smtp.client-ip=205.220.165.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="L3ASgCNi"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="UA0e0vbK" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 465BfbmB026082; Fri, 5 Jul 2024 11:51:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=E/N8uyy+d9hnT366wcls5uEgZcCdVabP2DKuBmQIVCs=; b= L3ASgCNi6zbIACv5QeRQo4W+5Wt247joM+RPMOAXZ5nzxNRzVGmNDQPtBb9zcBVQ Ja7kDsh0ibJrlX6t2zrCMjhQRVtlKAVAJjypYJ60J67cGbpcK4xSrDh+b9z6y62/ xlzlhMW0uua2aS+laoyjVYGDZHarmHixqv1r+LZWKCeoreSw5BuWpnH6kEnLIPPF VrEzM70RLW6YuktWEyh5pM5y0TBVoB6HEkYTHDFlxx0nKEEeXxosJ1bmO1YqYSMw A793WgrrWAsGyqxj92JIwqIautOE8rFua6lsful2zsR65Kskp/+W8AYwBmfHg1vG FQvqkh5K/kEJ5x7c+uh59g== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 402a59bhbw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Jul 2024 11:51:47 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 465BDgUV024718; Fri, 5 Jul 2024 11:51:46 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4028qbsb77-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Jul 2024 11:51:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XSXShr4Q46AjQORTAgauBqIL0GHr7PMdVRAo3yilnWRZ0vey5aW2+Fgx32zQLG1OQ7iaKJFHlb+eCIlo6TF8VvzusumWaW0BI4HOydNtGujK7VgdY6EUfeybR7orwPQBnwouQiOg4jnY0Zc1Cb9+Aw7z/Izd1/yMS6dn3yTVkbWO/KjJmxqalDnShp18uRz4EPygQz4x2OswGEt58SYNhFgA8MeOkmnGICY27tWx7QgRiGS7wN4hbhrbrXvTqgi/HpwOcaNLLodwugFotHTs7odUAPAdN+rRu0xyaHQmHh0SgJLkKgAd/zatkfKcDQLvjjoszVAazWrWg79d6BTBwg== 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=E/N8uyy+d9hnT366wcls5uEgZcCdVabP2DKuBmQIVCs=; b=Aw9eGurDW0gPmnnNzAKGmuLOiCHIFLkpopBSW3bO/49j90Ac8NiXuKrQRlUBZN4U2UGV4wx3fxdLA5SZg37OLYlzM0MpuUbrKmj+AMbB4e42REyevBZGL0oOuwBigKMj/s5PxmD65aNUGD++rNOMRwveYpl19/jt1gfrnxxD+L5nBAK3Ejv9yVLS8S/PkHosvguGQsNejpOa1fjNAY/5d2RTaKPE8QmEo3muIQn6z91uLDdrjuDDGtMgWlX85+vH8D+h4JanDLsM30UgvEC6RGUsR/3WC4vusqWw392YCxDUpqHot94IZw97ep6ldkrHcTlfr5LQnQ4581CUa0uq6w== 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=E/N8uyy+d9hnT366wcls5uEgZcCdVabP2DKuBmQIVCs=; b=UA0e0vbKe1JUhv1lhjileqzGhp1VaFqXnBxY9O6Ly4yJE/wbPCqj+92jljFBNhL2fVaHbI7d3PSb/hUTZ6mM9vnUZmJhuEihpzPTMRbReJfVCqcI78zVlXfM6+eH727f1JyVt8HgSzQataL9gChdOCcelvHfHP7bbUJYlDvjKbE= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DS0PR10MB8080.namprd10.prod.outlook.com (2603:10b6:8:1f7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.27; Fri, 5 Jul 2024 11:51:45 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%6]) with mapi id 15.20.7741.025; Fri, 5 Jul 2024 11:51:45 +0000 From: John Garry To: axboe@kernel.dk, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, hare@suse.de, kbusch@kernel.org, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, John Garry Subject: [PATCH 2/5] block: Validate logical block size in blk_validate_limits() Date: Fri, 5 Jul 2024 11:51:24 +0000 Message-Id: <20240705115127.3417539-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240705115127.3417539-1-john.g.garry@oracle.com> References: <20240705115127.3417539-1-john.g.garry@oracle.com> X-ClientProxiedBy: MN0P220CA0028.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:52e::21) 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_|DS0PR10MB8080:EE_ X-MS-Office365-Filtering-Correlation-Id: 9094d68e-0c63-454e-e8d4-08dc9ce8d806 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|366016|921020; X-Microsoft-Antispam-Message-Info: SNxQns7JZ2QGJpejloaQH2myk10/L59xd/ytdyimn7aBAcxTn8OyHa+K2+jALPeML12JhypcBAPGbrcrqYlc/VyzItL6UwgMft/LVtk5srgMmsK/C8JXDVj4BRiXoh4ZclrSbfVmxYyDlim4nSa+ijWmewbFR5ksHMuUIz1PNKF2NXe0Qb0sgwxilKk2s1XdClg7f0CvnzaGhYiPolg6D9GJ8kpAadawRjKyVSveNjmqwYMdI0pUfu5djravGYarrAxAL46R+NG4tQKJQd+CPGmZvAF+3b8gjS54gHEM0K1TdRuPhZkAjRLpv543Ckzfht4Qd4lhm6htGT0SjUlBkWi6Ix+sXalyM4pb2Z+LBOTF3ngggKXUlIlNzfVk9IpUZLLiUDGg2yOl8F8LDB2TuA3oqyChNuMEXFXODazwuti3GPMpe7yEDj8Ylh5spbaOpLvgV+s7v6sKngycbYW6POhPe3pEEQVAtjmcgzxaZ0k9b4BMWH06LCSpFTzCBSGiRcN4iKQUzgAC4gdN2qEW8keFY1SCUw5WlK3kiyoTbkPJLoHI6Ni2wT3QwfSxo7qcUj0NwK9Hf18nb6l0SrthOOqg78ozo6J4K0XCWZ6m9066CgaWxhWk2EmXzOHG+Eej2dsIgBkkJUVmcPDQ4O63Yd90142mr8wkKwv+xrjNPEj1dgC+RHsnirMLXV0EUYK/ahFRvAjsEsVRiZu/z8fjBjZ1X9OQWmlhqdhaR4HOBsT/i4LO6iYmKW5+0idAWGmiltPWGz22b6lwx4JufFp3SRKl0bT2ldf5iK1RTiEwsdutykbKbTTzvOdf/+96VjtRbskATVT5clETpkMQvhs9bUOl+wmyvIAbEbV75VylO3jTD4alGFQW5FWKGTwf1xMwCoYDOXcnGJyAbVWyA1YjdRpqE+pDqTAKnz+bMvht0CeImvpGFbr4pamBqXqC7W1+vQnQM7rfSpQdij64sJJFWBONqa4iWgcoqyJSKGLLerRVxZ4Z1p9grHmT+c4965lbtaBldysHPwnB4MbJXZKQuec2HhEpYP5Tv/0QQF9+sIpS4QqYzcpVYBgNRwumD/RlR7s1JMkw//0sXQ0qZDuKiQ/D6AUN9XjyW11nwTTL2jdV7upL/A00roK148OVvzAD2r/CQpZ+Xw3kvOYyXCfb4u1VXFDozsrjKNCKrBPh0Ldlkanf/GmK31j81j4VYNoqJnC8x1vWndmWxmitC5rQ38fcs49o8wD71hygKoKVvFX5NeNLr8e3eooOs2TfBQGeD9u0WzsXnIMliW7P7NU4hC2d7MKBgokiGh853x7AvLDxaFCymBU11b4Ojq2TXHLpWMFIciu8b/M4PSWXmxaSwfDYf15icHL5hyu8CXBQbMAqD4ui4/ORwCwGl/IoShs6 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)(7416014)(376014)(1800799024)(366016)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5f/kwuBPLkTtD800zAica4zdCw1Jl0OuissgsnvdtymnT2GJpNPsISJe1E2O/qwG9qBh5GXt1WNqA2yTt+mL7LQqrZOyG9rvu3nLqLoXLYq6sobPj2ag5PbAD/xC9ufXtO0AuvFy828H85Au+ALxSmpUlhj0O4grtPDTiD17i4iCRPS0V26jSC9SnQp8m8pleq2jouqdw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kfBpsb1U7ZjOq+4dHBRVWc0gF2jy/GPL1VJpASDL0r4ET9idLQKK3MwywQfQWbxcVhcFS5Q5WWmL27K8sc2ugUj9HZePaS5lgVt4GSdIBqLRl7ndeF4zV3Ri9jaUdPJ2w8okx+FvoY1KMzQcF/MQ3LVn9jgT2kK1K95Hx/e88+ran66UrJMnezG8C3UMINTCb9MWsLMq3JBqOGBZlqirU8TSttHSzFtxiYasVTuDqjBKuI7/pqBr0n8sWC58i1N3QcvcZunWlHCG4N//WhWbx5vhGFhkAhc4ljtdVp1Avbk6/DF5h8sOA4R+L3nmrZTWXLBp46Iniz2lUpAGbkJr7yRlDzJEOQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: /rEoN0o9kGRW9rWKbdDmfbdAh41e3Moor/4LUQO171yQaKVyFuzu1K/wriFLMrF1cMqAPW5JLD5JcVfMDN18ll8tZtjZDiW6AYS/S6WW2a5+WahVcnlpPMFGagOtuwd71Tu9xzYEixc6SSVEU863u61fQ93uJei+3NvGe0AYKaqe8cm7/n7ArN2bKRfQ8JDCFPdfCdYHu+r0kDzkWS83Zl/FtIMB01CqBK5a7OBS4pDdHM3494j6BMb/m21EDU1M8hQLQ4aaxMSNlWQhI/nE3WGnoPMbNL2myh9NSQASjxvSJxUbHagOpm25iFBJHsA7JNlLIZvcT+tzzWW3qXH8MmyzQrAt2p96/mHRORYR/yH00HVhv/j7m0HxE0+oqI4KoSBMkhxxWlMP+LGyQcSvG/8GXTca2Vsu0orSa+OAoHXmt8CrtgJ7vnVAzuKwHFydr1cQrDQrSSoNQ3zS8qlgbotiZPF994FDsWPDxZ6N0EQ1NprPip3MpcE9wvvRJg903yEWefL4M9TOcqwkoSpBEId9dbmaaiT9jl0S02dSzJT+cbH1oKajE5a3fF+GdyaeXnYxOsT+vCnsjSPhdoinwUoghNbWpAC1roqTNDuW+l8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9094d68e-0c63-454e-e8d4-08dc9ce8d806 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2024 11:51:45.1728 (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: tVAhKGYIFfHmaUQmmB/9dJfCHQv10nEy2SoZrrMWPT07R8jpqHVQPyurybViDKM5ZrzfmLSK7oi26yRY0fhcTA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB8080 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-05_08,2024-07-05_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2407050088 X-Proofpoint-GUID: 1Gz9HHyYjJkNK446ph_2RTDh5cCxtdXc X-Proofpoint-ORIG-GUID: 1Gz9HHyYjJkNK446ph_2RTDh5cCxtdXc Some drivers validate that their own logical block size. It is no harm to always do this, so validate in blk_validate_limits(). This allows us to remove the validation in those drivers. Add a comment to blk_validate_block_size() to inform users that self- validation of LBS is unnecessary. Signed-off-by: John Garry --- block/blk-settings.c | 2 ++ include/linux/blkdev.h | 1 + 2 files changed, 3 insertions(+) diff --git a/block/blk-settings.c b/block/blk-settings.c index 9fa4eed4df06..55eef9541ce1 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -235,6 +235,8 @@ static int blk_validate_limits(struct queue_limits *lim) */ if (!lim->logical_block_size) lim->logical_block_size = SECTOR_SIZE; + else if (blk_validate_block_size(lim->logical_block_size)) + return -EINVAL; if (lim->physical_block_size < lim->logical_block_size) lim->physical_block_size = lim->logical_block_size; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 02e04df27282..7eb165bcc069 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -268,6 +268,7 @@ static inline dev_t disk_devt(struct gendisk *disk) return MKDEV(disk->major, disk->first_minor); } +/* blk_validate_limits() validates bsize, so drivers don't need to */ static inline int blk_validate_block_size(unsigned long bsize) { if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize)) From patchwork Fri Jul 5 11:51:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13725027 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 8117A14A0BD; Fri, 5 Jul 2024 11:52:10 +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=1720180332; cv=fail; b=e1pUWTShjYYxu6dwrG90wnuz8c+uCxRUIak0Q6Gz0E67Iff3uJsWq2FL0GM5I29GoYzNS618Ur8y+edXfdgfPIFe6n7p2mYEnXmW5aDuC+4uQZw2VvV1R68nv/5MtUysk27rOeGsqRSJ9kWPEv0BHALhtY1bhWVTzimioT1bb60= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720180332; c=relaxed/simple; bh=XiGZJ/ARXh2OsxVvRtifzncH6qo6W7FaSnOCW6CKrfQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=pZSnOGxhhGHXHG3qBTKULt+afYBwmE3MAolaXduIUvDgyEpIi9i6u8wPf9SvgRb10wChBs7Fx9Ef5H3HtamxRjwtBg2DogE51S4FXza4xVDgkClW8ePeLc9JzfeKfW3ZE4GPCqhgOBFVcDn6yJNbLxC1mshKKRh2qWAk4C7nlrY= 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=MeBANGmU; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=xuqWoocN; 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="MeBANGmU"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="xuqWoocN" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 465BfZLl017730; Fri, 5 Jul 2024 11:51:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=hwzFC/evgEJDWdIgKyhLxHnoKfGhRavP9Oubxj0XMqI=; b= MeBANGmUQhGSN02J/VCEeuYCYRO4iKuzaAomS7euGYxmKNDE4xb0j+M/GKoaHx4i 3AmNjj1OzvBqawWq+iU7S9i2BaKuTlxYVOs08E4b/JUbmECbrPerdzjmiy5kX5Bl OWAe3anyqxTpCgf8RuJRJRlOuVALOamoKLECDNJKK2iWdVNtCc1yrgvH9w4wJ1Ms FhMaWKZn2E2v8urM2wCmhLXfbTQJNGhISQt36f6XzIfF0k0pbn/jITFNHtphGy7j gAB73Eg20Zmj7TW5FQswJOkeuN/foWemDNurqD2stfaYxCZIZEc6rzxpU6TtoDeB 5PeRqxcj0KvSjV/mczeXig== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 404nxgnaue-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Jul 2024 11:51:49 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 465BgaHD023596; Fri, 5 Jul 2024 11:51:48 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 404n129227-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Jul 2024 11:51:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O5FCshBKa+E0ciGGljks/LoLvV1cB++445Zmy7GgldqWiOhiMQ1vlx3XJ/c8HZVR7c3ms8K+qHDUw153LyLmaZadDOTn1yI0S0VMHe9pwZZ1PxGIwsGIRLlsVCHsiJIDot2JvgY9RFXaEgqSvg2RGmnO3nN07KdJufDLzBgo614qE7iXlORRalR4ZXbf3XUQFNpt6FY9HBtjVWl4J2OyICEwPyxqOQsOh5ptWxzU0KCa8uFXhg1iCCF//5kox6If6I0j5fA2M9muOtEICkbs7OGVVsma8JbMCuaMybo+82w74y1NT8laD2MULhfO4irP5Cgdn/ex6UTGF1S+0rtJtQ== 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=hwzFC/evgEJDWdIgKyhLxHnoKfGhRavP9Oubxj0XMqI=; b=BXq8TZsHdtecaBtOYAK234Vafde0Gaj0Ngb4rED+LEcWSzXwfjRGNgLGu04X6XiXr8X5OajMZZOsoDGjrAw/M2wPlVAXc6/F+oF7Wjf3Ww859IeeYSmJSx9OdkQvDFwiFqM0VbrNQMYHl0W0d4Wid6wHXrRSfegu9KPFDFp0I6x46gGcusOqK6bNIapsIBKv1K4FjN4RRP3JxrbZNXejSyA826dIf9wf/UGNKJl6MwaeN2qsSU6raNjWjhra4ipMwMqc2BgVyR9P1AC+iZrFESKe5W2FXMl1Orr/nNH0ZIxsp/6hoH6OHJfbISGr57QvMjqUgZ9OuWngBKC9mq7EQA== 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=hwzFC/evgEJDWdIgKyhLxHnoKfGhRavP9Oubxj0XMqI=; b=xuqWoocNe3qK8fy7xugbECxmxnT+fdC2Y1+6itRCoO39gE9QHIcl3LimX7LV103DPFLCGKnk+IZ2tRuKmAHIQPJZRmIhweC0DlBNFgRQnkuora1FdKqIPgdC864ZBrH42LRzocfVoHd2a+pDJkyBByVpcfDilpViMsDMZVKg7DI= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DS0PR10MB8080.namprd10.prod.outlook.com (2603:10b6:8:1f7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.27; Fri, 5 Jul 2024 11:51:46 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%6]) with mapi id 15.20.7741.025; Fri, 5 Jul 2024 11:51:46 +0000 From: John Garry To: axboe@kernel.dk, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, hare@suse.de, kbusch@kernel.org, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, John Garry Subject: [PATCH 3/5] null_blk: Don't bother validating blocksize Date: Fri, 5 Jul 2024 11:51:25 +0000 Message-Id: <20240705115127.3417539-4-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240705115127.3417539-1-john.g.garry@oracle.com> References: <20240705115127.3417539-1-john.g.garry@oracle.com> X-ClientProxiedBy: MN2PR15CA0004.namprd15.prod.outlook.com (2603:10b6:208:1b4::17) 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_|DS0PR10MB8080:EE_ X-MS-Office365-Filtering-Correlation-Id: 54f72289-54f6-496d-029a-08dc9ce8d901 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|366016|921020; X-Microsoft-Antispam-Message-Info: bUJ7vsYy+hpbBudVZb0Qu9+B1qnS1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K1G6wSj8SyCiSnBZRV//0kQA4c2Gz5R60qHZkRcHvJF83dhgooI6knLTJZTB/fkPm4T7Hbie7fuZoAQR+wkBeuqkXUYOAcX493oxggCibzzgBoEiS0baCfTinRmCSlJ2/Sa8UKVhyjQUd+PK3pEsPkD8Bw2ekiuPHpQUcdj/kz8v8h13JJyQ2PvvJBC8al4UYZkzUXvbRmmjqkCftNUjoC6D2iKPXa24VnUuapeqQCfI3sbOgFhlOhPhCVwGYhxtV10Hq2eAGgTf6Ngo9iRTXK7lEw5pLV+EUuULD/vWNXK 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)(7416014)(376014)(1800799024)(366016)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HDZnkvV9pfXEluP+pTuuNt0Ri3A6emCSVY3+Lv8yqxGA2n0d7gbAVZxMc7gYg3J83TiTcNneFkjJRr/XyJWIg7VFES09d7YjBCq4B1wIHbIAltstoG1BQcTJ0pL+Evo/N0P8wKJjsYKyQYfwbaY7gaOyKOvvFqynTbSI2FUn1VndBnur9zvf3I3F9RTuPOIdDCULKEWxa/ob725KngyzO0cV+GDGtGF0yAw8mZSlsBTk9gqlaVB+iIBeBdiT/p0cDdQ7Je17geTTLcVN/qW/LRohsy5lWJFvJY705qjtPUtkw71WVp8pNIUEzRxituy/iuWLXcbgo7le0eHajhLI8kSxXQGBZckLVdgOhA9aNjWIUYjw61sk4abBjzcw0op9brEARib+juQnY3n6XqXZ8/tE8HLvOTW4yJNHePT9w14y1ppIFfvPivpWd0gJcf78kgeI4+zY0nq7iI5fmjyVVPLCRPmTbmckD27xx014A9DGXTgTbiu+0Hv25v0HO+rkE6Q+cVNKqVVaHAhMa3SZPRFK7c/Kv0QVGSoUwO/ng7mmC28mr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alHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 9ao/Nl0UIB8U4BTub5GRP7TH7GrM1EYDOHaXhg4VNcb5I+GKtYTP8sZn8zVneilHbwnMvTyIMtGXuIIQEf+B6ptRLO2z2nCOfz0upBdjEgqemhjk9XVCHEByj6ApjX5bCGgb288swheutGGKUywJIso0cXf8PG6Y6Olz025QHGfF4Prd3psVXFhGUlFHYJPmI8ZNCRQlf/T5JS62MBIocwesiov9bhYIf0MU/BpRHN/+2T4finj9ChFLlUGkH2IlZcvR/PoygE3MtpMHg21SakdegsVbw40tkkmhk7Y02mNe3rtRDlqbYZT1OpAzDnn2vSzYzYNMp2qMKiB2l9lyCEWx+8/GVVipkZcaoQM472QtpLMkw9jtJ5Jsio7Lqio67UjYUEaaQHSCOAwXpurbu7c0Pk5vB1lXvpz4izu0tap71DFxrc2mw3pLO1PwR2scvyaOfnhwGOFp3hSEN/TV3gyh5yKBcGvcwa7HsE/ENUzTls0zD91hd5m1NyTRS7PkMNcuJnpw6/bWIRKnlsV1V50fNP/f5PQSu/FV3vJv649RNeaHfnjhZInXkcFpao8BNc+edWsWxZ14CEfhw4dYSQLVNSWSVCnqHIJkBhrIXwI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54f72289-54f6-496d-029a-08dc9ce8d901 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2024 11:51:46.8433 (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: WqqROCdlmkkLCKDS9SmJL6Fc92XYamH0u4Gjh09wBzpK+ICO2k8lkms2qotgEMCE9sE99rsoyZHqDITXvBy/Fw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB8080 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-05_08,2024-07-05_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 bulkscore=0 adultscore=0 malwarescore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2407050088 X-Proofpoint-GUID: rNtiIMaHuXKtl5GnIBAPGU9WrP2NGzeA X-Proofpoint-ORIG-GUID: rNtiIMaHuXKtl5GnIBAPGU9WrP2NGzeA The block queue limits validation does this for us now. Signed-off-by: John Garry Reviewed-by: Christoph Hellwig --- drivers/block/null_blk/main.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 9d0f6da77601..2f0431e42c49 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -1831,9 +1831,6 @@ static int null_validate_conf(struct nullb_device *dev) dev->queue_mode = NULL_Q_MQ; } - if (blk_validate_block_size(dev->blocksize)) - return -EINVAL; - if (dev->use_per_node_hctx) { if (dev->submit_queues != nr_online_nodes) dev->submit_queues = nr_online_nodes; From patchwork Fri Jul 5 11:51:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13725029 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 E9A2714A616; Fri, 5 Jul 2024 11:52:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720180334; cv=fail; b=qUmk9ITR8XNn+zPP1CVL8dt/z9XjEmUMOB5VzmqCUHVuiPfRs+ayw933G/+UXGr9oeIjTvNFsUnS+p20aFmAnfoaD0IFGRylUeIH2C+SQ1JD+XXWK1ZWEESTQNzHS6ZnO3s40+G5cO8xRh57rrBXsXtkhyHjV4BLlez7/Wv6E0c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720180334; c=relaxed/simple; bh=QTtE9FREu9LFvZIJI+tHgdZY3AhwcbNdEI/b2K1DGPA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=NcOO9Gt5jvwnmC1gL6NS9MbpNIqCnF2RDxMUbn3vLIcuQZIrhFdmvjE4AiK+A5HJP0sTlGKhPrpFiVJ/tEs3e3sh/rMJ0KEnewCvMLguKt62tbtyzkHyN1r8NfjRiMkU5Mj46O0ZUdPFxihCM/+lA7zCoCHRw/WWsDoTgoBdMCE= 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=k2USv36w; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=R9+UaYJW; arc=fail smtp.client-ip=205.220.165.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="k2USv36w"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="R9+UaYJW" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 465BfVI9015200; Fri, 5 Jul 2024 11:51:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=bLXXo0HCb959bva3je8XRwmaOWTLpUpEHNm/ZQh6YpE=; b= k2USv36wecUqL/M9gB6tZV2pd0vWg/gIMCx2meec4l7LJPl5G6OKzgN3HEBunstC Se5uayUm4jSt+ua4utPXEsQkpWejAOjRFQOcT3etMlb91PKa+58uEx2VKp1ECxub 6usLneEnEqjlVhpIHILopjad1BSBe4yNuV8yhGdYEqm07T8P7yFgoPMZQ0E/I6Mx fKJfBTmxXxaWX0yMGY3iOazNwohlrGgL7CuP1Axm3Uk+ODnmGGXfsKkRj93XiX+L hxMl8X6u5k3LGDtPoNgS3rOGZru9Zs0s6sSCcGHn/jl26BYsIHURoJVhotUr6aUm NNJeFRYjRwCITCawoUhN4A== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4028v0utgd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Jul 2024 11:51:51 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 465BFxqL010273; Fri, 5 Jul 2024 11:51:49 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4028qhp8x3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Jul 2024 11:51:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PMQvYoNrtH9LLIHePBAu44RMdmNVuXgqGtx8l6Jl5HV9aCcZxcxoSR1WX24edL93AH66jDAW5P0l2w00MJw6Y5K2UT3YA2rGL71VS4pMCCE7KSpAb8uIUieBh1+/NKt9ABXb4SO1DcPFATiRSAThBozHY8+oBPLxGoYWLnRjP7Fvs3yVcFyZpjdklt/mjdzHx2sNweb+lUir72y4cqwisflUVNEPWCDEj6ElhkEVeB4mLCSYNnovq5Iou0h1zGjS+eWUirdGBUNg81g7tG1eyql6XEgdzqSmiKAuEdDeMdHp2/tgxH7q01rppPp8SII5M9KJAjixv9L8y49O/vM75A== 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=bLXXo0HCb959bva3je8XRwmaOWTLpUpEHNm/ZQh6YpE=; b=HBkFgm/NiXArOqd7sKkIH6NPo11zl32WwQZEPmN+/nH8z4fhs7L6BrkrD+ruMyWYzE2Stxk/Inky0VZbCjKoNOtNKJQxLRuA93pWnTreyN3XESEdBVzuE4QmfDSHtH5yd9+zedmZozoTCYARq9QGD9spPTsrSboAUxmWm23If4BKrTOaWix1FU4l2yKcJu1Nf1ppGwXENGfWyV6vPIzMjq6+Nn4vpKTql2fmnvHo8b9RtkP51lyvnqVnWbtchV2xXkwb8IoEOduKcVb7O7bW3SMU1FNDNows38yamY69UTmKNc+OMpJeSEbB+74FfbrXKtdUe9zh3mtJUgg6Cwn7jQ== 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=bLXXo0HCb959bva3je8XRwmaOWTLpUpEHNm/ZQh6YpE=; b=R9+UaYJW3huzMPSdsuMTFMSpG2t29kDDd0z8zvqtFNrEvNCFCvFPaJGRCWGKIULXE0tJ7bBoiVJPy9yu2fiWxlzQ/EJv6YY3n3TB6Ml0AvE6pooJeA54CVMInMSrArf7AQMrzLjI4vCMj3/QQUS2QR5wmuFLu9JwLOdTk08F/qc= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DS0PR10MB8080.namprd10.prod.outlook.com (2603:10b6:8:1f7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.27; Fri, 5 Jul 2024 11:51:48 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%6]) with mapi id 15.20.7741.025; Fri, 5 Jul 2024 11:51:48 +0000 From: John Garry To: axboe@kernel.dk, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, hare@suse.de, kbusch@kernel.org, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, John Garry Subject: [PATCH 4/5] virtio_blk: Don't bother validating blocksize Date: Fri, 5 Jul 2024 11:51:26 +0000 Message-Id: <20240705115127.3417539-5-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240705115127.3417539-1-john.g.garry@oracle.com> References: <20240705115127.3417539-1-john.g.garry@oracle.com> X-ClientProxiedBy: MN0P220CA0020.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:52e::17) 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_|DS0PR10MB8080:EE_ X-MS-Office365-Filtering-Correlation-Id: c462d2b1-ea50-41f7-3ea6-08dc9ce8d9b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|366016|921020; X-Microsoft-Antispam-Message-Info: u33YUBO4iNnTepJtiSvO/tkGle/1VnNGLP1kBX6etA6+sxQ2IwPvxlxRof8qrxVfyDERmuQDnnuGlOtE08BjrYhjNOR0yM5GxAf/wcL/nwgueh2HhZpxCmPY45/3i9kwhJwUvDXQH3YD3N69v91a+j8fCUDzd703cpVNO33fzqG38VRK6kXaXcBq0Ze/pqRdairMqG1FZOuuk/HlK7yxofY1GBvPdh2xm1V7hNwwGn9/RNiYVQINO8CIVks3LmG6dtq2dGvRyRdP+45cerKiFaT46QNlJJUFO3RzHqAdSTPC2XPMWq5N7acInDEeZpEoXDCUlQIAT6X/Ekvhgl1TjhgJv6PyStAUNGIjI7TWKytN0JBadYYoBfA7DBjUbNJN84sSOpPcREr1J4KD0kee/vIBKCVSpNqXajlXvOyXPAt7l8UZhYRktGv71BgG1/LOfirnTfx3TdREW3SOTyOkE1p5izWeURXY63gp8O6f4Qwzm8JjsrhRGvQU8mXUCvPT85jp4991fQXgW5FJWiRxTW+f1CoOUwtvksViJoZ0JF1EVkIAFAlE4RheMH6DrTGxT9b1PguUWS6jzkpSm7uB1BQ87yGyO/crE2ljNR810uvP7rtLlFYS9YVBLxX+CUobVjZhEFCA+Jy18EpPWAOR9AxjqYU3+R/9TJdB55IE6MtFzt4tQaNKNtviYfuTFI+zteAs0WTUkti+waRS1rUULl9HqmlPj2KR24NH/YRTKjZ8pYx094hVIhc3QdSPFmVV4UfUpDYqSXbbXAuGFjOh5lPfmmSm7npxa3G+fl9XJVboWfVqyyCO424dEjij5mxD/weetKw5Xu1/MNYmYu7STPIDJ3rdINdwHRRf3em+7ARGNTN5ouKIT/CvuCzR6VOJYvCzKkDA68cHz8/41sJXjV/LqTaU5jWulngnFEqXMw/YTMI79K+e6Ackp+ykgIj3WAgWlajuJWJD34jmT439uOC31K4/36JmekIDWbGkgP77zpqBCKuAfkyNxzl6jDRJzRI5QdjxZksi02fqDajxqvqJQXI4cY+SQIkXZpfzhjMpDKaK8qyiAKnrjptvoF/trJwz9iH0L7BU40Aa00gqa3VBN3jpTjcJFsMbjgRtMI2/S6jN6SJMGx4wDJ2RsF4lFaamU05KSa4MLKxjHudzm/CfMj7gGaTI3Lp9ovzvz8MNNEdTElZ7ixZI1ZslgKlT9X6NVZRUYrE1UH/37NeMZrZjvwifHrzqlvR0p58u6rCEjh93ZefrNwxwctOpvDBWcrEC+9CUnsn4kzvVv2/cViwdev0QLgx0fYCfNkRtVVBbUwe4JyVjVMKAzCrYPA1WF/1/RE3dotoveCBwFwt0d3YncFDTkeLh0O112IZR5w4YJ90G1wHPeZrdLE3DeAJv 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)(7416014)(376014)(1800799024)(366016)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 764rI0DcnFjVe41KcTLHo9BmKYsoX9pjLFh395VQR8TAin0E/cOG9bZSX/DeaxCFaXesKdPA/HlWIJlCc20nXcNFIchhDFpkcIxXRa8uBPccoFqt2NAQCCDc+q+fXgxZHbsRUwJeonpv7SNfvlJnwPVIWoBCx4ONG6CiQWBNqi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cmBJVKiGUAGuSbQdzZJeHD6QaBJlbEzq1Ze8zdiCeTwazRe4YxZWVDPPJrid110NcAPWY4+bSqYkzmFjcZzRnX5aA59Lm1sifsu8qjbh/OQdc6tCjRnnGi6iNihoBcfDPwUn/xCB7Y9TolSjk1OrtjybXySjVOUz28OLwjFIcLFAQFD9PrExKF/VeGO0IF9jjB3h8dFxqRyabs2U5ZkXOHFTnivPayv70bG71CW5xjzYYaEOfj0WK2RjQY3m1r/35UXCD8Q6B4kPGA4CmU3Eyz48SFXe9f62RisedXLYOcY0sbhF//0s3rpWGRn56GKm5jCc7XHRb+b9j52Y5wVJXHgQaR8twgnWpyalzon6v5vBqCTg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: CCD966KYDUe+ZtJBP+rcrnoa3NklIh63vE6IKlhE2rSNp5aMtSt/4bWDzro9lZtBT31dkeL54K2/O+u2ytHpdvZRzB7SmbI3tKBXy6pvnONRNRnSHW6KplE67sC9xoe5KBwzdiPKruGSYhAgpVfB2nsk9di9H29hxbUmpoY+RgYNWmQhQixPOBPLL0IVt2+ynUZpunw3g1Z7kB298vA/Y8Q9AQIcmJJIq4YK9WWaBgVRZtFRZjVfbtIx4Qc7sZn/obXiSrbLrC7103X8wmY8usZcTlr+kN9AIOYSpxzBMhiv7K+tsDWP1JdXlPnLq85O+bTOoOHokyQeMBpMMcko9bQcguGkUR3koNb4M/bqNUMUED4bacJEpCcaEflea2a6IaX1xRwPyfMRMNWdcvLPaV6hWJUCN0b03BEvtX1kxHLtSw0PzCNbwDfJaqRYAIG8mFbby9o7O21bvi+wxyEj8aqaTHh4GNHh1S0fvbxUeDi+fBKaGCq+xMgr9KWzxUkHvk5YofaI1UntZa5W916TGuKl2CVFCQgCXUhQ1u3bW8J98pXA8Q9G4iJ44Aih0jD7+cxshqSh2MPNIC6O3/794rDv0EGyiMJ3skGAClA5t/Y= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c462d2b1-ea50-41f7-3ea6-08dc9ce8d9b9 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2024 11:51:48.0226 (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: QSo37p+BivGqBL2csNEnYm1Tp8YkK57vzlWR6EnkoZ3LdqY/pTf4ZKydApuVATfvFthn3CQSAg4DILzgomGIsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB8080 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-05_08,2024-07-05_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2407050088 X-Proofpoint-ORIG-GUID: ML8KvbufN6z9niSFk5IpCgPD7oP7S2oz X-Proofpoint-GUID: ML8KvbufN6z9niSFk5IpCgPD7oP7S2oz The block queue limits validation does this for us now. Signed-off-by: John Garry Reviewed-by: Christoph Hellwig Reviewed-by: Stefan Hajnoczi --- drivers/block/virtio_blk.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index f11b0c3b2625..e3147a611151 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -1289,18 +1289,9 @@ static int virtblk_read_limits(struct virtio_blk *vblk, lim->max_segment_size = max_size; /* Host can optionally specify the block size of the device */ - err = virtio_cread_feature(vdev, VIRTIO_BLK_F_BLK_SIZE, + virtio_cread_feature(vdev, VIRTIO_BLK_F_BLK_SIZE, struct virtio_blk_config, blk_size, &lim->logical_block_size); - if (!err) { - err = blk_validate_block_size(lim->logical_block_size); - if (err) { - dev_err(&vdev->dev, - "virtio_blk: invalid block size: 0x%x\n", - lim->logical_block_size); - return err; - } - } /* Use topology information if available */ err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY, From patchwork Fri Jul 5 11:51:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13725030 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 9A09614A096; Fri, 5 Jul 2024 11:53:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720180395; cv=fail; b=e9OGuUjC0N8HMacrtjycck7hTN6zTopBhPvvlcDOTU/Z4unxltPoQhC7v+pR1AMO/Ux3+zKPcCBA7dnGPpALmd5Ehd11RdKOmchXK1vjHXvZlrMKvJh0m27f2eXg4BRHhO6pk7sc9c9PhVmQvkL8f0Oj4ZYjdxpvfVVnUz1qoHk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720180395; c=relaxed/simple; bh=Ug8nG4l8dlW4rygc9iwEOO/+v4czMQR1chck2loVKSk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=amcmxQQqAkVcWyfnZDijiRtR3x+gYcHt7H7mBhzjb66xASu5N0Sf7ih1n6fr5a1AW6A1q6PX3cG2IKz/Hau8z55s0Lr9n/ONK8LUyUbc4spL4pj8iHYTts6EjEHfXzs/Cv5JFFrvgfgyw13XeG/oiggkKN1XbGwZ6SQ1AJu2Nqs= 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=Si+H+j5W; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=nh1HJh3p; arc=fail smtp.client-ip=205.220.165.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="Si+H+j5W"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="nh1HJh3p" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 465BfVjl023320; Fri, 5 Jul 2024 11:51:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=+CS5gOGc0m3PJkZ44+tNF1y2jyDsxVhfLJTXUpxL8Mg=; b= Si+H+j5WGqqAJ/xZzWDzI5TzMOriyDpE8cfhm64QLE84TshR9GmZVVictLinYTPs OGw8KAZ33GZfbdEu1wG9ewrGJq2tDK0fuojdAIPQYKZ1vIQpZUb32WExhxpV+wdt LNGZztCf26TAVNJyw3sTx5+4kLOHWJQ4Y/t5GGkTVVYBztlDjb1yM5oikf2pUCvL 0nbjGWx5Uvh5mnAV0+2YeGcwF7tpPNVEzi7dRMSA+zrckpwYSLUggZ30ZkOBmt8W 8iN+k7F+o7VN7eYlF0mb2SQnCfZZBc0GH0quSb8Dno9ntw8Ck+uwp30TjTyx8L5l bLoAFv7mNtm3z4EFSz8yTQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40296b3t73-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Jul 2024 11:51:52 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 465BUrR5023586; Fri, 5 Jul 2024 11:51:51 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 404n129232-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Jul 2024 11:51:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V9xZk60HYq6JGVI10WPKskp7PwxXq5oXBW04o2PmluT9LyIbOPWInimlM5W4puMR9b1j9k2lTaxvJwNi3cj3rMVctCc0BXfkNQptjZrc2vGixXaW0OAOwcUCFsB0NZ6i/jJ6YadeSe/sfMOlCB0K1tG2j2H6VTCdOUk0vaLuBok7WJFnEvU+BeDpZToF8hslAxgmmdzQZzF0mA4UpyK7W++z/3gi71LJLNafpkGEp94spwQRQdpn2dmLaYycLxnJxDygYx1QU4Vo1YEDl9lYYOGJJ9QPiImZSw0JSM/m0lfaJHh12Iw04wk06X+4+rtqFsPVcY4QqMutj3feBWzKWA== 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=+CS5gOGc0m3PJkZ44+tNF1y2jyDsxVhfLJTXUpxL8Mg=; b=nMvo6rJlSawLeuJMtoo4qYVv+JWrF5qTAUup65kbtlul6hO6bolCmv6EkymkSuJak78tZNK+JVkezzpOQDDS4W7gKSF7u/2TBoYCaA+htl2Qn6bffofWtBf3BQR9W1px1tm1bCNQwzQfd8ZMefBZc7dl8Kfju6QfU/jSXzifYDPkppxQDrUAKoJV91H1OW4JzBNm2uSbLlSMhURmDHByVGCS+YtEaEwMd5FVnSqlnSCyujoIdlcayQcJbPjBNmMO+Tp6p9GI5QOkaZG/yhGMm6MtBn7bYvAMRAWAvytsTsNHfVVSXW5CZE4/1n86Srjhp835csuCcBMSLaRmCo11Hg== 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=+CS5gOGc0m3PJkZ44+tNF1y2jyDsxVhfLJTXUpxL8Mg=; b=nh1HJh3ph5p0lrpXzyKDAoNuxZ2e3QgZv/IlczPPbMNAdvE2jprA23ePjwZ6ATGQ68C7iBHbWfUpYr/5F27wUZ+k2mvhUH0iSMP/pn+0yrYmfQMmx3vJDM4W/640zOEM24GgXKgIIB/ebF7/KBEC6f+z6y568HIQGu0y+EPQWZY= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DS0PR10MB8080.namprd10.prod.outlook.com (2603:10b6:8:1f7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.27; Fri, 5 Jul 2024 11:51:49 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%6]) with mapi id 15.20.7741.025; Fri, 5 Jul 2024 11:51:49 +0000 From: John Garry To: axboe@kernel.dk, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, hare@suse.de, kbusch@kernel.org, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, John Garry Subject: [PATCH 5/5] loop: Don't bother validating blocksize Date: Fri, 5 Jul 2024 11:51:27 +0000 Message-Id: <20240705115127.3417539-6-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240705115127.3417539-1-john.g.garry@oracle.com> References: <20240705115127.3417539-1-john.g.garry@oracle.com> X-ClientProxiedBy: MN0P220CA0001.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:52e::29) 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_|DS0PR10MB8080:EE_ X-MS-Office365-Filtering-Correlation-Id: 6635d540-e9da-411e-f09d-08dc9ce8da81 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|366016|921020; X-Microsoft-Antispam-Message-Info: ysqX3ohX5BzRtWWqliKMZOfYkNm6tPL0YImlmSU1UpECYSQY+kFE6fWbhCKv3kUMu7yJnqIZ/JTWZL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yd4REEw05BMp6ar1gKTY9QQlitdvPY4D9Ab/HxegLqsgmmq0pLHm+7KnNlCKJLBKgJQoySUzFNuI3oFttnHSJcy/aY8kZRJvuhtfW8xe3E9rzQT9Hp7oMHrqh7E96NBLmwaCsy9VCQFAjO7tB3LIF8jY4wIEz+rexTf3/3k1hImf/UwapCLtunxG3iKaEGqkd0+1p3oaIodymt9ndfDbNJPhJXPWz5zMyWPuufmeFVMvVyK/pwbpO37JL7bcbL 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)(7416014)(376014)(1800799024)(366016)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m/XDC215E95UWcBSVfs6hnGG7+ms/QQ8ZxgYF75sNJMPI4OLd7bseri3WGoXkQiYqYieDY7Yggoub63hY+BiiQX8bkhM5Se4vUAYGo8+WR4hxD865H9aHf5+83NeKfPKGmcrNCuE2xKrp9xJnXaxGu9MQ0dGjIwniaefsiXmr3CXcXASuEppq3cDwgrzubYGcmzc6Pvq4b7gn5pB2qUvIGC4h0vIJrVEF9KXulDcjxfkEpfP/22xLJxMj5NkCEH8evBjmnArGgD0ISvTFjQ+yeqdZ+dcP3xbwKQNbSgs7JvjeAzbx4wnPvnCOdB6g6ALVkEMgOpOJQIuT60I0CsaaZ5rXTGEKFfh5zuTtQV60wbKRdqF44VdFMsqfhmTXfi7ioQSRMSvurSwMbwiJL5zp2mnMDDK16Hj756F/s4u8+KR+NvTXNCTZi4VDCIPiwv5sKAAFSXNgMXmmKMUbahcHC+YrqN0DwnV8tAlII96mMNVwJchB0y8STJQ8UuElxYvjRfvuBgQ3NPPLKkbOnlqOA7DczEw8sP4jinEjIazeZKJw7vjCRW10s8dcqJatFkan/ts75UWlBCaMMXKrOE0pie3lHgoK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Hop-MessageData-0: F9U0KuC5rXckfm/PSgZOBLeq5CW+ee3qhk5eWcJJpavTSpQpr3HT9FNQFloMbCdESArmnMMDolOx2QacOC4ysQVcE2KsTNGckqSKXvTqhl6V26xg2yM7eZZ94f7ivVG2jXKhJo2ZzRR+luBFaWJNN050Rrs5jF1ROhFGqCZh+X2YInLHOM92IEEMKAORdpyE/o6E30q5eiE+HGGAQkYTzN1ulmdhLluIIVk4eARjWfJLzVPP+mE/dH4LAUtkRwEYkNp8A+dour7IZH4Zw8qlOIt8OXUur4fPlExKM8OBQoHIYqtnbXmRcUpcFn/PhtjjS2MS4fgf9Wmc6q3JhXaA+kqSqk9DsQuTKOfsgPKIWFv+JvTRWsVta3SA+nY28qXEqWOoNNCw3+TVADVuXIH8JlDNyyk40ZFFgJ3gU84CGUssV1S4YGAVE8e+zr1l/JE+lrL83vp3rYyUywfFoklnag/nCFHf+W4FKx71eLb8AePHNw/U0mH50kN/cTKX4FoDAL7FwR/CmBKvOu5AkubJo2kT0gM963bvim8S1O8q63snsSDVC9jypmWt7oUD7+HwM+8bbgb1yOn4XBO5BfXsnMbvuGGgSDe7cZmat0qk2B0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6635d540-e9da-411e-f09d-08dc9ce8da81 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2024 11:51:49.3354 (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: dIkPvKewbay5u6sGmdcFgwKMaIexjvDK6j8pfeFHYQoSqgwEZE6uKFHK7J8LnvQUU5sWzo/xLW5h9BefxKBJ4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB8080 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-05_08,2024-07-05_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 bulkscore=0 adultscore=0 malwarescore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2407050088 X-Proofpoint-GUID: Li81OcNydv_oArUG7hLNYS9snBLLb-C2 X-Proofpoint-ORIG-GUID: Li81OcNydv_oArUG7hLNYS9snBLLb-C2 The block queue limits validation does this for us now. The loop_configure() -> WARN_ON_ONCE() call is dropped, as an invalid block size would trigger this now. We don't want userspace to be able to directly trigger WARNs. Signed-off-by: John Garry Reviewed-by: Christoph Hellwig --- drivers/block/loop.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 1580327dbc1e..736467dc3ca7 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1061,12 +1061,6 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode, goto out_unlock; } - if (config->block_size) { - error = blk_validate_block_size(config->block_size); - if (error) - goto out_unlock; - } - error = loop_set_status_from_info(lo, &config->info); if (error) goto out_unlock; @@ -1098,7 +1092,7 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode, mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS)); error = loop_reconfigure_limits(lo, config->block_size); - if (WARN_ON_ONCE(error)) + if (error) goto out_unlock; loop_update_dio(lo); @@ -1470,10 +1464,6 @@ static int loop_set_block_size(struct loop_device *lo, unsigned long arg) if (lo->lo_state != Lo_bound) return -ENXIO; - err = blk_validate_block_size(arg); - if (err) - return err; - if (lo->lo_queue->limits.logical_block_size == arg) return 0;