public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* File copy system call proposal
@ 2001-12-08  3:42 Quinn Harris
  2001-12-08  4:00 ` H. Peter Anvin
                   ` (3 more replies)
  0 siblings, 4 replies; 30+ messages in thread
From: Quinn Harris @ 2001-12-08  3:42 UTC (permalink / raw)
  To: linux-kernel

I would like to propose implementing a file copy system call.
I expect the initial reaction to such a proposal would be "feature
bloat" but I believe some substantial benefits can be seen possibly
making it worthwhile, primarily the following:

Copy on write:
>From my experience most files that are copied on the same partition are
copied from a source code directory (eg /usr/src/{src dir}) to somewhere
else in /usr.  These copied files are seldomly modified but usually
truncated (when copied over again).
Instead of actually copying the file in these circumstances something
similar to a hard link could be created.  But unlike a hard link, when
data is written to the file a real duplicate of the file (or possibly
part of the file) will be created.  This is basically identical to the
way a processes memory space is duplicated on a fork.  To create an
illusion of an actual copied file the file system will need to
explicitly support this feature.  This can also eliminate duplication in
the buffer cache when a file is copied.

This feature would drastically reduce the time taken to install a
program from a compiled source tarball.  I also expect on my system this
feature would save about 1/6 of my hard drive space.  Of course this
wouldn't affect performance if the source and destination files are on
different partitions.

All kernel copy:
Commands like cp and install open the source and destination file using
the open sys call.  The data from the source is copied to the
destination by repeatedly calling the read then write sys calls.  This
process involves copying the data in the file from kernel memory space
to the user memory space and back again.  Note that all this copying is
done by the kernel upon calling read or write.  I would expect if this
can be moved completely into the kernel no memory copy operations would
be performed by the processor by using hardware DMA.

On my system a copy takes about 1s of the CPU time per 20MB copied (PII
300Mhz) much of which I expect is spent just copying memory.  This
figure seems a bit high to copy memory so someone please correct me if I
am wrong.


Implementing these features especially the copy on write I expect will
not be trivial.  In addition code that copies files like cp must be
modified to take advantage of these features.

Will many other users benefit from these features?  Will implementing
them (especially copy on write) cause an excessive addition to the code
of the kernel?

Quinn Harris (quinn@nmt.edu)


^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: File copy system call proposal
@ 2001-12-10 18:44 Petr Vandrovec
  0 siblings, 0 replies; 30+ messages in thread
From: Petr Vandrovec @ 2001-12-10 18:44 UTC (permalink / raw)
  To: Daniel Phillips; +Cc: Quinn Harris, linux-kernel@vger.kernel.org, acahalan

On 10 Dec 01 at 16:19, Daniel Phillips wrote:
> On December 10, 2001 06:44 am, Albert D. Cahalan wrote:
> > 
> > No, mmap+write does not do the job. SMB file servers have
> > a remote copy operation. There shouldn't be any need to
> > pull data over the network only to push it back again!
> 
> Hi Albert,
> 
> I don't get it, you're saying that this zero-copy optimization, which happens 
> entirely within the vfs, shouldn't be done because smb can't do it over a 
> network?

VFS can do this optimization (but why...), but having FS-specific
sendfile would be nice too - FS can verify whether both source & destination
are on same filesystem, and if they do, it can perform server filecopy
(if server's implementation filecopy can copy arbitrary long chunk at 
arbitrary offset into another file at some else offset, like Netware's
NWFileServerFileCopy() does).

> > trustees   (NetWare)
> 
> I'd think the mmap-based copy would only use the technique on the data 
> portion of a file.

At least from my exprience with Netware I can say that copy which copies
file trustees happens in at most 1% of all copies (and on Netware
trustees flow through the tree down, so you have usually no trustees
assigned to leaf files) - and this 1% is when you do backup and restore.
In all other cases it would be great surprise that all users which had
rights to old copy have these rights to new copy too.
                                            Best regards,
                                                    Petr Vandrovec
                                                    vandrove@vc.cvut.cz
                                                    

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2001-12-23 23:06 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-08  3:42 File copy system call proposal Quinn Harris
2001-12-08  4:00 ` H. Peter Anvin
2001-12-08  6:03   ` Quinn Harris
2001-12-08 13:57     ` Daniel Phillips
2001-12-09  0:19       ` H. Peter Anvin
2001-12-09  4:56         ` Quinn Harris
2001-12-10  5:44       ` Albert D. Cahalan
2001-12-09 20:25         ` Hans Reiser
2001-12-10 15:19         ` Daniel Phillips
2001-12-13 10:01           ` Andreas Dilger
2001-12-13 21:17             ` Pavel Machek
2001-12-19 20:26               ` Daniel Phillips
2001-12-20 10:09                 ` Pavel Machek
2001-12-20 13:38                   ` Svein Ove Aas
2001-12-20 13:53                     ` Jakob Østergaard
2001-12-20 14:00                       ` Jakob Østergaard
2001-12-23  1:19                       ` Pavel Machek
2001-12-20 14:31                     ` David Woodhouse
2001-12-20 15:06                       ` George Greer
2001-12-20 15:07                         ` David Woodhouse
2001-12-20 21:32                 ` Jamie Lokier
2001-12-08  4:25 ` Christian Lavoie
     [not found] ` <1007833194.17577.0.camel@buffy>
2001-12-08 19:23   ` Quinn Harris
2001-12-08 23:11     ` Ton Hospel
2001-12-09 15:35 ` Pavel Machek
2001-12-10 11:50   ` Albert D. Cahalan
2001-12-10  2:49     ` Hans Reiser
2001-12-10 12:13     ` Pavel Machek
2001-12-10 15:20   ` vda
  -- strict thread matches above, loose matches on Subject: below --
2001-12-10 18:44 Petr Vandrovec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox