Subject: bug#7362: dd strangeness

From: Paul Eggert <[email-masked]>
Date: Wed, 02 Mar 2011 16:11:15 -0800

On 03/02/2011 03:29 PM, Pádraig Brady wrote:
> The O_DIRECT ->  normal switch done in iwrite() for the
> last write, should only happen once.
> If it happens more than that, we can print a warning,
> suggesting the use of iflag=fullblock.

Yes, that sounds like a better approach.
Thanks for thinking this through.

I looked into O_CIO and it appears that it does
imply O_DIRECT, but O_DIRECT does not have the
problems on AIX (which has O_CIO) that I guess it
has on GNU/Linux.  Quoting from
<http://www-03.ibm.com/systems/resources/systems_p_os_aix_whitepapers_db_perf_aix.pdf>
   
   The use of Direct I/O requires that certain
   alignment and length restrictions be met by the
   application’s I/O requests. Table 1 lists these
   requirements for JFS2. Failure to meet these
   requirements causes reads and writes to be done
   using normal cached I/O, but after the data is
   transferred to the application buffer, the cached
   copy is discarded.

which suggests that iwrite's fcntl in iwrite is
not needed on AIX.  I don't know if this is worth
optimizing, but perhaps it's worth a comment as
to why we worry about O_DIRECT but not O_CIO in
iwrite.