Reduce stack usage in dsl_deleg_get, gcc flagged it as consuming a
whopping 1040 bytes or potentially 1/4 of a 4K stack. This patch
moves all the large structures and buffer off the stack and on to
the heap. This includes 2 zap_cursor_t structs each 52 bytes in
size, 2 zap_attribute_t structs each 280 bytes in size, and 1
256 byte char array. The total saves on the stack is 880 bytes
after you account for the 5 new pointers added.
Also the source buffer length has been increased from MAXNAMELEN
to MAXNAMELEN+strlen(MOS_DIR_NAME)+1 as described by the comment in
dsl_dir_name(). A buffer overrun may have been possible with the
slightly smaller buffer.
The upstream ZFS code has correctly moved to a faster native sha2
implementation. Unfortunately, under Linux that's going to be a little
problematic so we revert the code to the more portable version contained
in earlier ZFS releases. Using the native sha2 implementation in Linux
is possible but the API is slightly different in kernel version user
space depending on which libraries are used. Ideally, we need a fast
implementation of SHA256 which builds as part of ZFS this shouldn't be
that hard to do but it will take some effort.
Reduce kernel stack usage by lzjb_compress() by moving uint16 array
off the stack and on to the heap. The exact performance implications
of this I have not measured but we absolutely need to keep stack
usage to a minimum. If/when this becomes and issue we optimize.
Move xiou stat structures from a header to the dmu.c source as is
done with all the other kstat interfaces. This information is local
to dmu.c registered the xuio kstat and should stay that way.
If your only going to allow one allocator to be used and it is defined
at compile time there is no point including the others in the build.
This patch could/should be refined for Linux to make the metaslab
configurable at run time. That might be a bit tricky however since
you would need to quiese all IO. Short of that making it configurable
as a module load option would be a reasonable compromise.
In the linux kernel 'current' is defined to mean the current process
and can never be used as a local variable in a function. Simply
replace all usage of 'current' with 'curr' in this function.
Updated fix to detect if we are in an interrupt and only sleep if it
is safe to do some. I guess it must be safe to sleep under Solaris
this must be handled in a sort interrupt handler there
Additional minor memory related tweak to move certain large allocations
to virtual memory and in one case to simply suppress the warning message
since it is not that far over the warning limit.
Upstream they modified the ioctl code so we need to make similiar
updates since we modify the API ourselves to always pass a pointer
to file pointer around. This allows us to track per file handle
state which is used by the zevent code.
The ZVOL interfaces changed significantly with the latest update. I've
updated the Linux version of the code to handle this and it looks like
the net result has been a simpler implementation which is good! Plus,
I'm relatively sure the ZIL integration is right this time although it
needs some serious crash testing to verify that.
Also minor additions to vdev_disk for .hold and .rele callbacks.
Currently, they do nothing and I may be able to simply stub them out
with NULLs for Linux since opening the device in Linux should have
much the same effort. More investigation is needed though since
the ZFS interface may make some demands here I'm overlooking.
After such a large update many of the symbols which were previously
exported are no longer available, and several new symbols have been
added and are needed. Refresh to topic branch to reflect this.
The DMU API has been modified to remove the dmu_objset_open, and
dmu_objset_close functions. Now you must explicitly *_create an
objset, then *_own it, *_disown it when not in use, and *_destroy
it when your through. All and all I like the API much better.
Additionally, while I was here I moved the zpios_cmd_t off the
stack because previous analysis showed it was very stack heavy.
Almost exclusively this patch handled the addition of another char
array to the zfs_cmd_t structure. Unfortunately c90 doesn't allow
zero filling the entire struct with the '= { 0 };' shorthand.