9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Fossil thinks my free space is a wee bit more than it is
@ 2007-10-09 22:31 Anthony Sorace
  2007-10-09 22:53 ` erik quanstrom
  2007-10-10  2:23 ` Russ Cox
  0 siblings, 2 replies; 3+ messages in thread
From: Anthony Sorace @ 2007-10-09 22:31 UTC (permalink / raw)
  To: 9fans

While untarring a big-ish file to a small-ish hard drive, I was
running df on my fossil console to see if I was going to run out of
space.  The output from these successive runs is... not correct:

prompt: fsys main df
	main: 1,644,601,344 used + 2,588,672 free = 1,647,190,016 (99% used)
prompt: fsys main df
	main: 1,652,891,648 used + 35,184,366,387,200 free = 1,647,190,016 (100% used)
prompt: fsys main df
	main: 1,666,473,984 used + 35,184,352,804,864 free = 1,647,190,016 (101% used)
prompt: fsys main df
	main: 1,693,908,992 used + 35,184,325,369,856 free = 1,647,190,016 (102% used)

Overdraft protection? For reference:

:; ls -l /dev/sdC0/fossil
--rw-r----- S 0 a a 1650169856 Aug  1 22:57 /dev/sdC0/fossil

Things seem to be operating more-or-less normally so this isn't a huge
issue, but it's clearly a reporting bug.

Anthony


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] Fossil thinks my free space is a wee bit more than it is
  2007-10-09 22:31 [9fans] Fossil thinks my free space is a wee bit more than it is Anthony Sorace
@ 2007-10-09 22:53 ` erik quanstrom
  2007-10-10  2:23 ` Russ Cox
  1 sibling, 0 replies; 3+ messages in thread
From: erik quanstrom @ 2007-10-09 22:53 UTC (permalink / raw)
  To: 9fans

> prompt: fsys main df
> 	main: 1,644,601,344 used + 2,588,672 free = 1,647,190,016 (99% used)
> prompt: fsys main df
> 	main: 1,652,891,648 used + 35,184,366,387,200 free = 1,647,190,016 (100% used)
> prompt: fsys main df
> 	main: 1,666,473,984 used + 35,184,352,804,864 free = 1,647,190,016 (101% used)
> prompt: fsys main df
> 	main: 1,693,908,992 used + 35,184,325,369,856 free = 1,647,190,016 (102% used)
> 
> Overdraft protection? For reference:
> 
> :; ls -l /dev/sdC0/fossil
> --rw-r----- S 0 a a 1650169856 Aug  1 22:57 /dev/sdC0/fossil
> 
> Things seem to be operating more-or-less normally so this isn't a huge
> issue, but it's clearly a reporting bug.
> 
> Anthony

let's see.  fossil uses bsize=8*1024.  35184366387200/8192 = 4294966600.
that looks like a small negative [sic] u32int to me.

i see where fl->used is incremented, but i don't see where it's decremented.
maybe that's correct, but it looks fishy.

- erik


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] Fossil thinks my free space is a wee bit more than it is
  2007-10-09 22:31 [9fans] Fossil thinks my free space is a wee bit more than it is Anthony Sorace
  2007-10-09 22:53 ` erik quanstrom
@ 2007-10-10  2:23 ` Russ Cox
  1 sibling, 0 replies; 3+ messages in thread
From: Russ Cox @ 2007-10-10  2:23 UTC (permalink / raw)
  To: 9fans

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-10-10  2:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-09 22:31 [9fans] Fossil thinks my free space is a wee bit more than it is Anthony Sorace
2007-10-09 22:53 ` erik quanstrom
2007-10-10  2:23 ` Russ Cox

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).