title: FileStream.Write blocking for long periods on SSD
body: <p>I'm writing ~280MB of data in 2MB blocks to a FileStream.</p>
  
  <p>On one machine, this completes in under 8 seconds. On my machine (with similar spec, SSD etc) I've been trying to debug why it takes over 40 seconds and their are pauses in the progress. </p>
  
  <p>I write the data when its returned from a hardware device, but I've found that sometimes, calling Write on the stream can take ages to return. I'm calling flush between all the writes:</p>
  
  <pre><code>    Stopwatch stopwatch = Stopwatch.StartNew();
      _stream.Write(buffer, 0, buffer.Length);        
      stopwatch.Stop(); 
      Console.WriteLine("_stream.Write() " + stopwatch.ElapsedMilliseconds + "ms");             
  
      _stream.Flush(); 
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>_stream.Write() 2ms
  _stream.Write() 2ms
  _stream.Write() 2ms
  ... snip 
  _stream.Write() 2ms
  _stream.Write() 2ms
  _stream.Write() 2ms
  _stream.Write() 2ms
  _stream.Write() 23233ms    &lt;- not expecting this
  _stream.Write() 2ms
  _stream.Write() 2ms
  _stream.Write() 0ms
  ... snip 
  _stream.Write() 2ms
  _stream.Write() 2ms
  _stream.Write() 15852ms    &lt;- or this
  _stream.Write() 2ms
  _stream.Write() 2ms
  _stream.Write() 2ms
  ... snip 
  _stream.Write() 2ms
  _stream.Write() 25ms
  _stream.Write() 2ms
  _stream.Write() 2ms
  </code></pre>
  
  <p>This is not what I would expect</p>