Skip to contentSkip to conversation

block: don't plug in blkdev_write_iter

PATCH Applied Christoph Hellwig 2 participants 2 messages May 20, 2023 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: don't plug in blkdev_write_iter

For direct I/O writes that issues more than a single bio, the pluggin is already done in __blkdev_direct_IO.
For synchronous buffered writes the plugging is done deep down in writeback_inodes_wb / wb_writeback.

For the other cases there is no point in plugging as as single bio or no bio at all is submitted.

---
 block/fops.c | 3 ---
 1 file changed, 3 deletions(-)
block/fops.c +0 -3
index d2e6be4e3d1c7d..102ee85fc6eedf 100644
@@ -520,7 +520,6 @@ static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	struct block_device *bdev = iocb->ki_filp->private_data;
 	struct inode *bd_inode = bdev->bd_inode;
 	loff_t size = bdev_nr_bytes(bdev);
-	struct blk_plug plug;
 	size_t shorted = 0;
 	ssize_t ret;
 
@@ -545,12 +544,10 @@ static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
 		iov_iter_truncate(from, size);
 	}
 
-	blk_start_plug(&plug);
 	ret = __generic_file_write_iter(iocb, from);
 	if (ret > 0)
 		ret = generic_write_sync(iocb, ret);
 	iov_iter_reexpand(from, iov_iter_count(from) + shorted);
-	blk_finish_plug(&plug);
 	return ret;
 }
 
Signature · 1 line
2.39.2
maintainer Applied
#1 lore raw
Quoted 9 lines · Christoph Hellwig

For direct I/O writes that issues more than a single bio, the pluggin is already done in __blkdev_direct_IO.
For synchronous buffered writes the plugging is done deep down in writeback_inodes_wb / wb_writeback.

For the other cases there is no point in plugging as as single bio or no bio at all is submitted.

[...]

Applied, thanks!

[1/1] block: don't plug in blkdev_write_iter

      commit: 712c7364655f69827d0b96f69594886ecbfb412f

Best regards,

Signature · 1 line
Jens Axboe