Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1762954iog; Thu, 16 Jun 2022 13:19:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vQQSivJO+R0Tkf4+n7Ilb+++JucvwBa02jO7AaDcCXZu6G/T838n5gbFIdWl+wAZJ1Gp9m X-Received: by 2002:a17:902:8ec9:b0:168:c341:847e with SMTP id x9-20020a1709028ec900b00168c341847emr6042842plo.170.1655410754990; Thu, 16 Jun 2022 13:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655410754; cv=none; d=google.com; s=arc-20160816; b=Je75RSU5QgrfuEjMhws7JENK5tKP4xlI0DFaz21AWth4u7JBbY+XAzfvpoWcbqFoQi DMT0HwOUW8rezL1cPg+SdmN5doql+uti9cfltV4Z6XlFNbP2qWXNIUGKFRBhfBfdKyV+ vRLHFFlWB6Sy04REQnxZciKjWj0dq74w/Z1RXvD+D779UlPsJ6gKTD5WJNYaL507W/6W zbj6NEprPt2FqTbOIwhhcUDucrg8HSufKcyi2eKbpdjhpAzjso7TpNZKEzqlMgl9ihTB TWsdLZrd1rIwo5/OMZKuWdo4s/MIRxgH/uXZ/B5H9EUDau0A4PWX/31xZEz8yVkLFhNu 6VzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=h1txY4jrEkhTyxbsehk4iPdRqwnv0v9EigVsPTc5Y8o=; b=yKLqIj+wUZyOt8RIMrQ6hIheUr7bQsd4QF89/SfBatm86vjcfi7ZcFF+BzKHx+NX47 dHwNndLWdnL1gmuA32PLEFR60ZUw3/s/0Zx0TopXCKJayxEKGlZoYmNvm7sE1fwv3VDY a6xDK2mw+P+S6ZYpQAptMcNBXIr5XB2m0RuVnbhcT1N944qwBEj7qEOE9EVOXOMps4Iw NLekG+gNDOwRpxqICsHTglTIApTXgKnUkbHx/VczsQIekPFfaySPHhCHFlcOlWtGwR7G tbfj3ChKGQB0Qqa/ufkRElz3x5wTaXJoEhezQtrAexP6zyWaUyzH9dRx+F1iosXmEDjO QcYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="T4K//9g7"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r21-20020a63e515000000b0040014ad5b21si3644787pgh.661.2022.06.16.13.19.01; Thu, 16 Jun 2022 13:19:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="T4K//9g7"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378514AbiFPUSi (ORCPT + 99 others); Thu, 16 Jun 2022 16:18:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378434AbiFPUSW (ORCPT ); Thu, 16 Jun 2022 16:18:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C82F33617E; Thu, 16 Jun 2022 13:18:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 63B30B82604; Thu, 16 Jun 2022 20:18:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D11D9C3411F; Thu, 16 Jun 2022 20:18:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655410698; bh=rI5sJt81Ou1NC5AiKCGQE1sxPyKzxajDBp8KDiFqDgo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T4K//9g7LoKFtLBxQiI7A4UbFYnO1PvmVLcRxNgc3Je0qFDlC3NWBYgTkLWk6+sOX 3F4EIx7V9BtYDB4Kh0nOsLjx4tlB6md1DuuaVvFRaL1pEPUuTg89ZBVyBEsOfc2A0N bMHqq72VcXX8EWQInOyFmnVaV2L9Rt9M2J5saRxAxASZMcZtosnLdbnxJ58Z1OH6xS 4ByFDauC50BLFtzBNQj2O1coP2O5K7ws1MvUPuouQfbO8vWVpibGWS/+8uGvbXhWLY PCaYgR0YWVVtTsVfx5nxi38ecn45+hXB0WzcgnPViSzdv7kjiggIOhVeOZtXytpHj8 igesoUqqFF/5A== From: Eric Biggers To: linux-fsdevel@vger.kernel.org Cc: linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, linux-api@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Keith Busch Subject: [PATCH v3 7/8] f2fs: simplify f2fs_force_buffered_io() Date: Thu, 16 Jun 2022 13:15:05 -0700 Message-Id: <20220616201506.124209-8-ebiggers@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220616201506.124209-1-ebiggers@kernel.org> References: <20220616201506.124209-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,SUSPICIOUS_RECIPS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers f2fs only allows direct I/O that is aligned to the filesystem block size. Given that fact, simplify f2fs_force_buffered_io() by removing the redundant call to block_unaligned_IO(). This makes it easier to reuse this code for STATX_DIOALIGN. Signed-off-by: Eric Biggers --- fs/f2fs/file.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index ad0212848a1ab..1b452bb75af29 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -808,19 +808,7 @@ int f2fs_truncate(struct inode *inode) return 0; } -static int block_unaligned_IO(struct inode *inode, struct kiocb *iocb, - struct iov_iter *iter) -{ - unsigned int i_blkbits = READ_ONCE(inode->i_blkbits); - unsigned int blocksize_mask = (1 << i_blkbits) - 1; - loff_t offset = iocb->ki_pos; - unsigned long align = offset | iov_iter_alignment(iter); - - return align & blocksize_mask; -} - -static inline bool f2fs_force_buffered_io(struct inode *inode, - struct kiocb *iocb, struct iov_iter *iter) +static bool f2fs_force_buffered_io(struct inode *inode) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); @@ -840,12 +828,8 @@ static inline bool f2fs_force_buffered_io(struct inode *inode, */ if (f2fs_sb_has_blkzoned(sbi)) return true; - if (f2fs_lfs_mode(sbi)) { - if (block_unaligned_IO(inode, iocb, iter)) - return true; - if (F2FS_IO_ALIGNED(sbi)) - return true; - } + if (f2fs_lfs_mode(sbi) && F2FS_IO_ALIGNED(sbi)) + return true; if (is_sbi_flag_set(F2FS_I_SB(inode), SBI_CP_DISABLED)) return true; @@ -4205,7 +4189,7 @@ static bool f2fs_should_use_dio(struct inode *inode, struct kiocb *iocb, if (!(iocb->ki_flags & IOCB_DIRECT)) return false; - if (f2fs_force_buffered_io(inode, iocb, iter)) + if (f2fs_force_buffered_io(inode)) return false; /* -- 2.36.1