diff options
author | John Gallagher <[email protected]> | 2019-05-04 16:39:10 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-05-04 16:39:10 -0700 |
commit | 1eacf2b3b0a1d3bccaab83dece44d671ba30292d (patch) | |
tree | 140234a8ef61731f95c5e766477be3ff27d0d061 /module/zfs/vdev_disk.c | |
parent | b3b60984ee191bdbb00b91842053c83581854db7 (diff) |
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 <[email protected]>
Reviewed-by: Serapheim Dimitropoulos <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: John Gallagher <[email protected]>
Closes #8526
Closes #8615
Diffstat (limited to 'module/zfs/vdev_disk.c')
-rw-r--r-- | module/zfs/vdev_disk.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c index b329ef3c2..1419ae6ad 100644 --- a/module/zfs/vdev_disk.c +++ b/module/zfs/vdev_disk.c @@ -23,7 +23,7 @@ * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Rewritten for Linux by Brian Behlendorf <[email protected]>. * LLNL-CODE-403049. - * Copyright (c) 2012, 2018 by Delphix. All rights reserved. + * Copyright (c) 2012, 2019 by Delphix. All rights reserved. */ #include <sys/zfs_context.h> @@ -56,7 +56,7 @@ typedef struct dio_request { } dio_request_t; -#ifdef HAVE_OPEN_BDEV_EXCLUSIVE +#if defined(HAVE_OPEN_BDEV_EXCLUSIVE) || defined(HAVE_BLKDEV_GET_BY_PATH) static fmode_t vdev_bdev_mode(int smode) { |