Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp363486imi; Fri, 22 Jul 2022 00:15:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sE8FUGd11+UpzuMYcWXim5ddCI4zlAHJw+qbhuSBbgHqWb3UdowR4EnPlgK9jEgil1OLrD X-Received: by 2002:a63:5f4e:0:b0:417:ba9d:c513 with SMTP id t75-20020a635f4e000000b00417ba9dc513mr2043113pgb.434.1658474118574; Fri, 22 Jul 2022 00:15:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658474118; cv=none; d=google.com; s=arc-20160816; b=sPexweJ5daDqg3UBlyINapHa66yXXN5V+RErAfu54quXKk+CBz0t57P2dBGFzLkPOE Hcso0c01IY1BtpZcrFdlqxPsm8amMjAHMJSuO4Z9d+iL0wREDQIgK7Sg2L6ZyfI8uWaJ BDPwbr/+aJsK/TyKDV79Zwo2lq9R55SlZ18L+GIX8rQYKlmk4ojULIPQ4qVqT0Nxpjq3 E/aXQDCf9t1Leei9bySe7X0jLQIBZpSGNce+IURiE1dzmqKJMce69+cPnMrtapTIiaog RnoG9fQe//BujEy1NmDJhQ5QPBNudN3i3HB0hyQTTQM8k2yPoPOt38jbvSZFrrLqDj+Q SOow== 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=ElTCmOV06u6s2yoY5BoWojybDaymAoMDV7HJAPikkAA=; b=W7UVimDyXlBEGTsBNT3/ISdNbJiVzjbquo1YjeECKh54R2x9Oy7FYmFAcCQofqixPN ECK1uBWhFFkL+ahkxbdGqoMC670ekNn/xV5eLWNR7teeorvK6kssQKykVLYoRCJcwyoG ypbK8vSgfdNYYs85hb14B3VPa0mKpLQl4m8f+kKX+ldLhLqLTMlgn/Zvkqet80qaPQAF 6QPcYHqkMyfRG/2/Oc39hu+/nnIqZ6jgs9O4m6hYa07OV0/wZUlOwX89bxO5EWePj5cY VbXvkDZYuosC38s96c6RrNFlEcnqE9AsZy8mMm/co3dXzpbcjZ3hLyJsSpMFrylTjk/m 6+8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YWy5FtGJ; 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 b21-20020a056a000a9500b0052bb7e1ef57si4054865pfl.369.2022.07.22.00.15.01; Fri, 22 Jul 2022 00:15:18 -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=YWy5FtGJ; 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 S234516AbiGVHOY (ORCPT + 99 others); Fri, 22 Jul 2022 03:14:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbiGVHOH (ORCPT ); Fri, 22 Jul 2022 03:14:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2356D951C6; Fri, 22 Jul 2022 00:14:06 -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 dfw.source.kernel.org (Postfix) with ESMTPS id B431A62197; Fri, 22 Jul 2022 07:14:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D89D4C36AE2; Fri, 22 Jul 2022 07:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658474045; bh=Wv2MG+nWZ7BgS6tx1h+VHggdsb2rNvjySXUohJfACk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YWy5FtGJZPK1pL8pJlprmjQGKf1KCsrp6nxgeQtmwntj/VBrecmscBttAdOGFPJrt wpGPf/unKjmcYYazzi6V0ytKUawColKBBy2tKfJxKZpIL35siJFosKFaNsi1QrlaDT 2g71vdhGoHRH9hMTQJUbW2qwze629xZap0hnlCgyL9JIM2Ja4PAGXV2Fr8RzOwB0Lm ti9Y6ZCBb3LCRZJ36Hxh/8nKEVTA2hLONdxxp3eB11eA+OTa/fsKbNW1pvNVg5Qeyx eRkKZtKwKAzRHw3r4HNFVCddYQsC+yd4ufpUjTQeqsEagp2NgF8PxGGWmQwOYlxOxR s96tl41X6jV9Q== 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 v4 7/9] f2fs: simplify f2fs_force_buffered_io() Date: Fri, 22 Jul 2022 00:12:26 -0700 Message-Id: <20220722071228.146690-8-ebiggers@kernel.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220722071228.146690-1-ebiggers@kernel.org> References: <20220722071228.146690-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.3 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 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 ad0212848a1ab9..1b452bb75af29e 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.37.0