shred: enable direct I/O when possible
commitebaf961f3ad9ae7e8f9258e46eadb0e0d5e30ade
authorPádraig Brady <P@draigBrady.com>
Mon, 4 Nov 2013 23:14:10 +0000 (4 23:14 +0000)
committerPádraig Brady <P@draigBrady.com>
Tue, 5 Nov 2013 13:43:20 +0000 (5 13:43 +0000)
treeffed71280816be28aee3374834eedbfa9ad7c25f
parentd60e04424d12764e8f441db111f7466326cdc8e8
shred: enable direct I/O when possible

Commit v5.92-1057-g43d487b introduced a regression
in coreutils 6.0 where it removed the page alignment
of the buffer to write, thus disabling direct I/O.
We want to use direct I/O when possible to avoid
impacting the page cache at least, as we know we don't
want to cache the data we're writing.

* src/shred.c (dopass): Allocate the buffer on the heap,
while using a more general calculation to allow to have
the output size independent from the fillpattern() size
constraint of a multiple of 3.  Also we dispense with the
union as it's no longer needed given we're aligning on
a page boundary and thus don't need to explicitly handle
uint32_t alignment.
NEWS
src/shred.c