]> granicus.if.org Git - zfs/commit
Improve rate at which new zvols are processed
authorJohn Gallagher <john.gallagher@delphix.com>
Sat, 4 May 2019 23:39:10 +0000 (16:39 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Sat, 4 May 2019 23:39:10 +0000 (16:39 -0700)
commit1eacf2b3b0a1d3bccaab83dece44d671ba30292d
tree140234a8ef61731f95c5e766477be3ff27d0d061
parentb3b60984ee191bdbb00b91842053c83581854db7
Improve rate at which new zvols are processed

The kernel function which adds new zvols as disks to the system,
add_disk(), briefly opens and closes the zvol as part of its work.
Closing a zvol involves waiting for two txgs to sync. This, combined
with the fact that the taskq processing new zvols is single threaded,
makes this processing new zvols slow.

Waiting for these txgs to sync is only necessary if the zvol has been
written to, which is not the case during add_disk(). This change adds
tracking of whether a zvol has been written to so that we can skip the
txg_wait_synced() calls when they are unnecessary.

This change also fixes the flags passed to blkdev_get_by_path() by
vdev_disk_open() to be FMODE_READ | FMODE_WRITE | FMODE_EXCL instead of
just FMODE_EXCL. The flags were being incorrectly calculated because
we were using the wrong version of vdev_bdev_mode().

Reviewed-by: George Wilson <george.wilson@delphix.com>
Reviewed-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: John Gallagher <john.gallagher@delphix.com>
Closes #8526
Closes #8615
module/zfs/vdev_disk.c
module/zfs/zvol.c