ref: 73ffc757d57e3b84fe62d679425be6be209fcfac
parent: b07a6e33bd1d0653709e4789ee7463a6ff102f67
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Dec 2 16:08:52 EST 2023
git/fs: don't unload large objects when inserting into cache When inserting an object into cache, we try to remove objects from cache to keep the size below the limit. If the object is larger than the cache, we try to unload not only every cached object, but the object we're in the process of inserting. This leads to an immediate unload of the object, which is very wrong.
--- a/sys/src/cmd/git/pack.c
+++ b/sys/src/cmd/git/pack.c
@@ -160,7 +160,7 @@
ref(o);
ncache += o->size;
}
- while(ncache > cachemax && lrutail != nil){
+ while(ncache > cachemax && lrutail != lruhead){
p = lrutail;
lrutail = p->prev;
if(lrutail != nil)