[Top] [All Lists]

Re: Alignment size?

To: Michael Tokarev <mjt@xxxxxxxxxx>
Subject: Re: Alignment size?
From: Roger Willcocks <roger@xxxxxxxxxxxxxxxx>
Date: Fri, 13 Aug 2010 12:36:05 +0100
Cc: Dave Chinner <david@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <4C64E52E.2060806@xxxxxxxxxxxxxxxx>
References: <4C64715F.8060000@xxxxxxxxxxxxxxxx> <20100812234911.GC10429@dastard> <4C64E52E.2060806@xxxxxxxxxxxxxxxx>
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)
        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);
        return 0;


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


<Prev in Thread] Current Thread [Next in Thread>