On Wed, Mar 06, 2024 at 05:59:01PM -0800, Luis Chamberlain wrote: > On Mon, Feb 26, 2024 at 07:25:23AM -0800, Luis Chamberlain wrote: > root@frag ~/bcc (git::blkalgn)# cat > /sys/block/vdh/queue/physical_block_size > 4096 > root@frag ~/bcc (git::blkalgn)# cat > /sys/block/vdh/queue/logical_block_size > 512 This device supports 512 byte aligned IOs. > mkfs.xfs -f -b size=4k -s size=4k /dev/vdh This sets the filesystem block size to 4k, and the smallest metadata block size to 4kB (sector size). It does not force user data direct IO alignment to be 4kB - that is determined by what the underlying block device supports, not the filesystem block size or metadata sector size is set to. Sure, doing 512 byte aligned/sized IO to a 4kB sector sizer device is not optimal. IO will to the file will be completely serialised because they are sub-fs-block DIO writes, but it does work because the underlying device allows it. Nobody wanting a performant application will want to do this, but there are cases where this case fulfils important functional requirements. e.g. fs tools and loop devices that use direct IO to access file based filesystem images that have 512 byte sector size will just work on such a fs and storage setup, even though the host filesystem isn't configured to use 512 byte sector alignment directly itself.... -Dave. -- Dave Chinner david@xxxxxxxxxxxxx