From 836481737a9721493942f6feaa1ff8f219506ec5 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 9 Apr 2014 23:58:20 +0000 Subject: [PATCH] vdisk_blockio: Specify REQ_SYNC for synchronous I/O requests Using READ_SYNC instead of READ increases the priority of read requests. Using WRITE_SYNC instead of REQ_WRITE increases the priority of write requests and avoids that the CFQ scheduler queues such writes waiting for further write requests. Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5411 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index c00798e75..224d3d425 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -4566,7 +4566,7 @@ static ssize_t vdev_read_sync(struct scst_vdisk_dev *virt_dev, void *buf, if (virt_dev->nullio) return len; else if (virt_dev->blockio) - return blockio_rw_sync(virt_dev, buf, len, loff, 0/*read*/); + return blockio_rw_sync(virt_dev, buf, len, loff, READ_SYNC); else return fileio_read_sync(virt_dev->fd, buf, len, loff); } @@ -4574,21 +4574,12 @@ static ssize_t vdev_read_sync(struct scst_vdisk_dev *virt_dev, void *buf, static ssize_t vdev_write_sync(struct scst_vdisk_dev *virt_dev, void *buf, size_t len, loff_t *loff) { - int rw; - - if (virt_dev->nullio) { + if (virt_dev->nullio) return len; - } else if (virt_dev->blockio) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) - rw = REQ_WRITE; -#else - rw = 1 << BIO_RW; -#endif - - return blockio_rw_sync(virt_dev, buf, len, loff, rw); - } else { + else if (virt_dev->blockio) + return blockio_rw_sync(virt_dev, buf, len, loff, WRITE_SYNC); + else return fileio_write_sync(virt_dev->fd, buf, len, loff); - } } static enum compl_status_e vdev_exec_verify(struct vdisk_cmd_params *p)