=> 1082: turbo/issue-1082 - Support 'out of tree' builds

* Support 'out of tree' builds by adding the 'src' and 'obj' variables
  and removing the absolute path to the build results to the Makefile.in
  files below the module directory.

* For VPATH builds (addition for #1082):
  + Add '../../spl' to spl source directory list to search
  + Do a find in the found spl source for spl_config.h

Closes: #1082
=> 2512: turbo/issue-2448 - Default to --with-blkid in RPM packaging
                          - Make linking with and finding libblkid required

Default to --with-blkid in RPM packaging

Support for libblkid has been in the ZoL for years but has been
disabled by default in the packaging.  When libblkid is disabled
the 'zpool create' command will not warn you if you're going to
overwrite an existing filesystem.  For this reason the default
behavior has been changed to require libblkid.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #2448

Make linking with and finding libblkid required (so that creating
pools on devices with existing filesystem will get a warning).
Use '--without-blkid' to explicitly disable this.

Signed-off-by: Turbo Fredriksson <turbo@bayour.com>
Closes: #2448
=> 2668: turbo/issue-2666 - Allow for "zfs receive" to skip existing snapshots
                            by adding the option "-s" to zfs receive.

Signed-off-by: Turbo Fredriksson <turbo@bayour.com>

Closes: #2666
=> 2673: turbo/issue-2673 - Mount filesystem as soon as it's been received

Instead of storing the filesystem just received in top_zfs,
mount and share it directly in zfs_receive_one().

This will make a filesystem be mounted as soon as it's been received,
instead of waiting to the very end - which might take days.

Signed-off-by: Turbo Fredriksson <turbo@bayour.com>

Closes: #2673
=> 3693: turbo/illumos-3693 - restore_object uses at least two transactions to restore an object

restore_object uses at least two transactions to restore an object:

  * one transaction is used for dmu_object_claim
  * another transaction is used to set compression, checksum and most
    importantly bonus data
  * furthermore dmu_object_reclaim internally uses multiple transactions
  * dmu_free_long_range frees chunks in separate transactions
  * dnode_reallocate is executed in a distinct transaction

The fact the dnode_allocate/dnode_reallocate are executed in one
transaction and bonus (re-)population is executed in a different
transaction may lead to violation of ZFS consistency assertions if the
transactions are assigned to different transaction groups.  Also, if
the first transaction group is successfully written to a permanent
storage, but the second transaction is lost, then an invalid dnode may
be created on the stable storage.

Reviewed by: Christopher Siden christopher.siden@delphix.com
Reviewed by: George Wilson george.wilson@delphix.com

Original authors: Matthew Ahrens and Andriy Gapon

References:
  https://www.illumos.org/projects/illumos-gate//issues/3693
  https://reviews.csiden.org/r/90

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5116: turbo/illumos-5116 - zpool history -i goes into infinite loop

5116 zpool history -i goes into infinite loop
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Richard Elling <richard.elling@gmail.com>
Reviewed by: Boris Protopopov <boris.protopopov@me.com>
Approved by: Dan McDonald <danmcd@omniti.com>

References:
  https://www.illumos.org/issues/5116
  https://github.com/illumos/illumos-gate/commit/3339867

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5134: turbo/illumos-5134 - if ZFS_DEBUG or debug= is set, libzpool should enable debug prints

Reviewed by: Christopher Siden christopher.siden@delphix.com
Reviewed by: Adam Leventhal adam.leventhal@delphix.com

References:
  https://www.illumos.org/projects/illumos-gate/issues/5134
  https://github.com/illumos/illumos-gate/commit/7fa49ea

Porting notes:
  Run dprintf_setup() in main.

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5135: turbo/illumos-5135 - zpool_find_import_cached() can use fnvlist_*

Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: Max Grossman <max.grossman@delphix.com>
Reviewed by: Richard Elling <richard.elling@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>

References:
  https://www.illumos.org/issues/5135
  https://github.com/illumos/illumos-gate/commit/b18d6b0

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5138: turbo/illumos-5138 - add tunable for maximum number of blocks freed in one txg

Reviewed by: Mattew Ahrens mahrens@delphix.com
Reviewed by: Adam Leventhal adam.leventhal@delphix.com

References:
  https://www.illumos.org/projects/illumos-gate//issues/5138
  https://reviews.csiden.org/r/85/

Porting notes:

Look for it (param_ops_ullong) and depending on that use uint64_t/ullong
for kernels >= v3.17-rc1 where it was introduced and ulong/ulong otherwise
for the zfs_free_max_blocks variable.

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5139: turbo/illumos-5139 - SEEK_HOLE failed to report a hole at end of file

5139 SEEK_HOLE failed to report a hole at end of file
Reviewed by: Adam Leventhal <adam.leventhal@delphix.com>
Reviewed by: Alex Reece <alex.reece@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Max Grossman <max.grossman@delphix.com>
Reviewed by: Peng Dai <peng.dai@delphix.com>
Reviewed by: Richard Elling <richard.elling@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>

References:
  https://www.illumos.org/issues/5139
  https://github.com/illumos/illumos-gate/commit/0fbc0cd

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5140: turbo/illumos-5140 - message about "%recv could not be opened" is printed when booting after crash

Reviewed by: George Wilson george.wilson@delphix.com
Reviewed by: Christopher Siden christopher.siden@delphix.com
Reviewed by: Max Grossman max.grossman@delphix.com

References:
  https://www.illumos.org/projects/illumos-gate//issues/5140
  https://github.com/illumos/illumos-gate/commit/2243853

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5147: turbo/illumos-5147 - zpool list -v should show individual disk capacity

The 'zpool list -v' command displays lots of info but excludes the
capacity of each disk. This should be added.

Reviewed by: Christopher Siden christopher.siden@delphix.com
Reviewed by: Adam Leventhal adam.leventhal@delphix.com
Reviewed by: Matthew Ahrens matthew.ahrens@delphix.com

References:
  https://www.illumos.org/projects/illumos-gate//issues/5147
  https://reviews.csiden.org/r/89

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5150: turbo/illumos-5150 - zfs clone of a defer_destroy snapshot causes strangeness

When a clone is created of a snapshot that has been marked for
deferred destroy (with "zfs destroy -d"), the clone "inherits" the
defer_destroy flag from the origin, and any snapshots of the clone
"inherit" the defer_destroy flag from the clone. This causes a strange
situation where the clone's snapshots are marked for defer_destroy but
they have no holds or clones. If the clone's snapshot gets a hold or
clone, which is then deleted, we will honor the incorrectly-set
defer_destroy flag and delete the snapshot!

Steps to reproduce:

  * zpool create test c1t1d0
  * zfs create test/fs
  * zfs snapshot test/fs@a
  * zfs clone test/fs@a test/clone
  * zfs destroy -d test/fs@a
  * zfs clone test/fs@a test/clone2
  * zfs snapshot test/clone2@a
  * zfs hold hld test/clone2@a
  * zfs release hld test/clone2@a
  * zfs list -r -t all test

  <test/clone2@a has been destroyed>

We noticed that this causes dcenter to get very confused, because it
treats snapshots that are marked defer_destroy as not existing. So it
won't see any snapshots of the clone that's marked defer_destroy.

Reviewed by: George Wilson george.wilson@delphix.com
Reviewed by: Christopher Siden christopher.siden@delphix.com
Reviewed by: Max Grossman max.grossman@delphix.com

Original author: Matthew Ahrens

References:
  https://www.illumos.org/projects/illumos-gate//issues/5150
  https://reviews.csiden.org/r/93/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5161: turbo/illumos-5161 - add tunable for number of metaslabs per vdev

5161 add tunable for number of metaslabs per vdev
Reviewed by: Alex Reece alex.reece@delphix.com\
Reviewed by: George Wilson george.wilson@delphix.com\
Reviewed by: Christopher Siden christopher.siden@delphix.com\
Reviewed by: Paul Dagnelie paul.dagnelie@delphix.com\

References:
  https://www.illumos.org/issues/5161
  https://reviews.csiden.org/r/95/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5162: turbo/illumos-5162 - zfs recv should use loaned arc buffer to avoid copy

5162 zfs recv should use loaned arc buffer to avoid copy
Reviewed by: George Wilson george.wilson@delphix.com\
Reviewed by: Christopher Siden christopher.siden@delphix.com\

References:
  https://www.illumos.org/issues/5162
  https://reviews.csiden.org/r/96/

Porting notes:
  Fix spelling error 's/arena/area/' in dmu.c.

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5164+5165: turbo/illumos-5164+5165 - space_map fixes

5164 space_map_max_blksz causes panic, does not work
5165 zdb fails assertion when run on pool with recently-enabled spacemap_histogram feature
Reviewed by: George Wilson george.wilson@delphix.com
Reviewed by: Christopher Siden christopher.siden@delphix.com

References:
  https://www.illumos.org/issues/5164
  https://www.illumos.org/issues/5165
  https://reviews.csiden.org/r/98/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5169-5171: turbo/illumos-5169-5171 - zdb fixes

5169 zdb should limit its ARC size
5170 zdb -c should create more scrub i/os by default
5171 zdb should print status while loading metaslabs for leak detection
Reviewed by: George Wilson george.wilson@delphix.com\
Reviewed by: Paul Dagnelie paul.dagnelie@delphix.com\
Reviewed by: Christopher Siden christopher.siden@delphix.com\

References:
  https://www.illumos.org/issues/5169
  https://www.illumos.org/issues/5170
  https://www.illumos.org/issues/5171
  https://reviews.csiden.org/r/100/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5174: turbo/illumos-5174 - add sdt probe for blocked read in dbuf_read()

5174 add sdt probe for blocked read in dbuf_read()
Reviewed by: Matthew Ahrens mahrens@delphix.com
Reviewed by: Basil Crow basil.crow@delphix.com

References:
  https://www.illumos.org/issues/5174
  https://reviews.csiden.org/r/101/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5176: turbo/illumos-5176 - lock contention on godfather zio

5176 lock contention on godfather zio
Reviewed by: Alex Reece alex.reece@delphix.com
Reviewed by: George Wilson george.wilson@delphix.com
Reviewed by: Christopher Siden christopher.siden@delphix.com
Reviewed by: Adam Leventhal ahl@delphix.com

References:
  https://www.illumos.org/issues/5176
  https://reviews.csiden.org/r/103/

Ported by: Turbo Fredriksson <turbo@bayour.com>
=> 5177: turbo/illumos-5177 - remove dead code from dsl_scan.c

5177 remove dead code from dsl_scan.c
Reviewed by: George Wilson george.wilson@delphix.com
Reviewed by: Christopher Siden christopher.siden@delphix.com

References:
  https://www.illumos.org/issues/5177
  https://reviews.csiden.org/r/104/

Ported by: Turbo Fredriksson <turbo@bayour.com>