Commit 9f5354ec authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] direct-io: set PF_SYNCWRITE

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: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6e27d936
......@@ -1161,6 +1161,9 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
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 kiocb *iocb, struct inode *inode,
out:
if (reader_with_isem)
up(&inode->i_sem);
if (rw & WRITE)
current->flags &= ~PF_SYNCWRITE;
return retval;
}
EXPORT_SYMBOL(__blockdev_direct_IO);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment