[PATCH 2/2] block: fops: Do not set REQ_SYNC for async IOs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Taking a blktrace of a simple fio run on a block device file using
libaio and iodepth > 1 reveals that asynchronous writes are executed as
sync writes, that is, REQ_SYNC is set for the write BIOs.

Fix this by modifying dio_bio_write_op() to set REQ_SYNC only for IOs
that are indeed synchronous ones and set REQ_IDLE only for asynchronous
IOs.

Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx>
---
 block/fops.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/block/fops.c b/block/fops.c
index 50d245e8c913..5a4f57726828 100644
--- a/block/fops.c
+++ b/block/fops.c
@@ -34,7 +34,12 @@ static int blkdev_get_block(struct inode *inode, sector_t iblock,
 
 static blk_opf_t dio_bio_write_op(struct kiocb *iocb)
 {
-	blk_opf_t opf = REQ_OP_WRITE | REQ_SYNC | REQ_IDLE;
+	blk_opf_t opf = REQ_OP_WRITE;
+
+	if (is_sync_kiocb(iocb))
+		opf |= REQ_SYNC;
+	else
+		opf |= REQ_IDLE;
 
 	/* avoid the need for a I/O completion work item */
 	if (iocb_is_dsync(iocb))
-- 
2.38.1




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux