how does sectsz is determined ?
Eric Sandeen
sandeen at sandeen.net
Thu Jan 7 10:35:17 CST 2010
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
More information about the xfs
mailing list