[PATCH] 3512 rounding discrepancy in sa_find_sizes() 3513 mismatch between SA header size and layout Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Boris Protopopov <boris.protopopov@nexenta.com> Approved by: Dan McDonald <danmcd@nexenta.com>
Verbose print before the point we panic on
Attempt to detect empty SA and skip them

It would seem that in sa_build_layouts, we end up at:

            printf("ZFS: NULL SA: SA_COPY_DATA(%p, %p, %p, %u) i=%u\n",
                   attr_desc[i].sa_data_func, attr_desc[i].sa_data,
                   data_start, length, i);
            SA_COPY_DATA(attr_desc[i].sa_data_func, attr_desc[i].sa_data,
                         data_start, length);

ZFS: SA_COPY_DATA(0, 0xffffff8204d7cb70, 0xffffff82025d4e70, 16) i=10
ZFS: SA_COPY_DATA(0, 0xffffff8204d7cb80, 0xffffff82025d4e80, 8) i=11
ZFS: SA_COPY_DATA(0, 0, 0xffffff82025d4e88, 16) i=12

So clearly attr_desc[12].sa_data is NULL.
Set B_NOCACHE to stop possibly double caching block data
Set more accurate values in the kexts' plists
Programmatically set Info.plist version info using the META file.
Handle unmap/discard in a more async manner

Due to increasing mount times as we process unmap requests, we now
lock the range, then place it on a list to be processed by an
unmap thread. It will commit and unlock range. We hold the lock with
the idea that any writes to the same range will block until the unmap has
completed. This could lead to negative performance but so far has not
shown to be the case.

This patch will need testing, both in terms of data integrity, but also
to see if there are issues with having many rl locks held between
threads.

A new kstat has been added to show the total size of the unmap list
over all zvolumes. (kstat.zfs.darwin.tunable.unmap_nodes)
Cherry-pick in IllumOS #4873 again

Conflicts:
	module/avl/avl.c
	module/zfs/dbuf.c
	module/zfs/dnode.c
Do not call zil_replaying if zillog or tx are NULL
Improve unmap tx with dmu_tx_mark_netfree

Also disabled sysctl for zvol_num_unmap and
 moved into zv_state_t per zvol
Correctly set zvol logical and physical blocksize

Set bytesPerPhysicalSector to volblocksize not 4k
Only use zil_commit for unmap if sync=always
Align unmaps to zvol volblocksize

Skip unmaps that are fully unaligned
(size of 0 after rounding)
For sync=always, also wait for tx to sync