From nobody Wed Apr 8 14:07:34 2026 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 64622C433FE for ; Thu, 3 Nov 2022 15:44:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232153AbiKCPoJ (ORCPT ); Thu, 3 Nov 2022 11:44:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232237AbiKCPnz (ORCPT ); Thu, 3 Nov 2022 11:43:55 -0400 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D49A1C920 for ; Thu, 3 Nov 2022 08:43:47 -0700 (PDT) Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A3Fh7OT008963 for ; Thu, 3 Nov 2022 08:43:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=s2048-2021-q4; bh=ghCshfUGaEw/Q+3k/HGBASfyf6E51G+0Npso3iy3cZc=; b=CPM3rt4h/kjNRH4+T9Jq/yi9Zw04cOyPDQO/qIT6ewQtU5rCNMpXM06wCBv/r4L1O8EI eQxud4qVLC4129GkuvwXTYroYK0P7z1KzMbEeYzXiqHJE2DNX9kxScl5RSF04H6X7fg4 cz2TPmC68stWuXfRJIozhIZsGGWhYCbqRT7bFS/4fyONG11ESqjx9bdP4VcMVzb4FXfc XVOY7ZDZXem7j43+oGdglJ1n7YZ/hfz3zHsbm84Yjae4rh75J0drr1SEvy0Ajt0wdEAU bSpWcN4bTvtDreTBxhods2ryAUVfIc06j0s34WMqzeIYYsTYcsGPOt3qSJCZMkxWVca0 CQ== Received: from maileast.thefacebook.com ([163.114.130.8]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3km3ubnqpv-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 03 Nov 2022 08:43:47 -0700 Received: from twshared6758.06.ash9.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:82::f) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 3 Nov 2022 08:43:45 -0700 Received: by devbig007.nao1.facebook.com (Postfix, from userid 544533) id 50B53AA9DAFA; Thu, 3 Nov 2022 08:43:40 -0700 (PDT) From: Keith Busch To: CC: , Keith Busch , Christoph Hellwig , Chaitanya Kulkarni , "Darrick J . Wong" , Bart Van Assche Subject: [PATCHv2] iomap: directly use logical block size Date: Thu, 3 Nov 2022 08:43:39 -0700 Message-ID: <20221103154339.2150274-1-kbusch@meta.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: I5MAQ_iv35lv4Ireut1_A-xb7Fov4nj8 X-Proofpoint-GUID: I5MAQ_iv35lv4Ireut1_A-xb7Fov4nj8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-03_04,2022-11-03_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Keith Busch Don't transform the logical block size to a bit shift only to shift it back to the original block size. Just use the size. Cc: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni Reviewed-by: Darrick J. Wong Reviewed-by: Bart Van Assche Signed-off-by: Keith Busch Reviewed-by: Christoph Hellwig Reviewed-by: Matthew Wilcox (Oracle) --- v1->v2: Get rid of the temporary variable since it's only used once (hch) fs/iomap/direct-io.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index 4eb559a16c9e..9804714b1751 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -240,7 +240,6 @@ static loff_t iomap_dio_bio_iter(const struct iomap_ite= r *iter, { const struct iomap *iomap =3D &iter->iomap; struct inode *inode =3D iter->inode; - unsigned int blkbits =3D blksize_bits(bdev_logical_block_size(iomap->bdev= )); unsigned int fs_block_size =3D i_blocksize(inode), pad; loff_t length =3D iomap_length(iter); loff_t pos =3D iter->pos; @@ -252,7 +251,7 @@ static loff_t iomap_dio_bio_iter(const struct iomap_ite= r *iter, size_t copied =3D 0; size_t orig_count; =20 - if ((pos | length) & ((1 << blkbits) - 1) || + if ((pos | length) & (bdev_logical_block_size(iomap->bdev) - 1) || !bdev_iter_is_aligned(iomap->bdev, dio->submit.iter)) return -EINVAL; =20 --=20 2.30.2