diff options
author | Russ Cox <rsc@swtch.com> | 2012-04-07 15:38:59 -0400 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2012-04-07 15:38:59 -0400 |
commit | 20271fedfbb182304b414c35f049dfb81d31fc9a (patch) | |
tree | 148ad464a015525b25af3fd7f27138bbb47c7cda /src/cmd/venti | |
parent | b27a990f9fc8cd38e92565901c5be620e75415df (diff) | |
download | plan9port-20271fedfbb182304b414c35f049dfb81d31fc9a.tar.gz plan9port-20271fedfbb182304b414c35f049dfb81d31fc9a.tar.bz2 plan9port-20271fedfbb182304b414c35f049dfb81d31fc9a.zip |
venti: add arenapart support to wrarena
R=rsc
http://codereview.appspot.com/5988058
Diffstat (limited to 'src/cmd/venti')
-rw-r--r-- | src/cmd/venti/srv/wrarena.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/cmd/venti/srv/wrarena.c b/src/cmd/venti/srv/wrarena.c index ea5bd164..69dfca16 100644 --- a/src/cmd/venti/srv/wrarena.c +++ b/src/cmd/venti/srv/wrarena.c @@ -131,6 +131,7 @@ threadmain(int argc, char *argv[]) int i; char *file; Arena *arena; + ArenaPart *ap; u64int offset, aoffset; Part *part; uchar buf[8192]; @@ -180,6 +181,14 @@ threadmain(int argc, char *argv[]) part = initpart(file, OREAD); if(part == nil) sysfatal("can't open file %s: %r", file); + initdcache(8 * MaxDiskBlock); + + // Try as arena partition. + arena = nil; + ap = initarenapart(part); + if(ap == nil) + goto loaded; + if(readpart(part, aoffset, buf, sizeof buf) < 0) sysfatal("can't read file %s: %r", file); @@ -191,12 +200,12 @@ threadmain(int argc, char *argv[]) head.size, part->size); partblocksize(part, head.blocksize); - initdcache(8 * MaxDiskBlock); arena = initarena(part, aoffset, head.size, head.blocksize); if(arena == nil) sysfatal("initarena: %r"); +loaded: z = nil; if(host==nil || strcmp(host, "/dev/null") != 0){ z = vtdial(host); @@ -211,7 +220,12 @@ threadmain(int argc, char *argv[]) for(i=0; i<12; i++) vtproc(vtsendthread, nil); - rdarena(arena, offset); + if(ap != nil) { + for(i=0 i<ap->narenas; i++) + rdarena(ap->arenas[i], 0); + } else + rdarena(arena, offset); + memset(&zerocl, 0, sizeof zerocl); for(i=0; i<12; i++) send(c, &zerocl); |