From owner-freebsd-fs@FreeBSD.ORG Wed Jan 11 07:05:19 2012 Return-Path: Delivered-To: fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03EF11065670 for ; Wed, 11 Jan 2012 07:05:19 +0000 (UTC) (envelope-from mi+thun@aldan.algebra.com) Received: from vms173017pub.verizon.net (vms173017pub.verizon.net [206.46.173.17]) by mx1.freebsd.org (Postfix) with ESMTP id D31AA8FC15 for ; Wed, 11 Jan 2012 07:05:18 +0000 (UTC) Received: from [192.168.1.8] ([unknown] [96.242.210.31]) by vms173017.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LXM001C1E8B2AK0@vms173017.mailsrvcs.net> for fs@freebsd.org; Wed, 11 Jan 2012 00:05:04 -0600 (CST) Message-id: <4F0D268B.9060908@aldan.algebra.com> Date: Wed, 11 Jan 2012 01:04:59 -0500 From: "Mikhail T." User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:6.0.2) Gecko/20110926 Thunderbird/6.0.2 MIME-version: 1.0 To: Bob Friesenhahn References: <4F0CBB79.7010704@aldan.algebra.com> In-reply-to: Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit X-Mailman-Approved-At: Wed, 11 Jan 2012 11:56:57 +0000 Cc: fs@freebsd.org Subject: Re: How to best send files over network? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 07:05:19 -0000 On 10.01.2012 18:49, Bob Friesenhahn wrote: > Don't use mmap on zfs since doing so wastes memory (zfs ARC is not > coherent with mmap page cache). Instead do normal file I/O (e.g. > write, fwrite) using the filesystem blocksize (e.g. 128K) or a small > multiple thereof. Well, that was the reason cited for not using sendfile over ZFS. But mmap/write, it was claimed, was efficient. What's the general opinion of using mmap/write, when the file is on UFS? Is it just as good as sendfile, or can sendfile be better under some circumstances? > It is useful to cache several blocks on the receiving end and use a > thread to receive data from the network in case zfs temporarily stalls > during write (which it periodically does). No, thanks. I'm certainly not doing a read/write loop -- that's just too disgusting in the age of better interfaces (even if those aren't well implemented yet) :-) > >> If, indeed, sendfile is best for UFS, but mmap/write is better over >> ZFS, what is the best way to determine the underlying FS for each >> file? statfs(2) is supposed to answer that question -- what should I >> look for in the struct statfs, that it will return? Do I check, if >> f_fsid contains a magic number for ZFS, or look for a magic string in >> f_fstypename? Could someone provide an example? > > Use it to obtain the filesystem block size. Ok, but still -- how does one determine the filesystem, where a particular file resides? Thanks! -mi