Difference between revisions of "Platform code differences"

From OpenZFS
Jump to navigation Jump to search
m (Add PF_NOFS)
m (Add function pointer constification)
Line 8: Line 8:
* Converted large stack allocations to dynamic allocations
* Converted large stack allocations to dynamic allocations
** Linux has an 8KB stack in comparison to Illumos' luxurious 24KB stacks.
** Linux has an 8KB stack in comparison to Illumos' luxurious 24KB stacks.
* [https://github.com/zfsonlinux/zfs/commit/b01615d5ac86913da1e092d0378bfb8f0e72af30 Constify structures containing function pointers]
** The PaX effort to harden the Linux kernel considers writeable function pointers to be potential exploit targets. They modified the Linux kernel build system to report these as section mismatches.
* Switched various allocations from KM_SLEEP to KM_PUSHPAGE
* Switched various allocations from KM_SLEEP to KM_PUSHPAGE
** These were found to occur in code paths critical to swap on zvols
** These were found to occur in code paths critical to swap on zvols

Revision as of 10:36, 8 September 2013

It is useful to have a list of code differences between Illumos and other platforms. Please separate changes that are trivially portable to other platforms (mainly Illumos) from those that are not. Also, please include information on the rationale for each change.

ZFSOnLinux

Platform Independent (portable)

  • Switched from C99 to C89
    • Linux's build system uses gnu89.
  • Converted large stack allocations to dynamic allocations
    • Linux has an 8KB stack in comparison to Illumos' luxurious 24KB stacks.
  • Constify structures containing function pointers
    • The PaX effort to harden the Linux kernel considers writeable function pointers to be potential exploit targets. They modified the Linux kernel build system to report these as section mismatches.
  • Switched various allocations from KM_SLEEP to KM_PUSHPAGE
    • These were found to occur in code paths critical to swap on zvols
  • Drive Identifier database
    • This belongs in a different layer, but we do not have have the option of modifying the kernel itself, especially older ones. The database can be ported to Illumos' sd.conf without little difficulty. Entries can also be ported to a similar database in FreeBSD (although not in the reverse direction).
  • -o ashift= in zpool create/attach/replace commands
    • The sector size determines ashift at vdev creation. This is a manual override that permits the system administrator to workaround drives that lie with relative ease. It complements the drive database.
  • SA based xattrs
    • Improves get/set performance for small xattr values.
  • Better queuing of read IOs to leaves of mirror vdevs
    • Improves throughput and IOPS on mirrored vdevs
  • FASTWRITE algorithm
    • Greedy selection of least busy top-level vdev when queuing writes. Improves IOPS performance.
    • Patch being tested to remove mc_fastwrite_lock.

Platform Specific (non-portable)

  • Autotools build system
    • This could be adapted to other platforms, but the current code is extremely Linux-specific.
  • ZPIOS
    • Benchmark designed to exercise the the ZFS Transaction Object Layer
    • This could be adapted to other platforms with a rewrite to use Illumos interfaces.
  • ZFS POSIX Layer
    • Linux VFS hooks that attempt to wrap the functions (zfs_vnops.c) used on Illumos.
  • ZVOL code
    • A roughly 90% rewrite for Linux. Very little code shared with Illumos.
  • PF_NOFS thread flag
    • A thread specific flag to indicate that we are in a path that might involve swap.
    • KM_SLEEP allocations made in the presence of PF_NOFS will be converted to KM_PUSHPAGE. A stack trace is also printed to dmesg.