xfs
[Top] [All Lists]

Re: how does sectsz is determined ?

To: "Raz" <raziebe@xxxxxxxxx>
Subject: Re: how does sectsz is determined ?
From: "Eric Sandeen" <sandeen@xxxxxxxxxxx>
Date: Thu, 7 Jan 2010 10:35:17 -0600 (CST)
Cc: linux-xfs@xxxxxxxxxxx
Importance: Normal
In-reply-to: <5d96567b1001062337w105194c8u8eff888444709925@xxxxxxxxxxxxxx>
References: <5d96567b1001062337w105194c8u8eff888444709925@xxxxxxxxxxxxxx>
User-agent: SquirrelMail/1.4.8-5.el5.centos.10
Raz wrote:
> How does sectsz determined to be 512 or 4096 ?
> I have an xfs file system over software raid , and sometimes I have
> 1/2K sector size
> and sometimes 4K . Problem is that direct io buffers are aligned to
> 1/2k and not 4K.
> kernel is 2.6.18-8.el5. thank you.
> raz
>
>
> meta-data=/dev/md5               isize=256    agcount=33, agsize=10992384
> blks
>          =                       sectsz=4096  attr=0
> data     =                       bsize=4096   blocks=351780864, imaxpct=25
>          =                       sunit=768    swidth=768 blks, unwritten=1
> naming   =version 2              bsize=4096
> log      =internal               bsize=4096   blocks=32768, version=2
>          =                       sectsz=4096  sunit=1 blks
> realtime =none                   extsz=3145728 blocks=0, rtextents=0
>

for actual hardware sector size, see platform_findsizes(char *path, int
fd, long long *sz, int *bsz) :


        if (ioctl(fd, BLKSSZGET, bsz) < 0) {
                fprintf(stderr, _("%s: warning - cannot get sector size "
                                "from block device %s: %s\n"),
                        progname, path, strerror(errno));
                *bsz = BBSIZE;
        }

but also for software raid, which is more relevant to your case:

int
md_get_subvol_stripe(
        char            *dfile,
        sv_type_t       type,
        int             *sunit,
        int             *swidth,
        int             *sectalign,
        struct stat64   *sb)
{
...
                *sectalign = (md.level == 4 || md.level == 5 || md.level
== 6);
...
}

This sets ft->sectoralign,

        if (ft.sectoralign) {
                sectorsize = blocksize;
                sectorlog = libxfs_highbit32(sectorsize);
                if (loginternal) {
                        lsectorsize = sectorsize;
                        lsectorlog = sectorlog;
                }
        }

IOW we set "sector size" to the block size to avoid md switching cache
sizes...

-Eric

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