bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dd interface to posix_fadvise


From: Paul Eggert
Subject: Re: dd interface to posix_fadvise
Date: Wed, 07 Mar 2007 09:48:10 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Pádraig Brady <address@hidden> writes:

> http://www.die.net/doc/linux/man/man2/posix_fadvise.2.html

Wow.  That makes it seem like POSIX_FADV_SEQUENTIAL isn't nearly as
useful as it should be.

What I think you're saying is that applications must invoke
POSIX_FADV_DONTNEED by hand after reading or writing every sequential
page.  But this is what POSIX_FADV_SEQUENTIAL is designed for, no?
That is, POSIX_FADV_SEQUENTIAL should be tuned for usage patterns like
dd's, right?  Why isn't it?

(Now I'm starting to understand why almost nobody uses posix_fadvise.  :-)


>> +  posix_fadvise (STDIN_FILENO, 0, 0, POSIX_FADV_SEQUENTIAL);
>> +  posix_fadvise (STDOUT_FILENO, 0, 0, POSIX_FADV_SEQUENTIAL);
>
> That's mad. That trival patch works fine here on
> coreutils-6.2 + glibc-2.3.5-10 + 2.6.16-1.2111_FC4 at least.

It sounds like we'll have to have a fairly-careful runtime test then,
with the default being not to use posix_fadvise unless we're sure it
won't dump core.  Debian stable is not a platform I'd like to abandon
quite just yet....


One option I toyed with is giving users direct access to the
posix_fadvise parameters, so they can set the options themselves,
and get core dumps on their own.  E.g., 

dd iadvice=sequential oadvice=sequential

This is sort of like iflags and oflags, but for posix_fadvice.  It
matches the POSIX spec fairly well, though it is a bit overkill (would
'dd' really have any use for iadvice=random? :-).  But the problem is
that it doesn't match Linux's somewhat odd interpretation of
posix_fadvise very well.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]