From c91fd355186fc44d6f107d300dee81eafbcec280 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 6 Jan 2025 00:51:36 +0000 Subject: [PATCH] gefs: getblk(): remove duplicate getcallerpc(), check b->bp.gen from cache --- sys/src/cmd/gefs/blk.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/sys/src/cmd/gefs/blk.c b/sys/src/cmd/gefs/blk.c index 588f54a5d..dc683849b 100644 --- a/sys/src/cmd/gefs/blk.c +++ b/sys/src/cmd/gefs/blk.c @@ -735,18 +735,15 @@ getblk(Bptr bp, int flg) } if((b = cacheget(bp.addr)) != nil){ assert(checkflag(b, 0, Bfreed)); - b->lasthold = getcallerpc(&bp); - qunlock(&fs->blklk[i]); - poperror(); - return b; + assert(b->bp.gen == bp.gen); + } else { + b = cachepluck(); + b->alloced = getcallerpc(&bp); + readblk(b, bp, flg); + b->bp.gen = bp.gen; + cacheins(b); } - b = cachepluck(); - b->alloced = getcallerpc(&bp); - b->alloced = getcallerpc(&bp); - readblk(b, bp, flg); - b->bp.gen = bp.gen; b->lasthold = getcallerpc(&bp); - cacheins(b); qunlock(&fs->blklk[i]); poperror();