summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Refactor existing codeBrian Behlendorf2015-01-1623-2115/+2506
| | | | | | | | | | | | | | | | | This change introduces no functional changes to the memory management interfaces. It only restructures the existing codes by separating the kmem, vmem, and kmem cache implementations in the separate source and header files. Splitting this functionality in to separate files required the addition of spl_vmem_{init,fini}() and spl_kmem_cache_{initi,fini}() functions. Additionally, several minor changes to the #include's were required to accommodate the removal of extraneous header from kmem.h. But again, while large this patch introduces no functional changes. Signed-off-by: Brian Behlendorf <[email protected]>
* Revert "Add PF_NOFS debugging flag"Richard Yao2015-01-161-49/+0
| | | | | | | | This reverts commit eb0f407a2b9089113ef6f2402ebd887511315b43 in preperation for updating the kmem/vmem infrastructure to use the PF_FSTRANS flag. Signed-off-by: Brian Behlendorf <[email protected]>
* Use current_kernel_time() in the time compatibility wrappersTim Chase2015-01-161-5/+2
| | | | | | | | | | | | | | | | | Since the Linux kernel's utimens family of functions uses current_kernel_time(), we need to do the same in the context of ZFS or else there can be discrepencies in timestamps (they go backward) if userland code does: fd = creat(FNAME, 0600); (void) futimens(fd, NULL); The getnstimeofday() function generally returns a slightly lower time value. Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes zfsonlinux/zfs#3006
* Fix debug object on stack warningBrian Behlendorf2015-01-071-34/+57
| | | | | | | | | | | | | | | | When running the SPLAT tests on a kernel with CONFIG_DEBUG_OBJECTS=y enabled the following warning is generated. ODEBUG: object is on stack, but not annotated WARNING: at lib/debugobjects.c:300 __debug_object_init+0x221/0x480() This is caused by the test cases placing a debug object on the stack rather than the heap. This isn't harmful since they are small objects but to make CONFIG_DEBUG_OBJECTS=y happy the objects have been relocated to the heap. This impacted taskq tests 1, 3, and 7. Signed-off-by: Brian Behlendorf <[email protected]> Closes #424
* mutex: force serialization on mutex_exit() to fix racesChunwei Chen2014-12-191-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is known that mutexes in Linux are not safe when using them to synchronize the freeing of object in which the mutex is embedded: http://lwn.net/Articles/575477/ The known places in ZFS which are suspected to suffer from the race condition are zio->io_lock and dbuf->db_mtx. * zio uses zio->io_lock and zio->io_cv to synchronize freeing between zio_wait() and zio_done(). * dbuf uses dbuf->db_mtx to protect reference counting. This patch fixes this kind of race by forcing serialization on mutex_exit() with a spin lock, making the mutex safe by sacrificing a bit of performance and memory overhead. This issue most commonly manifests itself as a deadlock in the zio pipeline caused by a process spinning on the damaged mutex. Similar deadlocks have been reported for the dbuf->db_mtx mutex. And it can also cause a NULL dereference or bad paging request under the right circumstances. This issue any many like it are linked off the zfsonlinux/zfs#2523 issue. Specifically this fix resolves at least the following outstanding issues: zfsonlinux/zfs#401 zfsonlinux/zfs#2523 zfsonlinux/zfs#2679 zfsonlinux/zfs#2684 zfsonlinux/zfs#2704 zfsonlinux/zfs#2708 zfsonlinux/zfs#2517 zfsonlinux/zfs#2827 zfsonlinux/zfs#2850 zfsonlinux/zfs#2891 zfsonlinux/zfs#2897 zfsonlinux/zfs#2247 zfsonlinux/zfs#2939 Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #421
* Remove compat includes from sys/types.hNed Bass2014-11-1915-22/+28
| | | | | | | | | | | | | | | | | | Don't include the compatibility code in linux/*_compat.h in the public header sys/types.h. This causes problems when an external code base includes the ZFS headers and has its own conflicting compatibility code. Lustre, in particular, defined SHRINK_STOP for compatibility with pre-3.12 kernels in a way that conflicted with the SPL's definition. Because Lustre ZFS OSD includes ZFS headers it fails to build due to a '"SHRINK_STOP" redefined' compiler warning. To avoid such conflicts only include the compat headers from .c files or private headers. Also, for consistency, include sys/*.h before linux/*.h then sort by header name. Signed-off-by: Ned Bass <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #411
* Retire legacy debugging infrastructureBrian Behlendorf2014-11-1926-3000/+389
| | | | | | | | | | | | | | | | | | When the SPL was originally written Linux tracepoints were still in their infancy. Therefore, an entire debugging subsystem was added to facilite tracing which served us well for many years. Now that Linux tracepoints have matured they provide all the functionality of the previous tracing subsystem. Rather than maintain parallel functionality it makes sense to fully adopt tracepoints. Therefore, this patch retires the legacy debugging infrastructure. See zfsonlinux/zfs@bc9f413 for the tracepoint changes. Signed-off-by: Ned Bass <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #408
* Lower minimum objects/slab thresholdBrian Behlendorf2014-11-052-1/+10
| | | | | | | | | As long as we can fit a minimum of one object/slab there's no reason to prevent the creation of the cache. This effectively pushes the maximum object size up to 32MB. The splat cache tests were extended accordingly to verify this functionality. Signed-off-by: Brian Behlendorf <[email protected]>
* Add config/compile to config/.gitignoreMarcel Wysocki2014-10-311-0/+1
| | | | | | | | | | | This file may be added by automake and therefore should be added to config/.gitignore. For the full list of possible auxiliary programs see the full automake documentation. http://www.gnu.org/software/automake/manual/automake.html#Auxiliary-Programs Signed-off-by: Marcel Wysocki <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* Fix modules installation directoryAlexander Pyhalov2014-10-281-1/+2
| | | | | | | | | When building zfs modules with kernel, compiled from deb.src, the packaging process ends up installing the modules in the wrong place. Signed-off-by: Alexander Pyhalov <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes zfsonlinux/zfs#2822
* Kernel header installation should respect --prefixRichard Yao2014-10-2812-13/+13
| | | | | | | | | | This is the upstream component of work that enables preliminary support for building Gentoo's ZFS packaging on other Linux systems via Gentoo Prefix. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #384
* kmem_cache: Call constructor/destructor on each alloc/freeRichard Yao2014-10-281-21/+16
| | | | | | | | | | | | | | This has a few benefits. First, it fixes a regression that "Rework generic memory allocation interfaces" appears to have triggered in splat's slab_reap and slab_age tests. Second, it makes porting code from Illumos to ZFSOnLinux easier. Third, it has the side effect of making reclaim from slab caches that specify reclaim functions an order of magnitude faster. The splat slab_reap test usually took 30 to 40 seconds. With this change, it takes 3 to 4. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #369
* Linux 3.12 compat: shrinker semanticsTim Chase2014-10-283-25/+57
| | | | | | | | | | | | | | | The new shrinker API as of Linux 3.12 modifies "struct shrinker" by replacing the @shrink callback with the pair of @count_objects and @scan_objects. It also requires the return value of @count_objects to return the number of objects actually freed whereas the previous @shrink callback returned the number of remaining freeable objects. This patch adds support for the new @scan_objects return value semantics and updates the splat shrinker test case appropriately. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Tim Chase <[email protected]> Closes #403
* Merge branch 'cleanup'Brian Behlendorf2014-10-2045-3478/+251
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Over the years the SPL code bases has accumulated compatibly code to allow it to build against a wide range of Linux kernels. In general this is desirable because it makes the code flexible. However, once support for these old kernels is no longer needed and is no longer being actively tested it should be removed. This helps keep the code simple and understandable. The spl-0.6.x releases have supported kernels all the way back to 2.6.26. This patch stack moves that cut off up to 2.6.32 and newer kernels. This ensures we still support all the major enterprise distributions which are largely locked in to 2.6.32 based kernels. And at the same time we can shed a large amount of compatibility code which simplifies maintenance and new development. Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #395
| * Remove vfs_fsync() wrapperBrian Behlendorf2014-10-172-30/+6
| | | | | | | | | | | | | | | | | | The vfs_fsync() function has been available since Linux 2.6.29. There is no longer a need to maintain this compatibility code. However, the HAVE_2ARGS_VFS_FSYNC check was left in place since that change occured after 2.6.32. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove kern_path() wrapperBrian Behlendorf2014-10-172-55/+0
| | | | | | | | | | | | | | The kern_path() function has been available since Linux 2.6.28. There is no longer a need to maintain this compatibility code. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove kvasprintf() wrapperBrian Behlendorf2014-10-172-42/+0
| | | | | | | | | | | | | | The kvasprintf() function has been available since Linux 2.6.22. There is no longer a need to maintain this compatibility code. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove proc_handler() wrapperBrian Behlendorf2014-10-175-139/+39
| | | | | | | | | | | | | | | | As of Linux 2.6.32 the proc handlers where updated to expect only five arguments. Therefore there is no longer a need to maintain this compatibility code and this infrastructure can be simplified. Signed-off-by: Brian Behlendorf <[email protected]>
| * Update put_task_struct() commentsBrian Behlendorf2014-10-171-2/+2
| | | | | | | | | | | | | | Update the comments to correctly reflect when this interface was added. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove credential configure checks.Brian Behlendorf2014-10-173-175/+24
| | | | | | | | | | | | | | | | | | | | | | The groups_search() function was never exported by a mainline kernel therefore we drop this compatibility code and always provide our own implementation. Additionally, the cred_t structure has been available since 2.6.29 so there is no longer a need to maintain compatibility code. Signed-off-by: Brian Behlendorf <[email protected]>
| * Add vfs_unlink() and vfs_rename() commentsBrian Behlendorf2014-10-171-0/+8
| | | | | | | | | | | | | | Just for consistency with the other autoconf checks a small comment block was added before these checks. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove set_fs_pwd() configure checkBrian Behlendorf2014-10-172-31/+10
| | | | | | | | | | | | | | | | | | | | | | This function has never been exported by any mainline and was only briefly available under RHEL5. Therefore this check is being removed and the code update to always use the wrapper function. The next step will be to eliminate all this code. If ZFS were updated not to assume that it's pwd was / there would be no need for this. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove user_path_dir() wrapperBrian Behlendorf2014-10-172-40/+0
| | | | | | | | | | | | | | The user_path_dir() function has been available since Linux 2.6.27. There is no longer a need to maintain this compatibility code. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove kallsyms_lookup_name() wrapperBrian Behlendorf2014-10-176-209/+1
| | | | | | | | | | | | | | | | | | | | After the removable of get_vmalloc_info(), the unused global memory variables, and the optional dcache/icache shrinkers there is no longer a need for the kallsyms compatibility code. This allows us to eliminate another brittle area of the code by removing the kernel upcall this functionality depended on for older kernels. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove shrink_{i,d}node_cache() wrappersBrian Behlendorf2014-10-177-268/+15
| | | | | | | | | | | | | | | | | | This is optional functionality which may or may not be useful to ZFS when using older kernels. It is never a hard requirement. Therefore this functionality is being removed from the SPL and a simpler slimmed down version will be added to ZFS. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove global memory variablesBrian Behlendorf2014-10-176-747/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Platforms such as Illumos and FreeBSD have historically provided global variables which summerize the memory state of a system. Linux on the otherhand doesn't expose any of this information to kernel modules and uses entirely different mechanisms for memory management. In order to simplify the original ZFS port to Linux these global variables were emulated by the SPL for the benefit of ZFS. As ZoL has matured over the years it has moved steadily away from these interfaces and now no longer depends on them at all. Therefore, this patch completely removes the global variables availrmem, minfree, desfree, lotsfree, needfree, swapfs_minfree, and swapfs_reserve. This greatly simplifies the memory management code and eliminates a common area of confusion. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove get_vmalloc_info() wrapperBrian Behlendorf2014-10-174-182/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The get_vmalloc_info() function was used to back the vmem_size() function. This was always problematic and resulted in brittle code because the kernel never provided a clean interface for modules. However, it turns out that the only caller of this function in ZFS uses it to determine the total virtual address space size. This can be determined easily without get_vmalloc_info() so vmem_size() has been updated to take this approach which allows us to shed the get_vmalloc_info() dependency. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove on_each_cpu() wrapperBrian Behlendorf2014-10-175-66/+1
| | | | | | | | | | | | | | The on_each_cpu() function has been available since Linux 2.6.27. There is no longer a need to maintain this compatibility code. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove mutex_lock_nested() wrapperBrian Behlendorf2014-10-174-62/+0
| | | | | | | | | | | | | | The mutex_lock_nested() function has been available since Linux 2.6.18. There is no longer a need to maintain this compatibility code. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove i_mutex() configure checkBrian Behlendorf2014-10-173-31/+3
| | | | | | | | | | | | | | | | | | | | | | The inode structure has used i_mutex as its internal locking primitive since 2.6.16. The compatibility code to check for the previous semaphore primitive has been removed. However, the wrapper function itself is being kept because it's entirely possible this primitive will change again to allow finer grained locking. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove kmalloc_node() compatibility codeBrian Behlendorf2014-10-172-24/+0
| | | | | | | | | | | | | | The kmalloc_node() function has been available since Linux 2.6.12. There is no longer a need to maintain this compatibility code. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove linux/uaccess.h header checkBrian Behlendorf2014-10-174-46/+1
| | | | | | | | | | | | | | | | The uaccess header has been available in the same location since Linux 2.6.18. There is no longer a need to maintain this compatibility code. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove uintptr_t typedefBrian Behlendorf2014-10-172-24/+0
| | | | | | | | | | | | | | The uintptr_t typedef has been available since Linux 2.6.24. There is no longer a need to maintain this compatibility code. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove atomic64_xchg() wrappersBrian Behlendorf2014-10-172-48/+0
| | | | | | | | | | | | | | | | The atomic64_xchg() and atomic64_cmpxchg() functions have been available since Linux 2.6.24. There is no longer a need to maintain this compatibility code. Signed-off-by: Brian Behlendorf <[email protected]>
| * Simplify the time compatibility wrappersBrian Behlendorf2014-10-177-274/+31
| | | | | | | | | | | | | | | | | | | | Many of the time functions had grown overly complex in order to handle kernel compatibility issues. However, as of Linux 2.6.26 all the required functionality is available. This allows us to retire numerous configure checks and greatly simplify the time compatibility wrappers. Signed-off-by: Brian Behlendorf <[email protected]>
| * Map highbit64() to fls64()Brian Behlendorf2014-10-175-97/+3
| | | | | | | | | | | | | | | | The fls64() function has been available since Linux 2.6.16 and it should be used to implemented highbit64(). This allows us to provide an optimized implementation and simplify the code. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove CTL_UNNUMBERED sysctl interfaceBrian Behlendorf2014-10-173-195/+4
| | | | | | | | | | | | | | | | | | Support for the CTL_UNNUMBERED sysctl interface was removed in Linux 2.6.19. There is no longer any reason to maintain this compatibility code. There also issue any reason to keep around the CTL_NAME macro and helpers so they have been retired. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove register_sysctl() compatibility codeBrian Behlendorf2014-10-173-32/+3
| | | | | | | | | | | | | | The register_sysctl() interface has been stable since Linux 2.6.21. There is no longer a need to maintain compatibility code. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove utsname() wrapperBrian Behlendorf2014-10-174-67/+0
| | | | | | | | | | | | | | | | | | There is no longer a need to wrap this because utsname() is provided by the kernel and can be called directly. This will require a small change in the ZFS code because utsname is expected to be a global structure and not a function. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove sysctl_vfs_cache_pressure assumptionBrian Behlendorf2014-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The generic SPL cache shrinkers make the assumption that the caches only contain VFS cache data and therefore should be scaled based on vfs_cache_pressure. This is not strictly true and it should not be assumed. Removing this tuning should not have any impact on the stock behavior because vfs_cache_pressure=100 by default. This means that no scaling will take place. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove adaptive mutex implementationBrian Behlendorf2014-10-174-124/+9
| | | | | | | | | | | | | | | | Since the Linux 2.6.29 kernel all mutexes have been adaptive mutexs. There is no longer any point in keeping this code so it is being removed to simplify the code. Signed-off-by: Brian Behlendorf <[email protected]>
| * Remove patches directoryBrian Behlendorf2014-10-172-197/+0
| | | | | | | | | | | | | | There is no longer a need to carry these stale patches in the SPL source tree. Signed-off-by: Brian Behlendorf <[email protected]>
| * Update code to use misc_register()/misc_deregister()Brian Behlendorf2014-10-177-225/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the SPL was originally written it was designed to use the device_create() and device_destroy() functions. Unfortunately, these functions changed considerably over the years making them difficult to rely on. As it turns out a better choice would have been to use the misc_register()/misc_deregister() functions. This interface for registering character devices has remained stable, is simple, and provides everything we need. Therefore the code has been reworked to use this interface. The higher level ZFS code has always depended on these same interfaces so this is also as a step towards minimizing our kernel dependencies. Signed-off-by: Brian Behlendorf <[email protected]>
| * Update SPLAT to use kmutex_t for portabilityBrian Behlendorf2014-10-173-21/+26
| | | | | | | | | | | | | | For consistency throughout the code update the SPLAT infrastructure to use the wrapped mutex interfaces. Signed-off-by: Brian Behlendorf <[email protected]>
| * Make license compatibility checks consistentBrian Behlendorf2014-10-176-28/+32
|/ | | | | | | Apply the license specified in the META file to ensure the compatibility checks are all performed consistently. Signed-off-by: Brian Behlendorf <[email protected]>
* Install header during post-build rather than post-install.Tom Prince2014-10-093-2/+2
| | | | | | | | | | | | | | | | New versions of dkms clean up the build directory after installing. It appears that this was always intended, but had rm -rf "/path/to/build/*" (note the quotes), which prevented it from working. Also, the build step is already installing stuff into the directory where these files go, so installing our stuff there as part of build rather than install makes sense. Signed-off-by: Tom Prince <[email protected]> Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #399
* Fix bug in SPLAT taskq:frontBrian Behlendorf2014-10-031-1/+2
| | | | | | | | | | | While running SPLAT on a kernel with CONFIG_DEBUG_ATOMIC_SLEEP enabled the taskq:front was flagged as a test which might sleep which in an unsafe context. Specifically, the splat_vprint() function which internally takes a mutex was being called under a spin lock. Moving the log function outside the spin lock cleanly solves this issue. Signed-off-by: Brian Behlendorf <[email protected]>
* Linux 3.16 compat: smp_mb__after_clear_bit()Turbo Fredriksson2014-09-221-1/+1
| | | | | | | | | | | | | | | The smp_mb__{before,after}_clear_bit functions have been renamed smp_mb__{before,after}_atomic. Rather than adding a compatibility function to handle this the code has been updated to use smp_wmb(). This has the advantage of being a stable functionally equivalent interface. On many architectures smp_mb__after_clear_bit() expands to smp_wmb(). Others might be able to do something slightly more efficient but this will be safe and correct on all of them. Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #386
* Avoid PAGESIZE redefinitionstf2014-08-181-1/+4
| | | | | | | | | Add #ifndef PAGESIZE to avoid redefinition warning on platforms where this value is already provided. Signed-off-by: stf <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #382
* Cleanup vn_rename() and vn_remove()Richard Yao2014-08-135-305/+129
| | | | | | | | | | | | | | zfsonlinux/spl#bcb15891ab394e11615eee08bba1fd85ac32e158 implemented Linux 3.6+ support by adding duplicate vn_rename and vn_remove functions. The new ones were cleaner, but the duplicate functions made the codebase less maintainable. This adds some compatibility shims that allow us to retire the older vn_rename and vn_remove in favor of the new ones on old kernels. The result is a net 143 line reduction in lines of code and a cleaner codebase. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #370