From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Tue, 4 Oct 2011 10:13:40 -0400 To: 9fans@9fans.net Message-ID: <062948585b96427f121f35b27c1f90fe@brasstown.quanstro.net> In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-awpqoglvcdpexepqtdfjxucnbh" Subject: Re: [9fans] copying fossil filesystem to a bigger disk Topicbox-Message-UUID: 3229996c-ead7-11e9-9d60-3106f5b1d025 This is a multi-part message in MIME format. --upas-awpqoglvcdpexepqtdfjxucnbh Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit > Is there any experiment I can do (not involving a crowbar and a > microscope) to find out the real physical sector size? Bigger > transfers get more of the bandwidth, but then a smaller proportion > of the transfer needs read/modify/write. I could do random addressing > but then I would expect seek time to dominate. > > Not that it matters (my drive works fine), but I'm curious! i think the attached program ought to work. here are some local results. no 4k-sector drives. sorry. if this doesn't work, especially for writing, it's probablly a caching effect. you may need to run till the cache fills up (64mb or so) and then start timing. iosz r (s) riops w wiops model 512 12.227 81.78 5.531 180.78 Hitachi HUA721050KLA330 4096 12.363 80.88 5.649 176.99 Hitachi HUA721050KLA330 512 5.957 167.85 2.636 379.26 SEAGATE ST373455SS (sas) 4096 5.946 168.15 2.665 375.19 SEAGATE ST373455SS (sas) 512 0.181 5494.54 0.168 5941.86 SSDSA2SH064G1GC INTEL (ssd) 4096 0.317 3150.64 0.213 4689.26 SSDSA2SH064G1GC INTEL (ssd) as already known, none of these appear to have any sector size wierdness. surprising, considering the intel ssd is attached to a openrd! - erik --upas-awpqoglvcdpexepqtdfjxucnbh Content-Disposition: attachment; filename=randomio.c Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit #include #include enum { Ios = 1000, /* number of ios / test */ Nanoi = 1000000000, /* 1/nano */ Microi = 1000000, }; enum { Read = 1<<0, Write = 1<<1, }; static int otab[4] = { [Read] OREAD, [Write] OWRITE, [Read|Write] ORDWR, }; static char *rwtab[4] = { [Read] "read", [Write] "write", [Read|Write] "rdwr", }; void rio(int fd, uvlong byte0, uvlong bytes, uint ss, int rw) { char *buf; int i; uvlong maxlba, lba, t, x; long (*io)(int, void*, long, vlong); maxlba = (bytes - byte0) / ss; if(rw == Read) io = pread; else if(rw == Write) io = pwrite; else{ io = nil; /* compiler noise */ sysfatal("not prepared to mix read/write yet"); } buf = malloc(ss); if(buf == nil) sysfatal("malloc"); srand(nsec()); t = -nsec(); for(i = 0; i < Ios; i++){ lba = frand()*maxlba; /* awful. no vlnrand() */ io(fd, buf, ss, byte0 + lba*ss); } t += nsec(); free(buf); print("%s %lld.%03lld\n", rwtab[rw], t/Nanoi, (t%Nanoi)/Microi); x = (uvlong)Ios*(uvlong)Nanoi*100; x /= t; print("%lld.%02lld iops\n", x/100, (x%100)); } void usage(void) { fprint(2, "usage: randomio [-rw] [-o offset] [-s sectorsz] [file ...]\n"); exits("usage"); } void main(int argc, char **argv) { int i, byte0, fd, rw, ss; uvlong bytes; Dir *d; rw = 0; ss = 512; byte0 = 0; ARGBEGIN{ case 'r': rw |= Read; break; case 'w': rw |= Write; break; case 'o': byte0 = atoi(EARGF(usage())); break; case 's': ss = atoi(EARGF(usage())); break; default: usage(); }ARGEND; if(rw == 0) rw = Read; for(i = 0; i < argc; i++){ d = dirstat(argv[i]); if(d == nil) sysfatal("dirstat: %r"); bytes = d->length; free(d); fd = open(argv[i], otab[rw]); if(fd == -1) sysfatal("open: %r"); if(rw & Read) rio(fd, byte0, bytes, ss, Read); if(rw & Write) rio(fd, byte0, bytes, ss, Write); close(fd); } exits(""); } --upas-awpqoglvcdpexepqtdfjxucnbh--