On Tue, Sep 14, 2004 at 11:53:38AM -0500, James Foris wrote:
> I put a drop-through printk in mm/filemap.c to report when O_DIRECT hits the
> * If we get here for O_DIRECT writes then we must have fallen
> * to buffered writes (block instantiation inside i_size). So
> we sync
> * the file data here, to try to honour O_DIRECT expectations.
> if (unlikely(file->f_flags & O_DIRECT) && written)
> status = filemap_write_and_wait(mapping);
Hmmm... very interesting.
> So, what appears to be happening is that the new logic is treating ANYTHING
> past the first
> transaction (first 150K of the write) as a residual requiring
> buffering/fully syncronous
> operation reguardless of boundry or size - which says O_DIRECT no longer
> works on
> files greater than 150K.
> Does this analysis sound about right to you ?
Sort of, I think you're on the right track. I'll try to get hold of a fast
machine today to see if I can see this behavior (my usual test machine is
quite plodding, and I think thats why I'm not reproducing this atm).
But, if your test program is creating the file each time and not doing more
than just sequential writes (not writes into holes), then if you're getting
into that filemap_write_and_wait call above I suspect that will be the root
cause of your problem (i.e, we should not be falling back to buffered for
your test case, if your program is doing what I think its doing).
To check this, if you change fs/direct-io.c::get_more_blocks to never set
"beyond_eof" to one, does the problem go away?