[OpenAFS-devel] ZFS cache usage tracking

Andrew Deason adeason@sinenomine.net
Mon, 21 Sep 2009 09:22:35 -0500


On Mon, 21 Sep 2009 08:36:23 -0400
Niklas Edmundsson <Niklas.Edmundsson@hpc2n.umu.se> wrote:

> Some additional (probably stupid) thoughts:
> 
> - What happens if you truncate the file by opening it with O_TRUNC, or
>    are we doing that already, or will it make the cache go bezerk?

Well, I don't think the behavior is any different. One we see that
behavior for a file, it is set forever. The only way around it seems to
be to create a new file.

> - I was going to suggest doing fstat() on the fd, but it
>    probably won't help as it would return blocks _on disk_, and stuff
>    still hanging in memory pending a disk flush won't be counted.

Normally a filesystem would report the correct number of blocks in
fstat() even if the data is buffered. You are correct, though; for ZFS
the block usage doesn't get updated immediately. I don't know enough
about the internals to say why.

> - Or just use memcache...

Or a disk cache with UFS, tmpfs, or any non-ZFS fs...

I asked about this on zfs-discuss, by the way:
<http://opensolaris.org/jive/thread.jspa?threadID=113089>

Nothing really useful quite yet, though.

-- 
Andrew Deason
adeason@sinenomine.net