Hi all, Years ago during the adaptation of XFS to persistent memory, a product development team expressed a desire to guarantee that mmap mappings of an S_DAX file on pmem would always get a PMD mapping to increase TLB hit rates. That means ensuring that all space allocations are aligned to 2MB (on x86) and ensuring that the file range of each file space mapping are aligned to 2MB. Then pmem faded. NVME/SCSI atomic write unit support has brought this discussion back to the forefront, because untorn writes to conventional storage only work if the space allocations are aligned to the max atomic write unit. To simplify the administrative model a bit, we want to ensure that the mappings are aligned to the same value. IOWs, for a storage device that supports up to 64k atomic write units, we want to ensure that the file range of all mappings are aligned to 64k. >From a file metadata perspective, these are nearly the same use case. The realtime volume already has a realtime extent size field that forces the alignment of both space and mapping, but not everyone wants to adminster a realtime volume. This patchset adds a forcealign superblock feature and inode flag so that we can impose the same alignment restrictions on selected files on the data volume. IOWs, you can now set an inode flag that causes regular files on the data volume to have rextsize-aligned space mappings. This is an improvement over ext4 bigalloc style things that impose the larger allocation unit size even for things that don't need it. Note: Currently this patchset reuses sb_rextsize for the forcealign value because that enabled reuse of the COW around code that I wrote for realtime reflink that ensures that remapping operations follow forcealign. If you're going to start using this code, I strongly recommend pulling from my git trees, which are linked below. This has been running on the djcloud for months with no problems. Enjoy! Comments and questions are, as always, welcome. --D kernel git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=file-force-align xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=file-force-align --- fs/xfs/libxfs/xfs_bmap.c | 48 +++++++++++++++++++++++++++++++++++++--- fs/xfs/libxfs/xfs_format.h | 19 +++++++++++++--- fs/xfs/libxfs/xfs_inode_buf.c | 36 ++++++++++++++++++++++++++++++ fs/xfs/libxfs/xfs_inode_buf.h | 3 +++ fs/xfs/libxfs/xfs_inode_util.c | 14 ++++++++++++ fs/xfs/libxfs/xfs_sb.c | 30 +++++++++++++++++++++++++ fs/xfs/scrub/inode_repair.c | 41 ++++++++++++++++++++++++++++++++++ fs/xfs/scrub/trace.h | 1 + fs/xfs/xfs_bmap_util.c | 2 -- fs/xfs/xfs_bmap_util.h | 4 ++- fs/xfs/xfs_inode.c | 2 +- fs/xfs/xfs_inode.h | 8 ++++++- fs/xfs/xfs_ioctl.c | 14 ++++++++++++ fs/xfs/xfs_iomap.c | 4 +++ fs/xfs/xfs_mount.h | 2 ++ fs/xfs/xfs_reflink.c | 16 ++++++++++--- fs/xfs/xfs_rtalloc.c | 4 +++ fs/xfs/xfs_super.c | 4 +++ fs/xfs/xfs_trace.h | 4 --- include/uapi/linux/fs.h | 2 ++ 20 files changed, 236 insertions(+), 22 deletions(-)