ref: e4f3f7f43df2408e8ed65aabe784c94ef9eccf90
parent: 5badc3e05b21eff267cf84b03ef0eba045f4aee0
author: Michael Forney <mforney@mforney.org>
date: Sun Feb 6 05:39:48 EST 2022
remove some redundant hash calculations
--- a/blk.c
+++ b/blk.c
@@ -491,7 +491,7 @@
oldhd = a->head.addr;
a->head.addr = hd->bp.addr;
- a->head.hash = blkhash(hd);
+ a->head.hash = hd->bp.hash;
a->head.gen = -1;
if(syncarena(a) == -1)
return -1;
@@ -763,7 +763,7 @@
setmalloctag(b, getcallerpc(&bp));
h = blkhash(b);
if((flg&GBnochk) == 0 && h != bp.hash){
- fprint(2, "corrupt block %B: %.16llux != %.16llux\n", bp, blkhash(b), bp.hash);
+ fprint(2, "corrupt block %B: %.16llux != %.16llux\n", bp, h, bp.hash);
qunlock(&fs->blklk[i]);
abort();
return nil;
--- a/ream.c
+++ b/ream.c
@@ -113,7 +113,7 @@
if(syncblk(b) == -1)
sysfatal("ream: init log");
- bh = blkhash(b);
+ bh = b->bp.hash;
bo = b->bp.addr;
memset(b, 0, sizeof(Blk));