Validate that we are not creating a mirror map that would panic the system
at a later time.
Improve multicast address locking in vlan and lagg.

Ticket:	#5637
Workaround DTrace not working when kernel is loaded with grub.

Patch did not apply cleanly but it should work.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=185290
Add missing comparisons to make list IDs in EXTENDED COPY per-initiator,
as they should be.  Wrap it into a function to not duplicate the code.

MFC after:	3 days

(cherry picked from commit 621e857f016314f37561a84bc858e457faec445e)
Fix some bugs in RECEIVE COPY STATUS data.

MFC after:	3 days

(cherry picked from commit 4fc98f231b1b8ba5ab1e924eaf5e8efa413b8594)
Plug EXTENDED COPY request data memory leak.

MFC after:	3 days

(cherry picked from commit 08754442644626ea6b6404172789ee3111033708)
Rework r269444 to work also for lists without IDs.

MFC after:	3 days

(cherry picked from commit 7dab858aad63d1b1f2c1131f12c0f128c822f44b)
Don't report non-native block-size pools under zpool status -x

zpool status -x is used to identify pools that are exhibiting
errors or are otherwise unavailable, therefore non-native
block-size pools shouldn't be reported.

Also update man page to clarify other additional conditions
which won't cause a pool to be displayed under zpool status -x.

Sponsored by:	Multiplay

(cherry picked from commit 5563475471e7bc782d1966087e7aa4dfa6473d9e)
Bump mdoc date after r268621.

X-MFC-With:	r268621
(cherry picked from commit ba32c2f8ac94143a06c0fec9e944eec7ede4798c)
MFV r268702:

Add missing *_destroy() calls in various places with ZFS.

Illumos issue:
  4975 missing mutex_destroy() calls in zfs

MFC after:	2 weeks

(cherry picked from commit 1fb217334d16391846e249ee45163e2c1d2d99df)
MFV r268714:

Improve extreme rewind import.

When doing an "extreme rewind" import ("zpool import -XF"), we attempt
to verify all data in the pool, essentially scrubbing the entire pool.
The problem is that spa_load_verify_cb() issues an unbounded number of
concurrent scrub i/os.  This can lead to all of memory being used for
these zio's, wedging the system. Like normal scrub, we need to put a
cap on the number of outstanding i/os, and have the traverse thread
block when we reach this cap.

For this purpose the cap can be very large (10,000) to optimize the
elevator algorithm.  Three kernel tunables have been added:

	vfs.zfs.spa_load_verify_maxinflight
	vfs.zfs.spa_load_verify_metadata
	vfs.zfs.spa_load_verify_data

The latter two tunables controls whether metadata and/or user data
when doing extreme rewind.

Make 'zpool import -T' imply scrub.

Make zpool import -T <txg> accept hexadecimal values for the txg when
prefixed with 0x.

Skip txg's for which there is no uberblock when doing extreme rewind.

Skip reading all user data twice by skipping prefetches when doing
extreme rewinds as we do not access via the ARC.

Illumos issues:
  4970 need controls on i/o issued by zpool import -XF
  4971 zpool import -T should accept hex values
  4972 zpool import -T implies extreme rewind, and thus a scrub
  4973 spa_load_retry retries the same txg
  4974 spa_load_verify() reads all data twice

MFC after:	2 weeks

(cherry picked from commit cd85118a8b75bc9e408f964d99f2ffce809dcf9e)
MFV r268848:

Instead of asserting all zio's be properly aligned, only assert
on the logical ones.

Cap uberblocks at 8k, otherwise with ashift=17, there would be
only one uberblock.

This fixes a problem that zdb would trip assert on pools with
ashift >= 0xe (8k).

While there, also change the code so it only attempt to condense
space map unless the uncondensed size consumes greater than
zfs_metaslab_condense_block_threshold blocks.

Illumos issue:
  4958 zdb trips assert on pools with ashift >= 0xe

MFC after:	2 weeks

(cherry picked from commit 9db99dff71d01cbbaa246dc65ca4ebd4202b6ba7)
Correct typo introduced with r268855.

MFC after:	10 days
X-MFC with:	r268855

(cherry picked from commit 02590d59aca724046aa0b9b907607f0dad9df9d1)
MFV r268850:

Change the interaction between the DMU and ARC so that when the DMU is
shutting down an objset, we do not evict the data from the ARC.  Instead
we simply coordinate the destruction of the DMU's data with the ARC.

The only case where we actually need to explicitly evict from the ARC is
when dbuf_rele_and_unlock() determines that the administrator has requested
that it not be kept in memory, via the primarycache/secondarycache properties.
In this case, we evict the data from the ARC by its blkptr_t, the same way
as when a block is freed we explicitly evict it from the ARC.

Illumos issue:
    4631 zvol_get_stats triggering too many reads

MFC after:	2 weeks

(cherry picked from commit 5d9bbe4d63859aeb99bc7ca447f98eb286cd6f90)
MFV r268851:

When a sync task is waiting for a txg to complete, we should hurry it along
by increasing the number of outstanding async writes (i.e. make
vdev_queue_max_async_writes() return a larger number).

Illumos issue:
    4753 increase number of outstanding async writes when sync task is waiting

MFC after:	2 weeks

(cherry picked from commit 89f8d00f2ce7e92face7fbb2cd1921605108aee0)
Reduce lock contention on the z_teardown_lock under heavily cached
read workload by splitting the single teardown rrw lock into
RRM_NUM_LOCKS (17) of them.

Read acquisitions are randomly distributed among these locks based
on curthread pointer.  Write acquisitions are going to all the
locks, which for the usage of this type of lock should be rare.

Illumos issue:
    5008 lock contention (rrw_exit) while running a read only load

MFC after:	2 weeks

(cherry picked from commit a40e35ce6bf95caeab6ee509a1dc5ca3d9334e39)
As of r268075, the responsibility of rounding up buffer to optimal size have
been transferred from zio_compress_data to its caller.  Therefore, passing
the 'minblocksize' down will be a no-op.

Eliminate the parameter to reduce diff against upstream.

MFC after:	2 weeks

(cherry picked from commit e5df2c6b2c98eb14bc6fe60e339c765aed9eae75)
Transform the I/O when vdev_physical_ashift is greater than
SPA_MINBLOCKSHIFT.

MFC after:	2 weeks

(cherry picked from commit c9e947a58365b9223e8d8bf1d79cab8575eeab6f)
Diff reduction against Illumos.

MFC after:	2 weeks

(cherry picked from commit 319211bb802d37ccb7a939ffbb40f08f23c00f0b)
MFV r269010:

Import Illumos changes to address the following Illumos issues:
  4976 zfs should only avoid writing to a failing non-redundant
       top-level vdev
  4978 ztest fails in get_metaslab_refcount()
  4979 extend free space histogram to device and pool
  4980 metaslabs should have a fragmentation metric
  4981 remove fragmented ops vector from block allocator
  4982 space_map object should proactively upgrade when feature
       is enabled
  4984 device selection should use fragmentation metric

MFC after:	2 weeks

(cherry picked from commit 0f4faf42cbb855fd26557197bdcea66a237af96c)