From owner-freebsd-hackers@FreeBSD.ORG Thu May 12 23:03:28 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1AE4106566B; Thu, 12 May 2011 23:03:28 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 744508FC1A; Thu, 12 May 2011 23:03:28 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 7E0B9359398; Fri, 13 May 2011 01:03:27 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 6AEE91736B; Fri, 13 May 2011 01:03:27 +0200 (CEST) Date: Fri, 13 May 2011 01:03:27 +0200 From: Jilles Tjoelker To: Lev Serebryakov Message-ID: <20110512230327.GA82602@stack.nl> References: <1649118429.20110512113812@serebryakov.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1649118429.20110512113812@serebryakov.spb.ru> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-hackers@freebsd.org Subject: Re: Does FreeBSD have replacement for posix_fadvice() or fcntl(F_RDADVISE)? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 23:03:28 -0000 On Thu, May 12, 2011 at 11:38:12AM +0400, Lev Serebryakov wrote: > Does FreeBSD have some custom call, which can be used where Linux > programs uses posix_fadvice() and DARWIN ones fcntl(F_RDADVISE)? > It is like madvise(2) but for file descriptors. An effect like POSIX_FADV_SEQUENTIAL can be obtained with the F_READAHEAD or F_RDAHEAD fcntl(2) requests. The implementation is divided between the generic VFS layer and various filesystems (cd9660, ext2fs, msdosfs, nfs, xfs and ufs appear to use the information to some degree). Setting readahead to 0 with the fcntl requests has little effect: it resets the state of the sequential access detection heuristic but does not disable it. The O_DIRECT open(2) flag has an effect similar to what POSIX_FADV_NOREUSE should do, except that it changes semantics by adding alignment restrictions. -- Jilles Tjoelker