Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1094146rwe; Sat, 27 Aug 2022 00:02:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR4S2SJIHDL9xhNM9SoapBeyRSjgDmQ0gXkZct1cB1TptvvaOuCD6BVkyn8sI4QUem2D11md X-Received: by 2002:a17:907:2173:b0:73d:c95d:1179 with SMTP id rl19-20020a170907217300b0073dc95d1179mr7339503ejb.89.1661583778101; Sat, 27 Aug 2022 00:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661583778; cv=none; d=google.com; s=arc-20160816; b=ComqvxsOdkVIXzEL92WkKWuy1uNwzBae4e7Ni4B873HaGT/HLgL0Hp3086hQLtE8MF JmqaP8xzg4vUzAkiWR10DM0OTHhYF/RoMEHMLbOIHgOdRgZ6o6QjunUOJZONoH5Vruuo 7aqbYFFDnkzmxulAtVhy4CvDSsAnmjriPpuBhlgKprHTrtzZHDsSram5/Cfe/JnTH4YL W+zZKoQ+smtI4Aa0wUlFxsDnE9SbCS7Tl0uxJ6gB1pENpfau0KV2zWqT670RwDYUPnwJ s/neGZDROPKavkFSjpu78OuFsQ5MhZyGYh/LOwlojBfBCglsvtjij+xxU3L125BsRfHu YXCA== 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=tTpnCfvInqs7O6qNarChX9fIUovVF3mKMXEyPgvQQws=; b=xwuusM3y0+Ef4o3hVb36R6ET59tD1kg6lU0lpwcupHU7eGt4KMFijtEOljnqodLys+ 6QNJqsN91IlvkbRas6OALyQw2QrYxbHdPOVDpQ6xSWmctLWnWMUe52F1dALhOweCwIgn VZLSir7E8uNS92JratqpayG9Hp36ZB7KjaC/F5+0YIhKNZhF4NVM5wvczf+y72nXP7Iu YwqmUkjqn+5jS8FTMU3Oa6Fg3WW4EIer3UwHU1dthyuhWdrZJk6F7wgipWGo2Ed4xQcZ wVUdJzv/4RL3CnBXCs31i9Hg4YcBganSem5Mg9LX8llpuvwBM4+iAA2PvVLcfGlDuNBT jmBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pedZYWIo; 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 bu20-20020a170906a15400b00730a1d3bb99si2621862ejb.436.2022.08.27.00.02.31; Sat, 27 Aug 2022 00:02:58 -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=pedZYWIo; 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 S233223AbiH0HBo (ORCPT + 99 others); Sat, 27 Aug 2022 03:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232911AbiH0HBg (ORCPT ); Sat, 27 Aug 2022 03:01:36 -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 9359D24F3E; Sat, 27 Aug 2022 00:01:35 -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 26D55B82783; Sat, 27 Aug 2022 07:01:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88DB1C43470; Sat, 27 Aug 2022 07:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661583693; bh=0xuShhm2dGVlVdS35K/psQMXih/7EA3C0nxlthmzrd0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pedZYWIoNW+9lCIp8+WakPS5vapg3nIeS1G4/mysv6CfIZndcJTyFf+55ZsuA+aoX Xdxp1ueHBL0vwGMKdhP0aU5LtCqsXe8WsW8LhTz8F7hpOiJnrPVkiKkzcu3lp+y0E7 llWBt5CZ4CIdjIhOsdRdJYxaxOIwvwI9gQB12Oj/V61yCCzR2tpROudUnv4gbqNlLl 8UlxBfBIyMt3TQf7vsDjgDAw3nyZWmoGWLAu9ea3XxRiDAsbBFueT1r59i4i2W4diN G5c+MDjU1hRMW+b3c3tnXbKIMnNrsaWpg/h9XW7XmikreLpz2cX9EqaF6JT/a64zmD s/bGohFpVzqcg== 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 v5 8/8] xfs: support STATX_DIOALIGN Date: Fri, 26 Aug 2022 23:58:51 -0700 Message-Id: <20220827065851.135710-9-ebiggers@kernel.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220827065851.135710-1-ebiggers@kernel.org> References: <20220827065851.135710-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.6 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 xfs, so that direct I/O alignment restrictions are exposed to userspace in a generic way. Signed-off-by: Eric Biggers --- fs/xfs/xfs_iops.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 45518b8c613c9a..f51c60d7e2054a 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -604,6 +604,16 @@ xfs_vn_getattr( stat->blksize = BLKDEV_IOSIZE; stat->rdev = inode->i_rdev; break; + case S_IFREG: + if (request_mask & STATX_DIOALIGN) { + struct xfs_buftarg *target = xfs_inode_buftarg(ip); + struct block_device *bdev = target->bt_bdev; + + stat->result_mask |= STATX_DIOALIGN; + stat->dio_mem_align = bdev_dma_alignment(bdev) + 1; + stat->dio_offset_align = bdev_logical_block_size(bdev); + } + fallthrough; default: stat->blksize = xfs_stat_blksize(ip); stat->rdev = 0; -- 2.37.2