From 0fa2c706cf812105856b45c57aba74509e1114e2 Mon Sep 17 00:00:00 2001 From: Isaac Huang Date: Tue, 27 Sep 2016 14:46:37 -0600 Subject: [PATCH] Explicit block device plugging when submitting multiple BIOs. Without plugging, the default 'noop' scheduler will not merge the BIOs which are part of a large ZIO. Signed-off-by: Isaac Huang --- module/zfs/vdev_disk.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c index e399e6630639..f72a186d58a0 100644 --- a/module/zfs/vdev_disk.c +++ b/module/zfs/vdev_disk.c @@ -524,6 +524,7 @@ __vdev_disk_physio(struct block_device *bdev, zio_t *zio, caddr_t kbuf_ptr, uint64_t bio_offset; int bio_size, bio_count = 16; int i = 0, error = 0; + struct blk_plug plug; ASSERT3U(kbuf_offset + kbuf_size, <=, bdev->bd_inode->i_size); @@ -592,11 +593,17 @@ __vdev_disk_physio(struct block_device *bdev, zio_t *zio, caddr_t kbuf_ptr, /* Extra reference to protect dio_request during vdev_submit_bio */ vdev_disk_dio_get(dr); + if (dr->dr_bio_count > 1) + blk_start_plug(&plug); + /* Submit all bio's associated with this dio */ for (i = 0; i < dr->dr_bio_count; i++) if (dr->dr_bio[i]) vdev_submit_bio(dr->dr_bio[i]); + if (dr->dr_bio_count > 1) + blk_finish_plug(&plug); + (void) vdev_disk_dio_put(dr); return (error);