Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp363461imi; Fri, 22 Jul 2022 00:15:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vLFjVEqrv5bmeSPVh/0KxCEm+e519p6VDtzWEkRbdJ/nzpRi3shyENSRLQk400UJHDkPdC X-Received: by 2002:a17:902:e747:b0:16c:3ffd:61e4 with SMTP id p7-20020a170902e74700b0016c3ffd61e4mr2091451plf.12.1658474116473; Fri, 22 Jul 2022 00:15:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658474116; cv=none; d=google.com; s=arc-20160816; b=x3ZU/oeT6xU6bJIeCg0duh4ujnRdbNG4W26FPX3b0lBD6bmbMheE3zyY+o1EKodWeY z4a46NU4z66wMXX7iWq7cNRD5IejPJqFquOuLjBUmeI3Dp/94CvRdWmSR2Md/+FyJ2D6 3pbAqhgF9ugWZexIiVUBozqCq6H3TkWWbFnUhhU2m0I3Mz7w8EYMQXCOa48krrTKctzV QsbdLrEOFfCpE4FAJTo3nDMYSn5fsYcqm320sEid45OTlb+uOiZpg8YUM525vbtPq3jn p9mQL4apJwYiP5qmXj5+yZLyZ1GGQCH0g17SjNl990GisF76RWSLRqjnWFWAnu/kXXr2 MLww== 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=8xyDE+I/nToE5Pxu6c0dfW9XJVaYYhbDsj4ryHoT4Q8=; b=B3xET5gkb8aCfF1noi8htdv/JU5RBazwL48pO/ww481ojf1kbensEkee9H7D8+ye96 uaBKiHWxP9cwqSyJvcEPW3k14e8RCgRRCtOprT+kmv3KH0ZgHIK01Uyw5bOeo8Rz1JsS sD6DYjJpx0a0XXj9XXvUQC3FkrL2Dem4AYJOX/pxyfeFy+MnafhUiN0oYq+g1w7jiaWo yxeaam4sMfIAVlybhTu4GHxIDnao6jk+GQkz6b9ufzuTwbup+k8J+4cYKKksBEGc7Bmy glzpy5eSk8Wxz2WocWHYlqz/5u841IULBRwHAYEfq5tJOV5z0w4C8DnGEjpF/bbP1nvz I/Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HHUHOmot; 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 z18-20020a634c12000000b004121de66c38si4635477pga.3.2022.07.22.00.15.00; Fri, 22 Jul 2022 00:15:16 -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=HHUHOmot; 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 S234504AbiGVHOX (ORCPT + 99 others); Fri, 22 Jul 2022 03:14:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234386AbiGVHOJ (ORCPT ); Fri, 22 Jul 2022 03:14:09 -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 43E1F936BA; Fri, 22 Jul 2022 00:14:08 -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 E2D96B8275B; Fri, 22 Jul 2022 07:14:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A6A9C341CB; Fri, 22 Jul 2022 07:14:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658474045; bh=yNPRgSeWTnsQodx2HX1gpV+aMEKrajl9C8NqSSYb2uQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HHUHOmotxC+q834q8Lxhf9RUyvTzh8jXRI3uIl5diKurDCYRpkMt+ADLIhoDcbT/Q LRigaPp9+S0vQFNSylt1xXtI4iq7f/0LWYA2rN510ZRqrLVQ1lZ4/Xy5XL9GGSkb4s FMnaAQYwjSv9rm8kjbDt4f67E86JQs3W6C3yTxqu64u35nWlm+aazzBvpLXSuV6+s4 wwEJ56CezLq01exxlwB398T1NJCiN1ihPWVbFW5kpdCrXGzMtUTnOOai0o7AVHebmS TDyBfSIPvsVWq8BWxGThTMrrIEKr+VY+pZ0904xa1pwj9MLxC8SBE3lt5LMBDzvHwO mHtw/hDN52AXw== 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 8/9] f2fs: support STATX_DIOALIGN Date: Fri, 22 Jul 2022 00:12:27 -0700 Message-Id: <20220722071228.146690-9-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 Add support for STATX_DIOALIGN to f2fs, so that direct I/O alignment restrictions are exposed to userspace in a generic way. Signed-off-by: Eric Biggers --- fs/f2fs/file.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 1b452bb75af29e..11d75aa3da185a 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -852,6 +852,21 @@ int f2fs_getattr(struct user_namespace *mnt_userns, const struct path *path, stat->btime.tv_nsec = fi->i_crtime.tv_nsec; } + /* + * Return the DIO alignment restrictions if requested. We only return + * this information when requested, since on encrypted files it might + * take a fair bit of work to get if the file wasn't opened recently. + */ + if ((request_mask & STATX_DIOALIGN) && S_ISREG(inode->i_mode)) { + unsigned int bsize = i_blocksize(inode); + + stat->result_mask |= STATX_DIOALIGN; + if (!f2fs_force_buffered_io(inode)) { + stat->dio_mem_align = bsize; + stat->dio_offset_align = bsize; + } + } + flags = fi->i_flags; if (flags & F2FS_COMPR_FL) stat->attributes |= STATX_ATTR_COMPRESSED; -- 2.37.0