From patchwork Wed Oct 26 16:51:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 13020891 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 46CB9FA373E for ; Wed, 26 Oct 2022 16:52:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233909AbiJZQwJ (ORCPT ); Wed, 26 Oct 2022 12:52:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233881AbiJZQwH (ORCPT ); Wed, 26 Oct 2022 12:52:07 -0400 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B68D7D7B8 for ; Wed, 26 Oct 2022 09:52:07 -0700 (PDT) Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29QFxuGl014138 for ; Wed, 26 Oct 2022 09:52:06 -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=yweTIcEEup4K70R2eq07Kp6EbZy543M8HDS4MaHQouE=; b=KeqUX9C6evJ19CNbkIyX//kFQ00xpDB38KH+ya2Mr46EC9xid+R9Iyq/WJq/bRXP7Wmv nDNsjRYgZoBPj+EuhQjTWXQsKGUTf5DZ41wlCK9YNhyemfbzFNFRexRHod11QnxjHrIB KP6itgP7A9mfGsff/hc8vbbNkuiRVMDeJjQp88b2iSRKSoadkEgrh3JfbKz/HV68M3Kg UQMQe9Qy3FPqXgxRVxYGBliC8Sn85ZBfjaVvGln3mr1oHM/JfjPBnUXyK1wQ/H9SsD7a cI1f30DSA2q95nwQN+rHl2R/QHhbvtM+HPXTBHhYiUKogJA2fFJ1UmGFLbDYChuMDgxN Ww== Received: from mail.thefacebook.com ([163.114.132.120]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3kf4y2tm6e-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 26 Oct 2022 09:52:06 -0700 Received: from snc-exhub201.TheFacebook.com (2620:10d:c085:21d::7) by snc-exhub103.TheFacebook.com (2620:10d:c085:11d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 26 Oct 2022 09:52:03 -0700 Received: from twshared13927.24.frc3.facebook.com (2620:10d:c085:108::4) by mail.thefacebook.com (2620:10d:c085:21d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 26 Oct 2022 09:52:02 -0700 Received: by devbig007.nao1.facebook.com (Postfix, from userid 544533) id 5F861A4B1E3F; Wed, 26 Oct 2022 09:51:53 -0700 (PDT) From: Keith Busch To: CC: , , , , Keith Busch Subject: [PATCH] iomap: directly use logical block size Date: Wed, 26 Oct 2022 09:51:33 -0700 Message-ID: <20221026165133.2563946-1-kbusch@meta.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: vG6frEBybfhVsdjheLPSfRDxEVHbvRJQ X-Proofpoint-GUID: vG6frEBybfhVsdjheLPSfRDxEVHbvRJQ 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-10-26_07,2022-10-26_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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. Signed-off-by: Keith Busch Reviewed-by: Chaitanya Kulkarni Reviewed-by: Darrick J. Wong Reviewed-by: Bart Van Assche --- fs/iomap/direct-io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index 4eb559a16c9e..503b97e5a115 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -240,7 +240,7 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter, { const struct iomap *iomap = &iter->iomap; struct inode *inode = iter->inode; - unsigned int blkbits = blksize_bits(bdev_logical_block_size(iomap->bdev)); + unsigned int blksz = bdev_logical_block_size(iomap->bdev); unsigned int fs_block_size = i_blocksize(inode), pad; loff_t length = iomap_length(iter); loff_t pos = iter->pos; @@ -252,7 +252,7 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter, size_t copied = 0; size_t orig_count; - if ((pos | length) & ((1 << blkbits) - 1) || + if ((pos | length) & (blksz - 1) || !bdev_iter_is_aligned(iomap->bdev, dio->submit.iter)) return -EINVAL;