Re: [PATCH] cowlinks v2

Jörn Engel
2004-04-05T08:19:46Z

On Sat, 3 April 2004 14:15:39 +0100, Jamie Lokier wrote:
> Pavel Machek wrote:
> > > > Could you not change it back to a normal inode when refcount becomes 1?
> > >
> > > You can only do that if the cowid object has a pointer to the last
> > > remaining reference to it. That's possible, but more complicated and
> > > would incur a little more I/O per cow operation.
> >
> > You'd have to have pointers to all references to it... because you
> > can't tell in advance which one will be the last to go away.
>
> Exactly. Each of the cow pointers would need to be linked in a doubly
> linked list containing them all.

I don't like the list idea. Having the extra cowid (I prefer inode)
indirection costs a few bytes and one lookup, not much. The list is
way too much overhead to get rid of so little in a few cases.

If you really want to, create a new syscall foldfile() that will
remove the indirection for one file, if possible. Then userspace can
do the ugly work of scanning for single-linked cowids (or just leave
it).

Jörn

--
The competent programmer is fully aware of the strictly limited size of
his own skull; therefore he approaches the programming task in full
humility, and among other things he avoids clever tricks like the plague.
-- Edsger W. Dijkstra