Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1762927iog; Thu, 16 Jun 2022 13:19:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uD3mP+gCSlptjdVF+G5V0n8OIQn2CdNCi669b2NsdArOliIZVP1Y7mL2zFhHWTWUGSWbrD X-Received: by 2002:a17:90a:4749:b0:1e3:27a8:2e2a with SMTP id y9-20020a17090a474900b001e327a82e2amr17950090pjg.170.1655410753784; Thu, 16 Jun 2022 13:19:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655410753; cv=none; d=google.com; s=arc-20160816; b=ONOB+lE8H2vNp5a8cmccxRrobbgVK9CEU35YbSW4/qFjPQq62dQ8EcgVj9CynkHzpW sgu7/ULpmY4umKrV7BklSDCW/I+q76JMAUu4ATRalN9qQt+2l7I1V7A0VVM3PgrDzOXg TbC6QmMSq1qIFXTP2hOp9lAUlYhZ104Pc3qzLqAImLEvSAGRUIWshQZL7wYl2PBWHM93 LzP8Dgkyw/AabwH63oEwzFZcNzeYRwmvVRTHc2xqWhvqNo4WQTcTYw+ZZqJ1y02qObCz qNgn94qkXc8PuZ2geRjFsytmJFegMgGFYa5tLgerIZE3EyTIls55Pe4Bh8ZPWeQ2H6ia xcYg== 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=r5eEDE+kk6IV7AJBgHUkn7qsAhuVwnwIZbFb5onEsN0=; b=TFlZk/OPy91SlHvBCuTRn9FnCiiPJCxO3fa1DgF5yhLoFUzpwpXGh4JaQqUcquQShE juRYKC8cvcwymMCRWYeedAXJKI6Ap2f87tLk7ALL1LLGQeU2g3iSuG5ZLOJ/FF7Aigug 3KEr4h2tKbYhy0dUwKdaYCGfHMnWYSjA5J+tjiSzwAZbOx7jDhybAcEfyYNlPt41pz0c oVIHRycsnRACQGPrgXxMI6bizjxNuduDvzwAVVO5ljzblr3t0HGVcEcAOWKF75q3rV8y t5X3eERXWqaMI6NdoeOz0wRG9VF/9Ci0jg5rPII8wHV4dehSKhnT33SEINGBDn3wMD5e 2RYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H19XpfN8; 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 i9-20020a170902c94900b00163b1bfff0bsi4535903pla.232.2022.06.16.13.19.00; Thu, 16 Jun 2022 13:19:13 -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=H19XpfN8; 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 S1378548AbiFPUSm (ORCPT + 99 others); Thu, 16 Jun 2022 16:18:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378441AbiFPUSW (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 2028D35257; Thu, 16 Jun 2022 13:18:21 -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 CAC37B82607; Thu, 16 Jun 2022 20:18:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FD09C3411C; Thu, 16 Jun 2022 20:18:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655410698; bh=3rj4WdawLiqjsFa+aKI99KNDxfLaqIxoRLyLJlDBqmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H19XpfN8GkkUHhYR02xbTsqgogF5KcZJbHrq2kIS32cLsgm/2TNR1T/19NAos3McU l/Wl2AafD9Zgy3V1s5B42RxsH+Lcr1thaddHlXA6tPwB/c+s5ZdpSoEkmCPnXkLDqQ yZEWUrsqkdzLVyKo3PMUdLsG6oJRxPsHxNde2zMl3LhHHDuATsC2d5ni7r2DQj49vr ry1J1B+0DDEEbdzRsng6jfR8ICuBAsK8zqVKKvptaAMGFGv+4hzIBMFRdJALYQdMQg EtWk8LIBNiwVCFtNsRhlO/PUyP2gi+8sMiP51NSoqMU428wT6y/Qk37RuXveINNLck 6/YDojNAp9QTA== 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 8/8] f2fs: support STATX_DIOALIGN Date: Thu, 16 Jun 2022 13:15:06 -0700 Message-Id: <20220616201506.124209-9-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 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 1b452bb75af29..11d75aa3da185 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.36.1