From owner-freebsd-current@FreeBSD.ORG Thu May 29 23:44:13 2008 Return-Path: Delivered-To: current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C55D1065673; Thu, 29 May 2008 23:44:13 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from sippysoft.com (gk1.360sip.com [72.236.70.240]) by mx1.freebsd.org (Postfix) with ESMTP id E1AF78FC18; Thu, 29 May 2008 23:44:12 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from [192.168.0.40] ([204.244.149.125]) (authenticated bits=0) by sippysoft.com (8.13.8/8.13.8) with ESMTP id m4TNMHRi091755 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 29 May 2008 16:22:18 -0700 (PDT) (envelope-from sobomax@FreeBSD.org) Message-ID: <483F3AA2.8000601@FreeBSD.org> Date: Thu, 29 May 2008 16:22:10 -0700 From: Maxim Sobolev Organization: Sippy Software, Inc. User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: Diomidis Spinellis References: <20080528110003.Q24259@beagle.kn.op.dlr.de> <483D5DF8.4020504@icyb.net.ua> <483F1559.2020600@aueb.gr> In-Reply-To: <483F1559.2020600@aueb.gr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Harti Brandt , Andriy Gapon , current@FreeBSD.org Subject: Re: cp(1) and mmap X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 May 2008 23:44:13 -0000 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