From patchwork Wed Aug 28 05:11:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13780521 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72DF114D6E4; Wed, 28 Aug 2024 05:12:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724821923; cv=none; b=XdR+lAIhIzBUt9DYt7rzZYc6rS2VJJStwwfwokzVoEDflMSuMh4gJBZMAM9HqKy5m2msTLGkGOnZv2U3t4Xe/AjJt8akPDY1soJRefzHK3uudjilEz0hoAyZZIe9FrxCWAeWzGM4lrZnrA5jwgbfw2AAwgfuZkwexTVZgaxPDrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724821923; c=relaxed/simple; bh=8cc0W5NU+qldZRAd0CusfqZSIPrNHbduEc1BabfIInY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WXWXLOCUt8hXa/VhsRNOlVkwZ0NxB5m3/Zr2npjDqdE/sw9Y1/eq4vjQudzYkKu0G7DvUtjiQ61qDh1rKdE3yD6vHK1gP6Q/X8JGjnZKvRgsRAta76DKgyEAwOczAF2EpoWh1MXSgYnVGR6UkgPQq/PvRg+j0tb07BSRf9qO3OI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=ERXLxOVU; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ERXLxOVU" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=iPQuwdA1VZnG8+LspJ1RzscnQlRRZylqWbgkCduTfh8=; b=ERXLxOVU31YLH/9ytBqU2Z/oIH CeoVsEJwMb78WzKjVPESKN2Mxu0f8NTcaUCDKklCZxPkZ88x3M1ue7x5piHIy7eY9d7p0WgzcC5Pd N42XqdBxSCPSdq0GKMbiKEf8bcBX/Lcix51fKRLj+olXiA0ohG77L6it4h/DSyQgIs2cqPa9E2Jqs XDt7zUJKa9PzbITrS0klVORrtNycFKqlywYZi85cltfeH9AbHotB1Z3wjBm6/leEorhxW29Xfww6N l1GnkkCxFN7sudX/Cnh4ch4Af89Jc25qwan+kYXk4PlFkLMS83GO9eePxYlxciGg9/5IS07weGlBS 7n2f8R0Q==; Received: from ppp-2-84-49-240.home.otenet.gr ([2.84.49.240] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjAyN-0000000DsEX-46XY; Wed, 28 Aug 2024 05:12:00 +0000 From: Christoph Hellwig To: Alexander Viro , Christian Brauner Cc: Jan Kara , Chandan Babu R , "Darrick J. Wong" , Hongbo Li , Ryusuke Konishi , linux-nilfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH 1/3] fs: reformat the statx definition Date: Wed, 28 Aug 2024 08:11:01 +0300 Message-ID: <20240828051149.1897291-2-hch@lst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240828051149.1897291-1-hch@lst.de> References: <20240828051149.1897291-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The comments after the declaration are becoming rather unreadable with long enough comments. Move them into lines of their own. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong --- include/uapi/linux/stat.h | 95 +++++++++++++++++++++++++++++---------- 1 file changed, 72 insertions(+), 23 deletions(-) diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h index 887a2528644168..8b35d7d511a287 100644 --- a/include/uapi/linux/stat.h +++ b/include/uapi/linux/stat.h @@ -98,43 +98,92 @@ struct statx_timestamp { */ struct statx { /* 0x00 */ - __u32 stx_mask; /* What results were written [uncond] */ - __u32 stx_blksize; /* Preferred general I/O size [uncond] */ - __u64 stx_attributes; /* Flags conveying information about the file [uncond] */ + /* What results were written [uncond] */ + __u32 stx_mask; + + /* Preferred general I/O size [uncond] */ + __u32 stx_blksize; + + /* Flags conveying information about the file [uncond] */ + __u64 stx_attributes; + /* 0x10 */ - __u32 stx_nlink; /* Number of hard links */ - __u32 stx_uid; /* User ID of owner */ - __u32 stx_gid; /* Group ID of owner */ - __u16 stx_mode; /* File mode */ + /* Number of hard links */ + __u32 stx_nlink; + + /* User ID of owner */ + __u32 stx_uid; + + /* Group ID of owner */ + __u32 stx_gid; + + /* File mode */ + __u16 stx_mode; __u16 __spare0[1]; + /* 0x20 */ - __u64 stx_ino; /* Inode number */ - __u64 stx_size; /* File size */ - __u64 stx_blocks; /* Number of 512-byte blocks allocated */ - __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */ + /* Inode number */ + __u64 stx_ino; + + /* File size */ + __u64 stx_size; + + /* Number of 512-byte blocks allocated */ + __u64 stx_blocks; + + /* Mask to show what's supported in stx_attributes */ + __u64 stx_attributes_mask; + /* 0x40 */ - struct statx_timestamp stx_atime; /* Last access time */ - struct statx_timestamp stx_btime; /* File creation time */ - struct statx_timestamp stx_ctime; /* Last attribute change time */ - struct statx_timestamp stx_mtime; /* Last data modification time */ + /* Last access time */ + struct statx_timestamp stx_atime; + + /* File creation time */ + struct statx_timestamp stx_btime; + + /* Last attribute change time */ + struct statx_timestamp stx_ctime; + + /* Last data modification time */ + struct statx_timestamp stx_mtime; + /* 0x80 */ - __u32 stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ + /* Device ID of special file [if bdev/cdev] */ + __u32 stx_rdev_major; __u32 stx_rdev_minor; - __u32 stx_dev_major; /* ID of device containing file [uncond] */ + + /* ID of device containing file [uncond] */ + __u32 stx_dev_major; __u32 stx_dev_minor; + /* 0x90 */ __u64 stx_mnt_id; - __u32 stx_dio_mem_align; /* Memory buffer alignment for direct I/O */ - __u32 stx_dio_offset_align; /* File offset alignment for direct I/O */ + + /* Memory buffer alignment for direct I/O */ + __u32 stx_dio_mem_align; + + /* File offset alignment for direct I/O */ + __u32 stx_dio_offset_align; + /* 0xa0 */ - __u64 stx_subvol; /* Subvolume identifier */ - __u32 stx_atomic_write_unit_min; /* Min atomic write unit in bytes */ - __u32 stx_atomic_write_unit_max; /* Max atomic write unit in bytes */ + /* Subvolume identifier */ + __u64 stx_subvol; + + /* Min atomic write unit in bytes */ + __u32 stx_atomic_write_unit_min; + + /* Max atomic write unit in bytes */ + __u32 stx_atomic_write_unit_max; + /* 0xb0 */ - __u32 stx_atomic_write_segments_max; /* Max atomic write segment count */ + /* Max atomic write segment count */ + __u32 stx_atomic_write_segments_max; + __u32 __spare1[1]; + /* 0xb8 */ __u64 __spare3[9]; /* Spare space for future expansion */ + /* 0x100 */ }; From patchwork Wed Aug 28 05:11:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13780522 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33DFE14B08A; Wed, 28 Aug 2024 05:12:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724821928; cv=none; b=kdKbi2wVvpZjZL6JchICT/20bsKzrkXRW+t7b302NehXAMqz+91C/X65SwAImUNnc1DRqPTBjwYYQ1qYP/Qval0T3omWjvcM3EDJOfraQrAl+uWx/AZ8CvI3b7oHkHz4b455txxgJAroFr9n0O8+0U9qgxrbIS4rFfwyTsVKrD8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724821928; c=relaxed/simple; bh=bAZfN1k7k/+1mdDLaJSA7/srGf66PBAw+ZdRrsdTldU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=shKfs6Ab0597YysEZ5fIxWV0G5UFwudLGfYpvJlbpy65lRuwjm4v1jAFoaFBd0i3KZRF/cHU0lnJlEcpD/PsYA1kM8r3oo6eXw57iw9eQ7KkfKnpe9IOPDscz5mAyzG7itHBBTWwDilHPjujzYkQGj8D1yHZWeZfKsGiIcVV2sE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=H7UJd+pd; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="H7UJd+pd" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=pHxqFYikJnUNrKoVzAQJtyadD00JY6fqRR9A5v/BpGI=; b=H7UJd+pdO0mwUBtPTCj+PgQV6y MwFAEbb8Iu07wrsRvZN69CeJREG6SK+jsSq/B33S8Oy6vahEQ+HxueUa4DadWHZkCDyJ9pl8XZy8s X65oLEp2RCC4ILOwNgX60jKuFtzVoHO1uUlMAWPI6/IcG3gRcY1+8ezEvFiotID9E1ubH/0Vbr2xO VUe20tmeZNGF/3AQsBDkr4rGw+wW86VAdiLhO/szbJIqcio33e5RWTcvnjshhTo6OqZ9qoPvU9a0v lueyyJpztsiZU8hthyxYlOAr4S+U2Of9zZSw5iF58N3MahNCIdlr2g4K9SHNHd29mxogTdrR1E01N Dyp58KYw==; Received: from ppp-2-84-49-240.home.otenet.gr ([2.84.49.240] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjAyS-0000000DsG3-1Xe7; Wed, 28 Aug 2024 05:12:05 +0000 From: Christoph Hellwig To: Alexander Viro , Christian Brauner Cc: Jan Kara , Chandan Babu R , "Darrick J. Wong" , Hongbo Li , Ryusuke Konishi , linux-nilfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH 2/3] fs: add STATX_DIO_READ_ALIGN Date: Wed, 28 Aug 2024 08:11:02 +0300 Message-ID: <20240828051149.1897291-3-hch@lst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240828051149.1897291-1-hch@lst.de> References: <20240828051149.1897291-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Add a separate dio read align field, as many out of place write file systems can easily do reads aligned to the device sector size, but require bigger alignment for writes. This is usually papered over by falling back to buffered I/O for smaller writes and doing read-modify-write cycles, but performance for this sucks, so applications benefit from knowing the actual write alignment. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong --- fs/stat.c | 1 + include/linux/stat.h | 1 + include/uapi/linux/stat.h | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/stat.c b/fs/stat.c index 89ce1be563108c..044e7ad9f3abc2 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -700,6 +700,7 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer) tmp.stx_mnt_id = stat->mnt_id; tmp.stx_dio_mem_align = stat->dio_mem_align; tmp.stx_dio_offset_align = stat->dio_offset_align; + tmp.stx_dio_read_offset_align = stat->dio_read_offset_align; tmp.stx_subvol = stat->subvol; tmp.stx_atomic_write_unit_min = stat->atomic_write_unit_min; tmp.stx_atomic_write_unit_max = stat->atomic_write_unit_max; diff --git a/include/linux/stat.h b/include/linux/stat.h index 3d900c86981c5b..9d8382e23a9c69 100644 --- a/include/linux/stat.h +++ b/include/linux/stat.h @@ -52,6 +52,7 @@ struct kstat { u64 mnt_id; u32 dio_mem_align; u32 dio_offset_align; + u32 dio_read_offset_align; u64 change_cookie; u64 subvol; u32 atomic_write_unit_min; diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h index 8b35d7d511a287..f78ee3670dd5d7 100644 --- a/include/uapi/linux/stat.h +++ b/include/uapi/linux/stat.h @@ -179,7 +179,8 @@ struct statx { /* Max atomic write segment count */ __u32 stx_atomic_write_segments_max; - __u32 __spare1[1]; + /* File offset alignment for direct I/O reads */ + __u32 stx_dio_read_offset_align; /* 0xb8 */ __u64 __spare3[9]; /* Spare space for future expansion */ @@ -213,6 +214,7 @@ struct statx { #define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */ #define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */ #define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */ +#define STATX_DIO_READ_ALIGN 0x00020000U /* Want/got dio read alignment info */ #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */ From patchwork Wed Aug 28 05:11:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13780523 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F8D514AD02; Wed, 28 Aug 2024 05:12:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724821932; cv=none; b=YtxzvykIVqevK6TGUJuE/saAf9Vdhcy9LTOZ4lESbwfr+LkOgocqiI9uo82q7RRLgJxiD3rDUdxudJc6vunujgpxhdaM9jpCyCCdPIejqXwmkWu28PkVEFeW6mhI8KMS/1n/+Fx4ZRuK52G2TDPu3JvkO1fPMDTJMe9a5tlhnQ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724821932; c=relaxed/simple; bh=Dq9ZMtvcwmpybYTzxLknCdSp9cbIjU0DMI6dO9xpBPE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q2QDAEm/BhF1w9sTLwgmWwsxqPfR/OAA7jHnyJq7TFfxIqj0tSwmDpqWEuF0HXDoj0QrAsSL4292VoBmdQ6wsra5OBZddrHduF2sAPErg/jmuXxnEI3L58MWTGW725X+YJ38cCdvj0clkNAuMLTmm40GnUlJ1kSX0lHOBpYQnvI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Y5hcTLou; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Y5hcTLou" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=qMWulCc75ggbPFFFOIwGcFhC7CEy0JsG+s0/Mq8Ahjk=; b=Y5hcTLouWeIWBIK1g3JnieoAQf 0vMebHya0bdrxRkwInKg5Es8P1IiqvnOeIVjMwsGQnNIoF1fBzt2vhk9M7wPaZtqODy6M26j0BIw1 bvnmPs0yGwst2mHXOHLdsOVtnC4fQY3dW1CYaA5o5P4D5KHLyJNqExHwP6HcYjVCcZjBjwooEVQ6Z y+mEeD/tPqYLjG9hXjIBPJTJkuRuxJXTi/edrMY2LQ6t7TL3r8bpKtvfQ6GdrS0+OiNFhDToqm2dK 4kaERhedFPXdgCyceQijWZWuO+ain02wZboHdet6PFWq8kKaNQZbvNYFy0sIgCyUyiel31oMK2Fk7 cInMSnVA==; Received: from ppp-2-84-49-240.home.otenet.gr ([2.84.49.240] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjAyW-0000000DsIM-3rcu; Wed, 28 Aug 2024 05:12:09 +0000 From: Christoph Hellwig To: Alexander Viro , Christian Brauner Cc: Jan Kara , Chandan Babu R , "Darrick J. Wong" , Hongbo Li , Ryusuke Konishi , linux-nilfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH 3/3] xfs: report the correct read/write dio alignment for reflinked inodes Date: Wed, 28 Aug 2024 08:11:03 +0300 Message-ID: <20240828051149.1897291-4-hch@lst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240828051149.1897291-1-hch@lst.de> References: <20240828051149.1897291-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html For I/O to reflinked blocks we always need to write an entire new file system block, and the code enforces the file system block alignment for the entire file if it has any reflinked blocks. Use the new STATX_DIO_READ_ALIGN flag to report the asymmetric read vs write alignments for reflinked files. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_iops.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 1cdc8034f54d93..de2fc12688dc23 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -570,6 +570,33 @@ xfs_stat_blksize( return PAGE_SIZE; } +static void +xfs_report_dioalign( + struct xfs_inode *ip, + struct kstat *stat) +{ + struct xfs_buftarg *target = xfs_inode_buftarg(ip); + struct block_device *bdev = target->bt_bdev; + + stat->result_mask |= STATX_DIOALIGN | STATX_DIO_READ_ALIGN; + stat->dio_mem_align = bdev_dma_alignment(bdev) + 1; + stat->dio_read_offset_align = bdev_logical_block_size(bdev); + + /* + * On COW inodes we are forced to always rewrite an entire file system + * block. + * + * Because applications assume they can do sector sized direct writes + * on XFS we provide an emulation by doing a read-modify-write cycle + * through the cache, but that is highly inefficient. Thus report the + * natively supported size here. + */ + if (xfs_is_cow_inode(ip)) + stat->dio_offset_align = ip->i_mount->m_sb.sb_blocksize; + else + stat->dio_offset_align = stat->dio_read_offset_align; +} + STATIC int xfs_vn_getattr( struct mnt_idmap *idmap, @@ -635,14 +662,8 @@ xfs_vn_getattr( 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); - } + if (request_mask & (STATX_DIOALIGN | STATX_DIO_READ_ALIGN)) + xfs_report_dioalign(ip, stat); fallthrough; default: stat->blksize = xfs_stat_blksize(ip);