GNU bug report logs -
#26311
dd: add support for POSIX_FADV_NOREUSE etc.
Previous Next
Full log
View this message in rfc822 format
On 30/03/17 08:42, Paul Eggert wrote:
> The 'dd' command has some complicated logic for iflag=nocache and
> oflag=nocache, which I don't entirely understand but expect is in there
> for good reason. I suggest that 'dd' also have simpler logic for direct
> usage of posix_fadvise options. For example, 'dd iflag=noreuse' could
> cause it to call fadvise (STDIN_FILENO, FADVISE_NOREUSE). I suppose
> 'sequential' should be the default.
Yes maybe, though the low level meanings of these flags are
a bit confusing and I'm not sure how consistent they are over kernel versions,
hence why a higher level "nocache" item was chosen initially.
I have some notes on these settings at:
https://github.com/coreutils/coreutils/blob/c7bcea1b/src/sort.c#L894-L939
> Dumb question: why does dd iflag=nocache check the return value of
> posix_fadvise? The fadvise function ignores the return value and says
> why; do these reasons not apply to 'dd'?
Well for dd it's a request, which for other utils it's a performance advisement.
As stated in the info docs, for dd it's only significant in the special case
of dropping cache for the whole file:
$ : | dd iflag=nocache count=0 status=none
dd: failed to discard cache for: 'standard input': Illegal seek
cheers,
Pádraig
This bug report was last modified 6 years and 233 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.