

We need to set the PF_SYNCWRITE when performing direct-io writes.  Otherwise
the anticipatory scheduler exhibits bad read-starves-write problems.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/direct-io.c |    5 +++++
 1 files changed, 5 insertions(+)

diff -puN fs/direct-io.c~direct-io-set-PF_SYNCWRITE fs/direct-io.c
--- 25/fs/direct-io.c~direct-io-set-PF_SYNCWRITE	Thu Dec  9 13:07:11 2004
+++ 25-akpm/fs/direct-io.c	Thu Dec  9 13:07:11 2004
@@ -1161,6 +1161,9 @@ __blockdev_direct_IO(int rw, struct kioc
 	struct dio *dio;
 	int reader_with_isem = (rw == READ && dio_lock_type == DIO_OWN_LOCKING);
 
+	if (rw & WRITE)
+		current->flags |= PF_SYNCWRITE;
+
 	if (bdev)
 		bdev_blkbits = blksize_bits(bdev_hardsect_size(bdev));
 
@@ -1244,6 +1247,8 @@ __blockdev_direct_IO(int rw, struct kioc
 out:
 	if (reader_with_isem)
 		up(&inode->i_sem);
+	if (rw & WRITE)
+		current->flags &= ~PF_SYNCWRITE;
 	return retval;
 }
 EXPORT_SYMBOL(__blockdev_direct_IO);
_
