[PATCH] fadvise(2) system call

John Baldwin jhb at freebsd.org
Mon Nov 14 17:57:21 UTC 2011


On Wednesday, November 09, 2011 6:44:15 pm Bruce Cran wrote:
> On 08/11/2011 13:00, John Baldwin wrote:
> > I think it would be fine to add flags to applications like 'tar' to 
> > allow users to alter their behavior in specific use cases when it 
> > makes sense. However, I think there are more workloads for 'tar' than 
> > the ones you are thinking of and we should be hesitant to change 
> > applications to use non- default settings.
> 
> Someone's done that for GNU tar on Linux, adding a --no-oscache switch: 
> http://www.mysqlperformanceblog.com/2010/04/02/fadvise-may-be-not-what-you-
expect/ 
> .

I think this would be a fine extension to add.  You could do it just by using
O_DIRECT though, no need for fadvise().  (FADV_NOREUSE effectively forces 
O_DIRECT on, so if you want to use it for the entire file, you can just use 
O_DIRECT).  However, the application should be very careful to only read full 
FS blocks on block-aligned boundaries (using fs_bsize from stat) to avoid 
excessive I/O operations.

-- 
John Baldwin


More information about the freebsd-arch mailing list