Re: [PATCH] cowlinks v2

Eric W. Biederman
2004-04-03T20:31:01Z

Jamie Lokier <jamie@shareable.org> writes:

> Eric W. Biederman wrote:
> > > Here's a tricky situation:
> > >
> > > 1. A file is cowlinked. Then each cowlink is mmap()'d, one per process.
> > >
> > > 2. At this point both mappings share the same pages in RAM.
> >
> > Why they have different inodes?
>
> Did you miss the last 20 or so messages in this thread?
>
> We'd like cowlinks that are an invisible filesystem optimisation.
> That means you "copy" a file and it behaves the same as if you copy a file.

Exactly so they would not share the same pages in RAM.

> > > 3. Then one of the cowlinks is written to...
> >
> > I would not worry about sharing page cache entries unless this becomes
> > a common case. If you want to avoid the hit of rereading the file when
> > you have a cow copy it should be simple enough to walk through the list
> > of cow copies and see if anyone else has it open.
>
> It is not a question of performance, it's correctness. Either you
> have cowlinks that behave like copied files, or you accept that when
> cowlinked files are mmapped and written to, they don't behave like
> regular files (not even the original file prior to cowlinking does).
>
> Btw, I'm not suggesting sharing page cache entries.

It sounded like you assumed sharing of page cache entries above.
How do you get to step 2 if the cow copies don't share the same page
cache entries?

Eric