Skip to content

Commit

Permalink
Explicit block device plugging when submitting multiple BIOs.
Browse files Browse the repository at this point in the history
Without plugging, the default 'noop' scheduler will not merge
the BIOs which are part of a large ZIO.

Signed-off-by: Isaac Huang <[email protected]>
  • Loading branch information
huangheintel committed Sep 27, 2016
1 parent 160987b commit 0fa2c70
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions module/zfs/vdev_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 0fa2c70

Please sign in to comment.