freebsd-nq/module/zfs
Olaf Faaland d410c6d9fd Reimplement vdev_random_leaf and rename it
Rename it as mmp_random_leaf() since it is defined in mmp.c.

The earlier implementation could end up spinning forever if a pool had a
vdev marked writeable, none of whose children were writeable.  It also
did not guarantee that if a writeable leaf vdev existed, it would be
found.

Reimplement to recursively walk the device tree to select the leaf.  It
searches the entire tree, so that a return value of (NULL) indicates
there were no usable leaves in the pool; all were either not writeable
or had pending mmp writes.

It still chooses the starting child randomly at each level of the tree,
so if the pool's devices are healthy, the mmp writes go to random leaves
with an even distribution.  This was verified by testing using
zfs_multihost_history enabled.

Reviewed by: Thomas Caputi <tcaputi@datto.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #6631 
Closes #6665
2017-09-22 14:29:26 -07:00
..
abd.c minor improvement to abd_free_pages() 2017-05-02 10:06:18 -07:00
arc.c Increase default arc_c_min 2017-09-20 09:36:17 -07:00
blkptr.c Use SET_ERROR for constant non-zero return codes 2017-08-02 21:16:12 -07:00
bplist.c
bpobj.c Don't dirty bpobj if it has no entries 2017-05-26 11:42:10 -07:00
bptree.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
bqueue.c Call cv_signal() with mutex held 2017-06-26 14:36:49 -07:00
dbuf_stats.c Improved dnode allocation and dmu_hold_impl() 2017-09-05 16:15:04 -07:00
dbuf.c dbuf_cons: deduplicate multilist_link_init() 2017-08-24 10:31:59 -07:00
ddt_zap.c
ddt.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
dmu_diff.c
dmu_object.c Improved dnode allocation and dmu_hold_impl() 2017-09-05 16:15:04 -07:00
dmu_objset.c dmu_objset: release bonus buffer in failure path 2017-08-30 12:09:18 -07:00
dmu_send.c Revert "Handle new dnode size in incremental..." 2017-09-07 10:00:54 -07:00
dmu_traverse.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
dmu_tx.c Export symbol dmu_tx_mark_netfree() 2017-09-20 09:30:24 -07:00
dmu_zfetch.c
dmu.c Send / Recv Fixes following b52563 2017-08-23 16:54:24 -07:00
dnode_sync.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
dnode.c Improved dnode allocation and dmu_hold_impl() 2017-09-05 16:15:04 -07:00
dsl_bookmark.c OpenZFS 8377 - Panic in bookmark deletion 2017-06-30 11:11:01 -07:00
dsl_crypt.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
dsl_dataset.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
dsl_deadlist.c OpenZFS 5428 - provide fts(), reallocarray(), and strtonum() 2017-07-08 20:35:35 -07:00
dsl_deleg.c
dsl_destroy.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
dsl_dir.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
dsl_pool.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
dsl_prop.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
dsl_scan.c OpenZFS 8414 - Implemented zpool scrub pause/resume 2017-08-24 10:27:20 -07:00
dsl_synctask.c
dsl_userhold.c OpenZFS 5428 - provide fts(), reallocarray(), and strtonum() 2017-07-08 20:35:35 -07:00
edonr_zfs.c
fm.c Use SET_ERROR for constant non-zero return codes 2017-08-02 21:16:12 -07:00
gzip.c GZIP compression offloading with QAT accelerator 2017-03-22 17:58:47 -07:00
lz4.c Fix LZ4_uncompress_unknownOutputSize caused panic 2017-05-19 13:45:46 -07:00
lzjb.c
Makefile.in Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
metaslab.c OpenZFS 8023 - Panic destroying a metaslab deferred range tree 2017-04-09 16:12:35 -07:00
mmp.c Reimplement vdev_random_leaf and rename it 2017-09-22 14:29:26 -07:00
multilist.c OpenZFS 7968 - multi-threaded spa_sync() 2017-03-20 18:36:00 -07:00
pathname.c
policy.c codebase style improvements for OpenZFS 6459 port 2017-01-22 13:25:40 -08:00
qat_compress.c Change U16 to U32 due to atomic_inc_32_nv 2017-04-25 17:41:58 -07:00
qat_compress.h GZIP compression offloading with QAT accelerator 2017-03-22 17:58:47 -07:00
range_tree.c
refcount.c Linux 4.11 compat: avoid refcount_t name conflict 2017-02-28 16:10:18 -08:00
rrwlock.c Fix spelling 2017-01-03 11:31:18 -06:00
sa.c OpenZFS 8061 - sa_find_idx_tab can be declared more type-safely 2017-04-14 11:11:28 -07:00
sha256.c
skein_zfs.c
spa_boot.c
spa_config.c Fix false config_cache_write events 2017-09-11 10:25:01 -07:00
spa_errlog.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
spa_history.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
spa_misc.c vdev_mirror: kstat observables for preferred vdev 2017-08-21 10:05:54 -07:00
spa_stats.c Allow longer SPA names in stats 2017-08-11 08:56:24 -07:00
spa.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
space_map.c OpenZFS 8023 - Panic destroying a metaslab deferred range tree 2017-04-09 16:12:35 -07:00
space_reftree.c OpenZFS 6328 - Fix cstyle errors in zfs codebase 2017-01-12 09:42:11 -08:00
trace.c
txg.c Simplify threads, mutexs, cvs and rwlocks 2017-08-11 08:51:44 -07:00
uberblock.c Multi-modifier protection (MMP) 2017-07-13 13:54:00 -04:00
unique.c
vdev_cache.c Fix wrong offset args in vdev_cache_write 2017-03-28 11:06:22 -07:00
vdev_disk.c Linux 3.14 compat: IO acct, global_page_state, etc 2017-09-16 11:00:19 -07:00
vdev_file.c Skip spurious resilver IO on raidz vdev 2017-05-12 17:28:03 -07:00
vdev_label.c Use SET_ERROR for constant non-zero return codes 2017-08-02 21:16:12 -07:00
vdev_mirror.c vdev_mirror: kstat observables for preferred vdev 2017-08-21 10:05:54 -07:00
vdev_missing.c Skip spurious resilver IO on raidz vdev 2017-05-12 17:28:03 -07:00
vdev_queue.c vdev_mirror: load balancing fixes 2017-08-21 10:05:16 -07:00
vdev_raidz_math_aarch64_neon_common.h
vdev_raidz_math_aarch64_neon.c codebase style improvements for OpenZFS 6459 port 2017-01-22 13:25:40 -08:00
vdev_raidz_math_aarch64_neonx2.c
vdev_raidz_math_avx2.c
vdev_raidz_math_avx512bw.c
vdev_raidz_math_avx512f.c
vdev_raidz_math_impl.h codebase style improvements for OpenZFS 6459 port 2017-01-22 13:25:40 -08:00
vdev_raidz_math_scalar.c
vdev_raidz_math_sse2.c
vdev_raidz_math_ssse3.c codebase style improvements for OpenZFS 6459 port 2017-01-22 13:25:40 -08:00
vdev_raidz_math.c codebase style improvements for OpenZFS 6459 port 2017-01-22 13:25:40 -08:00
vdev_raidz.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
vdev_root.c Skip spurious resilver IO on raidz vdev 2017-05-12 17:28:03 -07:00
vdev.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
zap_leaf.c Use SET_ERROR for constant non-zero return codes 2017-08-02 21:16:12 -07:00
zap_micro.c Fix dnode allocation race 2017-08-08 08:38:53 -07:00
zap.c Use SET_ERROR for constant non-zero return codes 2017-08-02 21:16:12 -07:00
zfeature.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
zfs_acl.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
zfs_byteswap.c
zfs_ctldir.c Use SET_ERROR for constant non-zero return codes 2017-08-02 21:16:12 -07:00
zfs_debug.c Add line info and SET_ERROR() to ZFS debug log 2017-07-25 23:09:48 -07:00
zfs_dir.c Rename zfs_sb_t -> zfsvfs_t 2017-03-10 09:51:33 -08:00
zfs_fm.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
zfs_fuid.c Rename zfs_sb_t -> zfsvfs_t 2017-03-10 09:51:33 -08:00
zfs_ioctl.c Retire send space estimation via ZFS_IOC_SEND 2017-08-31 09:00:35 -07:00
zfs_log.c OpenZFS 7578 - Fix/improve some aspects of ZIL writing 2017-06-09 09:15:37 -07:00
zfs_onexit.c
zfs_ratelimit.c Add libtpool (thread pools) 2017-08-09 15:31:08 -07:00
zfs_replay.c Enhance comments for large dnode project 2017-08-29 09:00:28 -07:00
zfs_rlock.c Fix spelling 2017-01-03 11:31:18 -06:00
zfs_sa.c Modifying XATTRs doesnt change the ctime 2017-09-13 12:20:07 -07:00
zfs_vfsops.c Fix remounting snapshots read-write 2017-08-17 14:28:17 -07:00
zfs_vnops.c Correct cppcheck errors 2017-09-19 12:17:29 -07:00
zfs_znode.c misc: fix meaningless values 2017-09-19 12:19:08 -07:00
zil.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
zio_checksum.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
zio_compress.c
zio_crypt.c Native Encryption for ZFS on Linux 2017-08-14 10:36:48 -07:00
zio_inject.c Add corruption failure option to zinject(8) 2017-08-14 15:17:15 -07:00
zio.c Add corruption failure option to zinject(8) 2017-08-14 15:17:15 -07:00
zle.c
zpl_ctldir.c Linux 4.12 compat: CURRENT_TIME removed 2017-05-10 09:30:48 -07:00
zpl_export.c
zpl_file.c misc: fix meaningless values 2017-09-19 12:19:08 -07:00
zpl_inode.c Linux 4.12 compat: CURRENT_TIME removed 2017-05-10 09:30:48 -07:00
zpl_super.c Restructure mount option handling 2017-03-10 09:51:41 -08:00
zpl_xattr.c Modifying XATTRs doesnt change the ctime 2017-09-13 12:20:07 -07:00
zrlock.c OpenZFS 3746 - ZRLs are racy 2017-01-23 10:35:58 -08:00
zvol.c Linux 3.14 compat: IO acct, global_page_state, etc 2017-09-16 11:00:19 -07:00