Re: cp(1) and mmap

From: Maxim Sobolev <sobomax_at_FreeBSD.org>
Date: Thu, 29 May 2008 16:22:10 -0700
Diomidis Spinellis wrote:
> Andriy Gapon wrote:
>> on 28/05/2008 12:02 Harti Brandt said the following:
>>> Hi all,
>>>
>>> it looks like there is no fallback in cp(1) when mmaping the source file
>>> fails. I'm mounting SMB shares via smbnetfs (which in turn uses fuse)
>>> and it seems not to support mmaping files. Shouldn't cp just fallback to
>>> a normal read()/write() loop in this case?
>>
>> I would think that it should.
>> This topic was brought up several times, but no resolution so far.
>> I think that I've even seen patches.
>>
> 
> I've not seen the patches, but the fix is trivial (see the attached 
> patch).  If there are no objections, I can commit it.
> 
> I also think we should use mmap for larger files, mmapping and writing 
> them out in several chunks.

I believe that even better way is to extend sendfile(2) to allow both 
sockets and file descriptors to be used as the destination and use that 
interface instead of mmap/read/write. Linux for example allows that.

-Maxim
Received on Thu May 29 2008 - 21:44:13 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:31 UTC