title: What posix_fadvise() args for sequential file write?
body: <p>I am working on an application which does sequentially write a large file (and does not read at all), and I would like to use <code>posix_fadvise()</code> to optimize the filesystem behavior.</p>
  
  <p>The function description in the manpage suggests that the most appropriate strategy would be <code>POSIX_FADV_SEQUENTIAL</code>. However, the Linux implementation description doubts that:</p>
  
  <blockquote>
    <p>Under Linux, <code>POSIX_FADV_NORMAL</code> sets the readahead window to the  default  size  for  the  backing  device; <code>POSIX_FADV_SEQUENTIAL</code>  doubles  this  size, and <code>POSIX_FADV_RANDOM</code> disables file readahead entirely.</p>
  </blockquote>
  
  <p>As I'm only writing data (overwriting files possibly too), I don't expect any readahead. Should I then stick with my <code>POSIX_FADV_SEQUENTIAL</code> or rather use <code>POSIX_FADV_RANDOM</code> to disable it?</p>
  
  <p>How about other options, such as <code>POSIX_FADV_NOREUSE</code>? Or maybe do not use <code>posix_fadvise()</code> for writing at all?</p>