Re: [PATCH] cowlinks v2

Jamie Lokier
2004-04-03T00:46:47Z

Pavel Machek wrote:
> Actually, my solution has one weirdness...
>
> > a
> copyfile a b
> rm a
>
> ...now b has pointer to cowid with usage count of 1. Which is slightly
> ugly (and wastes one cowid entry), but should be harmless.

That's necessary, unless the cowid object has a linked list of all the
inodes which point to it, a bit like inodes having a linke list of all
parent directories which point to them. That's not impossible, but
leaving the unnecessary cowid object is much simpler and will result
in less I/O (no doubly-linked list to update). It can be garbage
collected when the last reference is followed to it.

> > get_data_id() is one way to detect equivalent files. Another would be
> > a function files_equal(fd1, fd2) which returns a boolean.
>
> files_equal(...) would lead to quadratic number of calls, no?

Yes. </blush>

-- Jamie