9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@swtch.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Fossil thinks my free space is a wee bit more than it is
Date: Tue,  9 Oct 2007 22:23:50 -0400	[thread overview]
Message-ID: <20071010022352.3D3B71E8C26@holo.morphisms.net> (raw)
In-Reply-To: <509071940710091531t4929a165k7cce6f53a6b50599@mail.gmail.com>

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



      parent reply	other threads:[~2007-10-10  2:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-09 22:31 Anthony Sorace
2007-10-09 22:53 ` erik quanstrom
2007-10-10  2:23 ` Russ Cox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071010022352.3D3B71E8C26@holo.morphisms.net \
    --to=rsc@swtch.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).