On 6/23/07, Erik Trimble <[EMAIL PROTECTED]> wrote:
Matthew Ahrens wrote:
Basically, the descriptions of Copy on Write.  Or does this apply only
to Snapshots?   My original understanding was that CoW applied whenever
you were making a duplicate of an existing file.
CoW happens all the time.  If you overwrite a file, instead of writing
it to the same location on disk, ZFS allocates a new block, writes to
that, and then creates a new tree in parallel (all on new, previously
unused blocks).  Then it changes the root of the tree to point to the
newly allocated blocks.

Now that I think about it,
I'm not sure that I can see any way to change the behavior of POSIX
calls to allow for this type of mechanism. You'd effectively have to
create a whole new system call with multiple file arguments.  <sigh>
Files that are mostly the same, or exactly the same?  If they're
exactly the same, it's called a hardlink ;)  If they're mostly the
same, I guess, you could come up with a combination of a sparse file
and a symlink.  But I don't think the needed functionality is commonly
enough used to bother implementing in kernel space.  If you really
want it in your application, do it yourself.  Make a little file with
two filenames, and a bitmap indicating which of them the application
blocks should come from.

Now, wouldn't it be nice to have syscalls which would implement "cp" and
"mv", thus abstracting it away from the userland app?
Not really.  Different apps want different behavior in their copying,
so you'd have to expose a whole lot of things - how much of the copy
has completed? how fast is it going? - even if they never get used by
the userspace app.  And it duplicates functionality - you can do
everything necessary in userspace with stat(), read(), write() and
friends.
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to