From b3d44a51419835490f4ff174387f74e0860ab937 Mon Sep 17 00:00:00 2001 From: Ori Bernstein Date: Mon, 6 Jan 2025 02:45:53 +0000 Subject: [PATCH] gefs: use broke() when we get a corrupt block now that broke() doesn't abort the whole fs, but instead makes it go read-only, it makes sense to just use it in all cases that get a corrupt block --- sys/src/cmd/gefs/blk.c | 8 ++------ sys/src/cmd/gefs/dat.h | 1 - sys/src/cmd/gefs/load.c | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/sys/src/cmd/gefs/blk.c b/sys/src/cmd/gefs/blk.c index dc683849b..b6ac8bbac 100644 --- a/sys/src/cmd/gefs/blk.c +++ b/sys/src/cmd/gefs/blk.c @@ -118,12 +118,8 @@ readblk(Blk *b, Bptr bp, int flg) xh = bp.hash; ck = blkhash(b); } - if((!flg&GBnochk) && ck != xh){ - if(!(flg&GBsoftchk)) - broke("%s: %ullx %llux != %llux", Ecorrupt, bp.addr, xh, ck); - fprint(2, "%s: %ullx %llux != %llux", Ecorrupt, bp.addr, xh, ck); - error(Ecorrupt); - } + if((!flg&GBnochk) && ck != xh) + broke("%s: %ullx %llux != %llux", Ecorrupt, bp.addr, xh, ck); assert(b->magic == Magic); } diff --git a/sys/src/cmd/gefs/dat.h b/sys/src/cmd/gefs/dat.h index ec65f243a..4e42cb68e 100644 --- a/sys/src/cmd/gefs/dat.h +++ b/sys/src/cmd/gefs/dat.h @@ -269,7 +269,6 @@ enum { GBraw = 1<<0, GBwrite = 1<<1, GBnochk = 1<<2, - GBsoftchk = 1<<3, }; enum { diff --git a/sys/src/cmd/gefs/load.c b/sys/src/cmd/gefs/load.c index 42d418866..b834366c5 100644 --- a/sys/src/cmd/gefs/load.c +++ b/sys/src/cmd/gefs/load.c @@ -27,13 +27,13 @@ loadarena(Arena *a, Bptr hd) h0 = nil; h1 = nil; if(!waserror()){ - h0 = getblk(bp, GBsoftchk); + h0 = getblk(bp, 0); poperror(); }else print("loading arena primary header: %s\n", errmsg()); bp.addr += Blksz; if(!waserror()){ - h1 = getblk(bp, GBsoftchk); + h1 = getblk(bp, 0); poperror(); }else print("loading arena backup header: %s\n", errmsg());