[9fans] io patterns

2011-10-07 Thread erik quanstrom
to beat a dead horse to death, i spent a few minutes writing a little
test program inspired by the little programming language in igbe for
bit-banging the atmel part.  a minimal primer
o   set offset (in bytes)
{}  set up timing
: n ;   loop
r/w read/write
s   seek {n sectors, or 'r' random}
z   set sector size

so this little program times 1000 sectors of sequential read io
{:1000 rs1 ;}
and this one skips sectors

so this little program times 1000 sectors of sequential read io
{:1000 rs1 ;}
and this one would read every other sector
{:1000 rs2 ;}

new# iop -p '{:1000 rs2 ;}' data
0.061
16220.14 iops
new# iop -p '{:1000 rs2 ;}' data
0.299
3340.96 iops

i think the 4k sector test would then be

for(i in 1 2 3 4) iop -p z4096o$i^'{:1000 rs1 ;}' data

- erik#include 
#include 

enum {
Nanoi   = 10,   /* 1/nano */
Microi  = 100,
};

void
ioloop(int fd, uvlong bytes, char *prog)
{
char *buf, *p, *loop;
int l;
uint ss, iops;
uvlong byte0, maxlba, lba, t, x;

/* silence compiler */
iops = 0;
l = 0;
t = 0;

loop = nil;
byte0 = 0;
lba = 0;
ss = 512;
maxlba = (bytes - byte0) / ss;
buf = malloc(ss);
if(buf == nil)
sysfatal("malloc");
srand(nsec());
for(p = prog;; ){
switch(*p){
default:
sysfatal("bad char %c in prog %s\n", *p, prog);
case 0:
goto end;
case ' ':
break;
case ':':   
/* loop */
l = strtol(p+1, &loop, 0);
p = loop;
continue;
case ';':   
/* end */
if(loop == nil)
sysfatal("malformd loop: extra ';'");
if(--l > 0){
p = loop;
continue;
}
loop = nil;
break;
case '{':
iops = 0;
t = - nsec();
break;
case '}':
t += nsec();
print("%lld.%03lld\n", t/Nanoi, (t%Nanoi)/Microi);
x = (uvlong)iops*(uvlong)Nanoi*100;
x /= t;
print("%lld.%02lld iops\n", x/100, (x%100));
break;
case 'o':
byte0 = strtoull(p, &p, 0);
maxlba = (bytes - byte0) / ss;
continue;
case 'z':
ss = strtoul(p, &p, 0);
if(ss == 0)
sysfatal("sector size zero");
maxlba = (bytes - byte0) / ss;
buf = realloc(buf, ss);
if(buf == nil)
sysfatal("realloc: %r");
break;
case 'r':   
/* read */
pread(fd, buf, ss, byte0 + lba*ss);
iops++;
break;
case 'w':   
/* write */
pwrite(fd, buf, ss, byte0 + lba*ss);
iops++;
break;
case 's':   
/* seek */
switch(p[1]){
default:
sysfatal("seek requires argument\n");
case 'r':
lba = frand()*maxlba;   /* awful.  no vlnrand() 
*/
p++;
break;
case 's':
p++;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
p++;
lba += strtol(p, &p, 0);
break;
}
continue;
}
p++;
}
end:
free(buf);
}

void
usage(void)
{
fprint(2, "usage: iop [-p prog] ... [file ...]\n");
exits("usage");
}

void
main(int argc, char **argv)
{
char *prog[25];
int i, j, nprog, fd;
uvlong bytes;
Dir *d;

nprog = 0;

ARGBEGIN{
case 'p':
if(nprog == nelem(prog))
 

Re: [9fans] radar

2011-10-07 Thread Gorka Guardiola
>
> very interesting.  how do i tie this list to some place to grab images?  i'm
> particularly interested in non-us sites.  i want to know of the rains in 
> spain.
>

It does not fall mainly in the plain...
Sorry, could not resist.

G.



Re: [9fans] copying fossil filesystem to a bigger disk

2011-10-07 Thread slash
On Thu, Oct 6, 2011 at 3:35 AM, Peter A. Cejchan  wrote:
> i use WD Caviar Green model WD20EARS (2TB SATA II) without any problems. I
> installed from erik's 9atom.iso

Did you toggle any jumpers on the drive? I finally gave up and returned it.

A new day, a new disk (with 512 byte sectors).

I installed mbr, partitioned the disk, prepped the plan9 partition and
formatted fossil on the new drive. Here's how my old and new disks
look.

su# cat /dev/sdE0/ctl # old
inquiry SAMSUNG SP2004C
model   SAMSUNG SP2004C
serial  S07GJ10Y522190
firmVM100-32
wwn 5f0015522190
flaglba llba smart nop
udma6
reg task 50 cmd 4c017 serr 0  ci 0 is 0 sig 101 sstatus 123
cmd hpcp cr fr pod sud st
modeauto sataii
geometry 390721968 512
part data 0 390721968
part plan9 63 390716865
part 9fat 63 204863
part nvram 204863 204864
part fossil 204864 389668289
part swap 389668289 390716865

su# cat /dev/sdE1/ctl # new
inquiry Hitachi HDS5C3020ALA632
model   Hitachi HDS5C3020ALA632
serial  ML0220FL0220F313JE2D
firmML6OA580
wwn 5000cca369cfb243
flaglba llba smart power nop ata8 sct
udma6
reg task 50 cmd 4c017 serr 0  ci 0 is 0 sig 101 sstatus 123
cmd hpcp cr fr pod sud st
modeauto sataii
geometry 3907029168 512
part data 0 3907029168
part plan9 63 3907024065
part 9fat 63 204863
part nvram 204863 204864
part fossil 204864 3905975489
part swap 3905975489 3907024065

su# fossil/conf /dev/sdE0/fossil # old
fsys main config /dev/sdE0/fossil
fsys main open -V -c 3000


su# fossil/conf /dev/sdE1/fossil # new
fsys main config /dev/sdE1/fossil
fsys main open -V -c 3000


I would like to copy 9fat, nvram and fossil from the old drive to the
new drive. 9fat is no problem. But how about nvram? Can I just use dd?
As for fossil, I have not been able to figure out how to do this.
replica(1) looks like has the capability to do this, but I don't want
to experiment with my live data. Someone who knows how to do this,
please advise. Also, do I need to run any additional fossil commands?

The goal is to retire the old disk and boot off the new one with the
only difference being that there is more free space now.



Re: [9fans] copying fossil filesystem to a bigger disk

2011-10-07 Thread Peter A. Cejchan
>> i use WD Caviar Green model WD20EARS (2TB SATA II) without any problems.
I

> >> installed from erik's 9atom.iso
>
> > Did you toggle any jumpers on the drive? I finally gave up and returned
> it.
>
> No. No jumpers at all are inserted. It worked just out-of-the-box. I had
first to switch to "Treat SATA as AHCI" in BIOS...then I installed from
9atom.iso (not the newest version, however). I still have a huge amount of
data on an ext2 formatted HD, because ext2srv had problems with too many
files/subdirs. I think I will have to write a tar from linux to (another,
unformatted HD) and then untar to fossil... is it an absolutely crazy idea?


Re: [9fans] copying fossil filesystem to a bigger disk

2011-10-07 Thread Steve Simon
Out of interest - what is the problem with ext2srv with too many
files/subdirs? what error does it give, does it crash?

-Steve



Re: [9fans] copying fossil filesystem to a bigger disk

2011-10-07 Thread erik quanstrom
> I would like to copy 9fat, nvram and fossil from the old drive to the
> new drive. 9fat is no problem. But how about nvram? Can I just use dd?

sure.

> As for fossil, I have not been able to figure out how to do this.
> replica(1) looks like has the capability to do this, but I don't want
> to experiment with my live data. Someone who knows how to do this,
> please advise. Also, do I need to run any additional fossil commands?

i think disk/mkfs is nearly idea for this, and isn't very dangerous.  since your
new fossil will start empty, you can't overwrite anything in the old fs.

- erik



[9fans] outage

2011-10-07 Thread erik quanstrom
fyi, there will be a quanstro.net outage for a day or so.
a transformer blew up at 9:15est.

- erik