Introduction
Introduction Statistics Contact Development Disclaimer Help
tventi: add -s flag to disable redundant SHA1 in mirrorarenas - plan9port - [fo…
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit 92baf59b693e2f2a624e6f4fc7262c438103664d
parent 2c0dfd420a4aa121b6e76f19bfb0a82348f8983a
Author: Russ Cox <[email protected]>
Date: Thu, 23 Aug 2007 11:01:20 -0400
venti: add -s flag to disable redundant SHA1 in mirrorarenas
Diffstat:
M src/cmd/venti/srv/mirrorarenas.c | 44 ++++++++++++++++++++---------…
1 file changed, 28 insertions(+), 16 deletions(-)
---
diff --git a/src/cmd/venti/srv/mirrorarenas.c b/src/cmd/venti/srv/mirrorarenas.c
t@@ -22,13 +22,14 @@ Part *src;
Part *dst;
int force;
int verbose;
+int dosha1 = 1;
char *status;
uvlong astart, aend;
void
usage(void)
{
- fprint(2, "usage: mirrorarenas [-v] src dst [ranges]\n");
+ fprint(2, "usage: mirrorarenas [-sv] src dst [ranges]\n");
threadexitsall("usage");
}
t@@ -240,7 +241,7 @@ void
mirror(Arena *sa, Arena *da)
{
vlong v, si, di, end;
- int clumpmax, blocksize;
+ int clumpmax, blocksize, sealed;
static uchar buf[MaxIoSize];
ArenaHead h;
DigestState xds, *ds;
t@@ -305,7 +306,8 @@ mirror(Arena *sa, Arena *da)
shaoff = 0;
ds = nil;
- if(sa->diskstats.sealed && scorecmp(sa->score, zeroscore) != 0){
+ sealed = sa->diskstats.sealed && scorecmp(sa->score, zeroscore) != 0;
+ if(sealed && dosha1){
/* start sha1 state with header */
memset(&xds, 0, sizeof xds);
ds = &xds;
t@@ -362,7 +364,7 @@ mirror(Arena *sa, Arena *da)
if(ewritepart(dst, end, buf, blocksize) < 0)
return;
- if(ds){
+ if(sealed){
/*
* ... but on the final pass, copy the encoding
* of the tail information from the source
t@@ -375,20 +377,27 @@ mirror(Arena *sa, Arena *da)
if(asha1(dst, shaoff, end, ds) < 0
|| copy(end, end+blocksize-VtScoreSize, "tail", ds) < 0)
return;
- memset(buf, 0, VtScoreSize);
- sha1(buf, VtScoreSize, da->score, ds);
- if(scorecmp(sa->score, da->score) == 0){
+ if(dosha1){
+ memset(buf, 0, VtScoreSize);
+ sha1(buf, VtScoreSize, da->score, ds);
+ if(scorecmp(sa->score, da->score) == 0){
+ if(verbose)
+ chat("%T %s: %V sealed mirrored\n", sa…
+ if(ewritepart(dst, end+blocksize-VtScoreSize, …
+ return;
+ }else{
+ chat("%T %s: sealing dst: score mismatch: %V v…
+ memset(&xds, 0, sizeof xds);
+ asha1(dst, base-blocksize, end+blocksize-VtSco…
+ sha1(buf, VtScoreSize, 0, &xds);
+ chat("%T reseal: %V\n", da->score);
+ status = "errors";
+ }
+ }else{
if(verbose)
- chat("%T %s: %V sealed mirrored\n", sa->name, …
- if(ewritepart(dst, end+blocksize-VtScoreSize, da->scor…
+ chat("%T %s: %V mirrored\n", sa->name, sa->sco…
+ if(ewritepart(dst, end+blocksize-VtScoreSize, sa->scor…
return;
- }else{
- chat("%T %s: sealing dst: score mismatch: %V vs %V\n",…
- memset(&xds, 0, sizeof xds);
- asha1(dst, base-blocksize, end+blocksize-VtScoreSize, …
- sha1(buf, VtScoreSize, 0, &xds);
- chat("%T reseal: %V\n", da->score);
- status = "errors";
}
}else{
chat("%T %s: %,lld used mirrored\n",
t@@ -462,6 +471,9 @@ threadmain(int argc, char **argv)
case 'v':
verbose++;
break;
+ case 's':
+ dosha1 = 0;
+ break;
default:
usage();
}ARGEND
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.