summaryrefslogtreecommitdiffstats
path: root/module
Commit message (Collapse)AuthorAgeFilesLines
* Use stored whole_disk property when opening a vdevNed Bass2010-10-041-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes a bug in vdev_disk_open() in which the whole_disk property was getting set to 0 for disk devices, even when it was stored as a 1 when the zpool was created. The whole_disk property lets us detect when the partition suffix should be stripped from the device name in CLI output. It is also used to determine how writeback cache should be set for a device. When an existing zpool is imported its configuration is read from the vdev label by user space in zpool_read_label(). The whole_disk property is saved in the nvlist which gets passed into the kernel, where it in turn gets saved in the vdev struct in vdev_alloc(). Therefore, this value is available in vdev_disk_open() and should not be overridden by checking the provided device path, since that path will likely point to a partition and the check will return the wrong result. We also add an ASSERT that the whole_disk property is set. We are not aware of any cases where vdev_disk_open() should be called with a config that doesn't have this property set. The ASSERT is there so that when debugging is enabled we can identify any legitimate cases that we are missing. If we never hit the ASSERT, we can at some point remove it along with the conditional whole_disk check. Signed-off-by: Brian Behlendorf <[email protected]>
* Register the space accounting callback even when we don't have the ZPL.Ricardo M. Correia2010-10-041-1/+3
| | | | | | | | | | | | This callback is needed for properly accounting the per-uid and per-gid space usage. Even if we don't have the ZPL, we still need this callback in order to have proper on-disk ZPL compatibility and to be able to use Lustre quotas. Fortunately, the callback doesn't have any ZPL/VFS dependencies so we can just move it out of #ifdef HAVE_ZPL. Signed-off-by: Brian Behlendorf <[email protected]>
* Export ZFS symbols needed by Lustre.Ricardo M. Correia2010-09-171-0/+11
| | | | | | | Required for the DB_DNODE_ENTER()/DB_DNODE_EXIT() helpers. Signed-off-by: Ricardo M. Correia <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* Quiet down very frequent large allocation warning in ZFS.Ricardo M. Correia2010-09-171-1/+1
| | | | | | | | | In my machine, dnode_hold_impl() allocates 9992 bytes in DEBUG mode and it causes a large stream of stack traces in the logs. Instead, use KM_NODEBUG to quiet down this known large alloc. Signed-off-by: Ricardo M. Correia <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* Support custom build directories and move includesBrian Behlendorf2010-09-0889-50088/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the neat tricks an autoconf style project is capable of is allow configurion/building in a directory other than the source directory. The major advantage to this is that you can build the project various different ways while making changes in a single source tree. For example, this project is designed to work on various different Linux distributions each of which work slightly differently. This means that changes need to verified on each of those supported distributions perferably before the change is committed to the public git repo. Using nfs and custom build directories makes this much easier. I now have a single source tree in nfs mounted on several different systems each running a supported distribution. When I make a change to the source base I suspect may break things I can concurrently build from the same source on all the systems each in their own subdirectory. wget -c http://github.com/downloads/behlendorf/zfs/zfs-x.y.z.tar.gz tar -xzf zfs-x.y.z.tar.gz cd zfs-x-y-z ------------------------- run concurrently ---------------------- <ubuntu system> <fedora system> <debian system> <rhel6 system> mkdir ubuntu mkdir fedora mkdir debian mkdir rhel6 cd ubuntu cd fedora cd debian cd rhel6 ../configure ../configure ../configure ../configure make make make make make check make check make check make check This change also moves many of the include headers from individual incude/sys directories under the modules directory in to a single top level include directory. This has the advantage of making the build rules cleaner and logically it makes a bit more sense.
* Fix zfsdev_compat_ioctl() caseBrian Behlendorf2010-09-011-1/+1
| | | | | | For the !CONFIG_COMPAT case fix the zfsdev_compat_ioctl() compatibility function name. This was caught by the chaos4.3 builder.
* Add linux zpios supportBrian Behlendorf2010-08-315-0/+1679
| | | | | | Linux kernel implementation of PIOS test app. Signed-off-by: Brian Behlendorf <[email protected]>
* Add linux user disk supportBrian Behlendorf2010-08-312-2/+6
| | | | | | | | | This topic branch contains all the changes needed to integrate the user side zfs tools with Linux style devices. Primarily this includes fixing up the Solaris libefi library to be Linux friendly, and integrating with the libblkid library which is provided by e2fsprogs. Signed-off-by: Brian Behlendorf <[email protected]>
* Add linux compatibilityBrian Behlendorf2010-08-311-1/+4
| | | | | | Resolve minor Linux compatibility issues. Signed-off-by: Brian Behlendorf <[email protected]>
* Add linux spa thread supportBrian Behlendorf2010-08-311-1/+3
| | | | | | Disable the spa thread under Linux until it can be implemented. Signed-off-by: Brian Behlendorf <[email protected]>
* Add linux sha2 supportBrian Behlendorf2010-08-311-20/+97
| | | | | | | | | | | | | 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. Signed-off-by: Brian Behlendorf <[email protected]>
* Add linux kernel module supportBrian Behlendorf2010-08-3140-10/+820
| | | | | | | | | | | Setup linux kernel module support, this includes: - zfs context for kernel/user - kernel module build system integration - kernel module macros - kernel module symbol export - kernel module options Signed-off-by: Brian Behlendorf <[email protected]>
* Add linux kernel memory supportBrian Behlendorf2010-08-3112-28/+57
| | | | | | Required kmem/vmem changes Signed-off-by: Brian Behlendorf <[email protected]>
* Add linux kernel disk supportBrian Behlendorf2010-08-3127-112/+2571
| | | | | | Native Linux vdev disk interfaces Signed-off-by: Brian Behlendorf <[email protected]>
* Add linux kernel device supportBrian Behlendorf2010-08-313-216/+257
| | | | | | | | | | | | | | | | This branch contains the majority of the changes required to cleanly intergrate with Linux style special devices (/dev/zfs). Mainly this means dropping all the Solaris style callbacks and replacing them with the Linux equivilants. This patch also adds the onexit infrastructure needed to track some minimal state between ioctls. Under Linux it would be easy to do this simply using the file->private_data. But under Solaris they apparent need to pass the file descriptor as part of the ioctl data and then perform a lookup in the kernel. Once again to keep code change to a minimum I've implemented the Solaris solution. Signed-off-by: Brian Behlendorf <[email protected]>
* Add linux spl debug supportBrian Behlendorf2010-08-311-0/+13
| | | | | | Use spl debug if HAVE_SPL defined Signed-off-by: Brian Behlendorf <[email protected]>
* Add linux mlslabel supportBrian Behlendorf2010-08-311-0/+4
| | | | | | | | | | The ZFS update to onnv_141 brought with it support for a security label attribute called mlslabel. This feature depends on zones to work correctly and thus I am disabling it under Linux. Equivilant functionality could be added at some point in the future. Signed-off-by: Brian Behlendorf <[email protected]>
* Add linux eventsBrian Behlendorf2010-08-3114-489/+681
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This topic branch leverages the Solaris style FMA call points in ZFS to create a user space visible event notification system under Linux. This new system is called zevent and it unifies all previous Solaris style ereports and sysevent notifications. Under this Linux specific scheme when a sysevent or ereport event occurs an nvlist describing the event is created which looks almost exactly like a Solaris ereport. These events are queued up in the kernel when they occur and conditionally logged to the console. It is then up to a user space application to consume the events and do whatever it likes with them. To make this possible the existing /dev/zfs ABI has been extended with two new ioctls which behave as follows. * ZFS_IOC_EVENTS_NEXT Get the next pending event. The kernel will keep track of the last event consumed by the file descriptor and provide the next one if available. If no new events are available the ioctl() will block waiting for the next event. This ioctl may also be called in a non-blocking mode by setting zc.zc_guid = ZEVENT_NONBLOCK. In the non-blocking case if no events are available ENOENT will be returned. It is possible that ESHUTDOWN will be returned if the ioctl() is called while module unloading is in progress. And finally ENOMEM may occur if the provided nvlist buffer is not large enough to contain the entire event. * ZFS_IOC_EVENTS_CLEAR Clear are events queued by the kernel. The kernel will keep a fairly large number of recent events queued, use this ioctl to clear the in kernel list. This will effect all user space processes consuming events. The zpool command has been extended to use this events ABI with the 'events' subcommand. You may run 'zpool events -v' to output a verbose log of all recent events. This is very similar to the Solaris 'fmdump -ev' command with the key difference being it also includes what would be considered sysevents under Solaris. You may also run in follow mode with the '-f' option. To clear the in kernel event queue use the '-c' option. $ sudo cmd/zpool/zpool events -fv TIME CLASS May 13 2010 16:31:15.777711000 ereport.fs.zfs.config.sync class = "ereport.fs.zfs.config.sync" ena = 0x40982b7897700001 detector = (embedded nvlist) version = 0x0 scheme = "zfs" pool = 0xed976600de75dfa6 (end detector) time = 0x4bec8bc3 0x2e5aed98 pool = "zpios" pool_guid = 0xed976600de75dfa6 pool_context = 0x0 While the 'zpool events' command is handy for interactive debugging it is not expected to be the primary consumer of zevents. This ABI was primarily added to facilitate the addition of a user space monitoring daemon. This daemon would consume all events posted by the kernel and based on the type of event perform an action. For most events simply forwarding them on to syslog is likely enough. But this interface also cleanly allows for more sophisticated actions to be taken such as generating an email for a failed drive. Signed-off-by: Brian Behlendorf <[email protected]>
* Add build systemBrian Behlendorf2010-08-316-0/+188
| | | | | | Add autoconf style build infrastructure to the ZFS tree. This includes autogen.sh, configure.ac, m4 macros, some scripts/*, and makefiles for all the core ZFS components.
* Fix stack traverse_visitbp()Brian Behlendorf2010-08-311-98/+177
| | | | | | | | | | | | | Due to limited stack space recursive functions are frowned upon in the Linux kernel. However, they often are the most elegant solution to a problem. The following code preserves the recursive function traverse_visitbp() but moves the local variables AND function arguments to the heap to minimize the stack frame size. Enough space is initially allocated on the stack for 20 levels of recursion. This change does ugly-up-the-code but it reduces the worst case usage from roughly 4160 bytes to 960 bytes on x86_64 archs. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix stack zio_execute()Ned Bass2010-08-311-4/+22
| | | | | | | | | | Implement zio_execute() as a wrapper around the static function __zio_execute() so that we can force __zio_execute() to be inlined. This reduces stack overhead which is important because __zio_execute() is called recursively in several zio code paths. zio_execute() itself cannot be inlined because it is externally visible. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix stack zio_done()Brian Behlendorf2010-08-311-33/+30
| | | | | | | | | Eliminated local variables pointing to members of the zio struct. Just refer to the struct members directly. This saved about 32 bytes per call, but this function can be called recurisvely up to 19 levels deep, so we potentially save up to 608 bytes. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix stack vdev_cache_read()Brian Behlendorf2010-08-311-3/+5
| | | | | | | Moving the vdev_cache_entry_t struct ve_search from the stack to the heap saves ~100 bytes. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix stack traverse_impl()Brian Behlendorf2010-08-311-28/+36
| | | | | | Stack use reduced from 560 bytes to 128 bytes. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix stack noinlineBrian Behlendorf2010-08-312-7/+15
| | | | | | | | | Certain function must never be automatically inlined by gcc because they are stack heavy or called recursively. This patch flags all such functions I've found as 'noinline' to prevent gcc from making the optimization. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix stack lzjbBrian Behlendorf2010-08-311-3/+8
| | | | | | | | | 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. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix stack inlineBrian Behlendorf2010-08-313-4/+7
| | | | | | | | Decrease stack usage for various call paths by forcing certain functions to be inlined. By inlining the functions the overhead of a new stack frame is removed at the cost of increased code size. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix stack dsl_scan_visitbp()Brian Behlendorf2010-08-311-9/+14
| | | | | | | To reduce stack overhead this topic branch moves the 128 byte blkptr_t data strucutre in dsl_scan_visitbp() to the heap. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix stack dsl_dir_open_spa()Brian Behlendorf2010-08-311-5/+8
| | | | | | | Reduce stack usage by 256 bytes by moving buf char array from the stack to the heap. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix stack dsl_deleg_get()Brian Behlendorf2010-08-311-17/+26
| | | | | | | | | | | | | | | | | 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. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix stack dsl_dataset_destroy()Brian Behlendorf2010-08-311-9/+13
| | | | | | | | Move dsl_dataset_t local variable from the stack to the heap. This reduces the stack usage of this function from 2048 bytes to 176 bytes for x84_64 arches. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix stack dmu_objset_snapshot()Brian Behlendorf2010-08-311-23/+27
| | | | | | | Reduce stack usage by 276 bytes by moving the snaparg struct from the stack to the heap. We have limited stack space we must not waste. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix stack dbuf_hold_impl()Brian Behlendorf2010-08-311-64/+140
| | | | | | | | | | | This commit preserves the recursive function dbuf_hold_impl() but moves the local variables and function arguments to the heap to minimize the stack frame size. Enough space is initially allocated on the stack for 20 levels of recursion. This technique was based on commit 34229a2f2ac07363f64ddd63e014964fff2f0671 which reduced stack usage of traverse_visitbp(). Signed-off-by: Brian Behlendorf <[email protected]>
* Fix dnode_move() scopeBrian Behlendorf2010-08-311-1/+3
| | | | | | The dnode_move() functionality is only used in the kernel build. As such we should be careful to wrap all of the related code with '#ifdef _KERNEL' to avoid gcc warnings about unused code.
* Fix zfs_ioc_objset_statsBrian Behlendorf2010-08-311-2/+3
| | | | | | | | | | | | Interestingly this looks like an upstream bug as well. If for some reason we are unable to get a zvols statistics, because perhaps the zpool is hopelessly corrupt, we would trigger the VERIFY. This commit adds the proper error handling just to propagate the error back to user space. Now the user space tools still must handle this properly but in the worst case the tool will crash or perhaps have some missing output. That's far far better than crashing the host. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix zio_taskq_dispatch to use TQ_NOSLEEPBrian Behlendorf2010-08-311-3/+4
| | | | | | | | | | The zio_taskq_dispatch() function may be called at interrupt time and it is critical that we never sleep. Additionally, wrap taskq_dispatch() in a while loop because it may fail. This is non optimal but is OK for now. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix rw_init() usageBrian Behlendorf2010-08-313-4/+4
| | | | | | Properly initialize rwlock primitives. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix zmod.h usage in userspaceBrian Behlendorf2010-08-311-7/+20
| | | | | | | | | | | Do not use zmod.h in userspace. This has also been filed with the ZFS team. It makes the userspace libzpool code use the zlib API, instead of the Solaris-only and non-standard zmod.h. The zlib API is almost identical and is a de facto standard, so this is a no-brainer. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix missing newlinesBrian Behlendorf2010-08-311-2/+2
| | | | | | Add missing \n's to dprintf()s Signed-off-by: Brian Behlendorf <[email protected]>
* Fix metaslabBrian Behlendorf2010-08-311-0/+20
| | | | | | | | | | | 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. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix list handling to only use the APIBrian Behlendorf2010-08-314-0/+8
| | | | | | | | | | | | | Remove all instances of list handling where the API is not used and instead list data members are directly accessed. Doing this sort of thing is bad for portability. Additionally, ensure that list_link_init() is called on newly created list nodes. This ensures the node is properly initialized and does not rely on the assumption that zero'ing the list_node_t via kmem_zalloc() is the same as proper initialization. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix kstat xuioBrian Behlendorf2010-08-313-26/+26
| | | | | | | | 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. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix dbuf eviction assertionBrian Behlendorf2010-08-311-1/+5
| | | | | | | Replace non-fatal assertion with warning. This was being observed during testing and it should not be fatal. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix dbuf_dirty_record_t leaksBrian Behlendorf2010-08-312-0/+6
| | | | | | Fix two leaks with dbuf_dirty_record_t Signed-off-by: Brian Behlendorf <[email protected]>
* Fix variables named currentBrian Behlendorf2010-08-311-14/+14
| | | | | | | | 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. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix commit callbacksRicardo M. Correia2010-08-311-3/+3
| | | | | | | | | | | | | | | | | | | | | | The upstream commit cb code had a few bugs: 1) The arguments of the list_move_tail() call in txg_dispatch_callbacks() were reversed by mistake. This caused the commit callbacks to not be called at all. 2) ztest had a bug in ztest_dmu_commit_callbacks() where "error" was not initialized correctly. This seems to have caused the test to always take the simulated error code path, which made ztest unable to detect whether commit cbs were being called for transactions that successfuly complete. 3) ztest had another bug in ztest_dmu_commit_callbacks() where the commit cb threshold was not being compared correctly. 4) The commit cb taskq was using 'max_ncpus * 2' as the maxalloc argument of taskq_create(), which could have caused unnecessary delays in the txg sync thread. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix gcc uninitialized variable warningsBrian Behlendorf2010-08-3117-29/+34
| | | | | | Gcc -Wall warn: 'uninitialized variable' Signed-off-by: Brian Behlendorf <[email protected]>
* Fix gcc unused variable warningsBrian Behlendorf2010-08-3112-36/+34
| | | | | | Gcc -Wall warn: 'unused variable' Signed-off-by: Brian Behlendorf <[email protected]>
* Fix gcc missing parenthesis warningsBrian Behlendorf2010-08-3125-76/+78
| | | | | | Gcc -Wall warn: 'missing parenthesis' Signed-off-by: Brian Behlendorf <[email protected]>
* Fix gcc missing case warningsBrian Behlendorf2010-08-277-0/+21
| | | | | | Gcc ASSERT() missing cases are impossible Signed-off-by: Brian Behlendorf <[email protected]>