On Thu, Nov 02, 2006 at 09:58:58AM +1100, David Chinner wrote: [ ...] Thanks for the review, I'll incorporate these suggestions into the next patch set. > > + > > + /* > > + * the placeholder code does filemap_write_and_wait, so if we > > + * aren't using placeholders we have to do it here > > + */ > > + if (!(dio->flags & DIO_PLACEHOLDERS) && end > offset) { > > + struct address_space *mapping = iocb->ki_filp->f_mapping; > > retval = filemap_write_and_wait_range(mapping, offset, end - 1); > > if (retval) > > goto out; > > So that means XFS will now do three cache flushes on write (one in > xfs_write(), one in generic_file_direct_IO() and yet another here.... I removed the flush before starting the IO in generic_file_direct_IO because that is now done by the placeholders. When placeholders aren't used, we need the flush to match the old behavior. I added the flush in generic_file_direct_IO after calling the direct_IO func because invalidate_page_range2 requires the data to be flushed first. Otherwise it fails to free a dirty page with dirty buffers and spits out -EIO. This only happens when mapping->nrpages > 0, so it should be very low cost in the common case. It's messy, I'll try to refactor things a bit to make it cleaner (same goes for i_mutex drop/lock). -chris - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html