Alignment size?

Roger Willcocks roger at filmlight.ltd.uk
Fri Aug 13 06:36:05 CDT 2010


On Fri, 2010-08-13 at 10:24 +0400, Michael Tokarev wrote:

> So why xfs decided the block size is 4K??

We had a similar problem with direct io here, with 2.6.9; I quote from
the Bugzilla:

"mkfs.xfs has md-specific code (!) that looks at the raid flavour to
figure stripe parameters, alignment requirements, etc.

"Raid flavours 4,5 and 6 force the alignment to be the same as the file system
block size (which is 4096 bytes)."

Here's a program to test the alignment requirements:

----

#include <xfs/libxfs.h>
#include <fcntl.h>

int main(int argc, char* argv[])
{
	struct dioattr	dio;

	int tfd = open((argc == 2) ? argv[1] : "/mnt/disk1", O_RDONLY, 0666);

	if (ioctl(tfd, XFS_IOC_DIOINFO, &dio) < 0)
		perror("ioctl");
	else {
		printf("min io size = %d\n", dio.d_miniosz);
		printf("max io size = %d\n", dio.d_maxiosz);
		printf("align = %d\n", dio.d_mem);
	}
	close(tfd);
	return 0;
}

----

The same disk set returned 'align = 4096' for raid 5, but 'align = 512' for raid 0.

--
Roger






More information about the xfs mailing list