Re: [PATCH 4/4] copyfile: copyfile

From: Anton Altaparmakov
Date: Tue Sep 07 2004 - 09:22:26 EST


On Tue, 2004-09-07 at 15:06, Linus Torvalds wrote:
> On Tue, 7 Sep 2004, JÃrn Engel wrote:
> >
> > Again, the syscall itself may be a stupid idea, but Steve indicated
> > interest for cifs. I'll hide behind his back and let him fight for
> > it. ;)
>
> Well, this isn't useful for cifs.
>
> For cifs to be able to use it, the "copyfile()" interface needs to
> basically just be a pathname operation (ie a "dir->i_op->copy()"), not a
> "struct file" operation. It's more like the VFS "->rename()" or "->link"
> operations, in other words. And it should return -EXDEV the same way
> rename returns EXDEV if the files aren't on the same filesystem.

Indeed. A pathname based operation would be useful for any fs with
"added features". For example, on NTFS it could be used to preserve
named streams and extended attributes which would otherwise be lost.
Mind you, the current NTFS driver cannot create files yet so it will be
a while until such a "copyfile()" is useful there...

> Then you could (and should) make a "generic_file_copy()" function that
> takes that pathname format, and then uses sendfile() to do the copy for
> regular disk-based filesystems.
>
> I think you should be able to copy the "sys_link()" code for almost all of
> the top-level stuff. The only real difference being
>
> - error = dir->i_op->link(old_dentry, dir, new_dentry);
> + error = dir->i_op->copy(old_dentry, dir, new_dentry);
>
> or something.
>
> And no, I don't know how to handle interruptability. I think the right
> answer may be that filesystems that don't support this as a "native op"
> and can't do it quickly should just return an error, and then users can
> copy their multi-gigabyte files by hand, like they used to.
>
> So if we do this, we do this _right_. We also make sure that we error out
> "too much" rather than "too little", so that people don't start depending
> on behaviour that we don't want them to depend on.

Best regards,

Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/, http://www-stu.christs.cam.ac.uk/~aia21/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/