From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu Subject: Re: [9fans] Fossil thinks my free space is a wee bit more than it is From: "Russ Cox" Date: Tue, 9 Oct 2007 22:23:50 -0400 In-Reply-To: <509071940710091531t4929a165k7cce6f53a6b50599@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: <20071010022352.3D3B71E8C26@holo.morphisms.net> Topicbox-Message-UUID: cd7365ce-ead2-11e9-9d60-3106f5b1d025 The fix should be to edit the bottom of /sys/src/cmd/fossil/cache.c:/^doRemoveLink changing l.epochClose = p->epoch; blockSetLabel(b, &l, 0); to l.epochClose = p->epoch; if(l.epochClose == l.epoch){ vtLock(c->fl->lk); if(l.epoch == c->fl->epochlow) c->fl->nused--; blockSetLabel(b, &l, 0); vtUnlock(c->fl->lk); }else blockSetLabel(b, &l, 0); Untested. Treating l.epoch == l.epochClose as meaning the block is free is an optimization that allows fossil to reclaim space allocated and then discarded in the same snapshot. The nused tracking code was not changed when the optimization got added, causing the misreported use numbers. Also, you can delete u32int nfree; from struct FreeList. It is never accessed. Russ