From: ebiederm@xmission.com (Eric W. Biederman)
To: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
Cc: Pavel Machek <pavel@ucw.cz>,
"Patrick J. LoPresti" <patl@users.sourceforge.net>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cowlinks v2
Date: 03 Apr 2004 12:47:58 -0700 [thread overview]
Message-ID: <m1isggonbl.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <20040402165440.GB24861@wohnheim.fh-wedel.de>
Jörn Engel <joern@wohnheim.fh-wedel.de> writes:
> On Tue, 30 March 2004 01:16:35 +0200, Pavel Machek wrote:
> >
> > I think they *should* have separate permissions.
>
> That makes the count 2:2. I'll continue to follow the simple solution
> for some time, but wouldn't like to have it included for now (or ever?)
>
> > Also it should be possible to have file with 2 hardlinks cowlinked
> > somewhere, and possibly make more hardlinks of that one... Having
> > pointer to another inode in place where direct block pointers normally
> > are should be enough (thinking ext2 here).
>
> All right, you are proposing hell. I've tried to think through all
> possibilities and was too scared to continue. So limitation is that
> cowlinks and hardlinks are mutually exclusive, which eliminated all
> problems.
Sounds like a simple place to start.
> If you really want cowlinks and hardlinks to be intermixed freely, I'd
> happily agree with you as soon as you can define the behaviour for all
> possible cases in a simple document and none of them make me scared
> again. Show me that it is possible and makes sense.
Concise summary:
- (indirection inodes) solve the hard link problem.
- Don't share the page cache between cow copies.
For intermixing hard links and cow copy operations a single extra layer
of indirection solves the problem. The cow files point to an (indirection)
inode that holds the hard link count, the real inode number and possibly
a few extra things like permissions. Except for never being pointed
at by a directory entry the real inode works like normal. The link
count of the real inode is the number of indirection inodes pointing
at it.
Caching issues are more subtle. The pathological case is a read only
mapping of the cow file, that expects to see the mapping changed by
some other process writing to the file. Not sharing page cache
entries between cow copies solves this problem.
Once page cache entries are distinct it is possible to move the
trigger down from an open with intent to write, to the first
actual write operation. In aops->prepare_write from sys_write,
and aops->writepage from the mmap version.
And a few scenarios to hopefully make things clear.
So your fs starts out as:
/file1 -> ino1 (link count 2) -> data block #1
/file2 -> ino1 (link count 2) -> data block #1
file1 is only 4K long, so I only need to describe one data block.
Actions:
cowcopy(file2, file3):
/file1 -> ino1 (link count 2) -> ino2 (link count 2) -> data block #1
/file2 -> ino1 (link count 2) -> ino2 (link count 2) -> data block #1
/file3 -> ino3 (link count 1) -> ino2 (link count 2) -> data block #1
copyfile(file3, file4):
/file1 -> ino1 (link count 2) -> ino2 (link count 3) -> data block #1
/file2 -> ino1 (link count 2) -> ino2 (link count 3) -> data block #1
/file3 -> ino3 (link count 1) -> ino2 (link count 3) -> data block #1
/file4 -> ino4 (link count 1) -> ino2 (link count 3) -> data block #1
unlink(file2):
/file1 -> ino1 (link count 1) -> ino2 (link count 3) -> data block #1
/file3 -> ino3 (link count 1) -> ino2 (link count 3) -> data block #1
/file4 -> ino4 (link count 1) -> ino2 (link count 3) -> data block #1
link(file4, file5):
/file1 -> ino1 (link count 1) -> ino2 (link count 3) -> data block #1
/file3 -> ino3 (link count 1) -> ino2 (link count 3) -> data block #1
/file4 -> ino4 (link count 2) -> ino2 (link count 3) -> data block #1
/file5 -> ino4 (link count 2) -> ino2 (link count 3) -> data block #1
write(file3):
/file1 -> ino1 (link count 1) -> ino2 (link count 2) -> data block #1
/file3 -> ino3 (link count 1) -> data block #2
/file4 -> ino4 (link count 2) -> ino2 (link count 2) -> data block #1
/file5 -> ino4 (link count 2) -> ino2 (link count 2) -> data block #1
write(file5):
/file1 -> ino1 (link count 1) -> ino2 (link count 1) -> data block #1
/file3 -> ino3 (link count 1) -> data block #2
/file4 -> ino4 (link count 2) -> data block #3
/file5 -> ino4 (link count 2) -> data block #3
write(file1):
/file1 -> ino1 (link count 1) -> data block #1 (with modified contents)
/file3 -> ino3 (link count 1) -> data block #2
/file4 -> ino4 (link count 2) -> data block #3
/file5 -> ino4 (link count 2) -> data block #3
Does this make things clear?
Eric
next prev parent reply other threads:[~2004-04-03 19:48 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-20 8:34 [PATCH] cowlinks v2 Jörn Engel
2004-03-20 8:49 ` Andrew Morton
2004-03-20 11:27 ` Jörn Engel
2004-03-20 19:28 ` Andrew Morton
2004-03-21 12:43 ` Jörn Engel
2004-03-21 18:53 ` Jörn Engel
[not found] ` <mit.lcs.mail.linux-kernel/20040320083411.GA25934@wohnheim.fh-wedel.de>
2004-03-20 15:03 ` Patrick J. LoPresti
2004-03-20 15:23 ` Jörn Engel
2004-03-29 17:12 ` Pavel Machek
2004-03-29 21:05 ` Patrick J. LoPresti
2004-03-29 23:16 ` Pavel Machek
2004-03-31 14:34 ` Jamie Lokier
2004-03-31 14:45 ` Pavel Machek
2004-03-31 15:20 ` Jamie Lokier
2004-04-02 11:44 ` Tim Connors
2004-04-02 16:54 ` Jörn Engel
2004-04-02 18:01 ` Pavel Machek
2004-04-02 18:17 ` Jörn Engel
2004-04-02 18:23 ` Pavel Machek
2004-04-02 19:28 ` Ross Biro
2004-04-02 21:35 ` Pavel Machek
2004-04-05 8:12 ` Jörn Engel
2004-04-05 8:19 ` Pavel Machek
2004-04-05 8:45 ` Jörn Engel
2004-04-02 20:09 ` Jamie Lokier
2004-04-02 21:39 ` Pavel Machek
2004-04-02 22:00 ` Chris Friesen
2004-04-03 0:49 ` Jamie Lokier
2004-04-03 8:23 ` Pavel Machek
2004-04-03 13:15 ` Jamie Lokier
2004-04-05 8:19 ` Jörn Engel
2004-04-05 8:22 ` Pavel Machek
2004-04-03 0:46 ` Jamie Lokier
2004-04-03 1:04 ` Jamie Lokier
2004-04-03 1:21 ` Erik Andersen
2004-04-03 1:59 ` Jamie Lokier
2004-04-03 3:55 ` Ross Biro
2004-04-03 9:09 ` Pavel Machek
2004-04-03 13:27 ` Jamie Lokier
2004-04-03 18:39 ` Eric W. Biederman
2004-04-03 19:43 ` Jamie Lokier
2004-04-03 20:30 ` Eric W. Biederman
2004-04-03 21:59 ` Jamie Lokier
2004-04-04 8:15 ` Eric W. Biederman
2004-04-05 8:35 ` Jörn Engel
2004-04-05 9:15 ` Eric W. Biederman
2004-04-05 9:18 ` Jörn Engel
2004-04-05 11:43 ` Pavel Machek
2004-04-05 12:17 ` Jamie Lokier
2004-04-05 12:39 ` Jamie Lokier
2004-04-05 12:41 ` Jamie Lokier
2004-04-05 18:03 ` Jörn Engel
2004-04-05 11:10 ` jlnance
2004-04-05 11:46 ` Pavel Machek
2004-04-05 12:35 ` Jamie Lokier
2004-04-05 8:43 ` Jörn Engel
2004-04-03 19:47 ` Eric W. Biederman [this message]
2004-04-05 8:54 ` Jörn Engel
2004-04-05 9:07 ` Eric W. Biederman
2004-03-20 16:48 ` Davide Libenzi
2004-03-21 12:57 ` Jörn Engel
2004-03-21 17:59 ` Davide Libenzi
2004-03-21 18:14 ` Jörn Engel
2004-03-21 20:26 ` Davide Libenzi
2004-03-21 20:35 ` Jörn Engel
2004-03-22 0:18 ` Eric W. Biederman
2004-03-22 0:25 ` Davide Libenzi
2004-03-22 5:07 ` Eric W. Biederman
2004-03-22 5:11 ` Davide Libenzi
2004-03-22 11:20 ` Eric W. Biederman
2004-03-22 16:02 ` Davide Libenzi
2004-03-25 17:49 ` Jamie Lokier
2004-03-25 18:06 ` Eric W. Biederman
2004-03-25 19:43 ` Jamie Lokier
2004-03-25 20:38 ` Linus Torvalds
2004-03-25 22:16 ` Eric W. Biederman
2004-04-01 14:53 ` Jörn Engel
2004-04-02 11:54 ` Tim Connors
2004-03-25 21:46 ` Eric W. Biederman
2004-03-27 10:28 ` Jamie Lokier
2004-03-27 21:00 ` Eric W. Biederman
2004-03-27 21:42 ` Jamie Lokier
2004-03-27 23:45 ` Eric W. Biederman
2004-03-28 0:43 ` Eric W. Biederman
2004-03-28 12:22 ` Jamie Lokier
2004-03-28 20:07 ` Eric W. Biederman
2004-03-28 23:55 ` Jamie Lokier
2004-03-29 1:31 ` Eric W. Biederman
2004-03-29 12:36 ` Jamie Lokier
2004-03-29 19:36 ` Eric W. Biederman
2004-03-29 23:05 ` Jamie Lokier
2004-03-29 23:58 ` Eric W. Biederman
2004-03-29 7:45 ` Denis Vlasenko
2004-03-29 9:28 ` Pavel Machek
2004-03-29 12:40 ` Jamie Lokier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1isggonbl.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=joern@wohnheim.fh-wedel.de \
--cc=linux-kernel@vger.kernel.org \
--cc=patl@users.sourceforge.net \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox