Published on

关于 OpenZFS

Authors
  • avatar
    Name
    ttyS3
    Twitter

kernel modules

以 pve 8 (基于 debian 12) 为例,里面的 zfs 模块在 /lib/modules/$(uname -r)/zfs/ 目录。

root@pve:~# ls -lh /lib/modules/$(uname -r)/zfs/
total 4.1M
-rw-r--r-- 1 root root  569K Jun 17 13:58 icp.ko
-rw-r--r-- 1 root root  241K Jun 17 13:58 spl.ko
-rw-r--r-- 1 root root   29K Jun 17 13:58 zavl.ko
-rw-r--r-- 1 root root  215K Jun 17 13:58 zcommon.ko
-rw-r--r-- 1 root root  6.9M Jun 17 13:58 zfs.ko
-rw-r--r-- 1 root root  416K Jun 17 13:58 zlua.ko
-rw-r--r-- 1 root root  211K Jun 17 13:58 znvpair.ko
-rw-r--r-- 1 root root  373K Jun 17 13:58 zunicode.ko
-rw-r--r-- 1 root root 1007K Jun 17 13:58 zzstd.ko
root@pve:~# modinfo spl | grep -E 'author|description|license|filename'
filename:       /lib/modules/6.2.16-3-pve/zfs/spl.ko
license:        GPL
author:         OpenZFS
description:    Solaris Porting Layer
ls -1 /lib/modules/$(uname -r)/zfs/ | xargs -I'{}' basename '{}' .ko | xargs -I'{}' sh -c 'modinfo "{}" | grep -E "author|description|license|filename"; echo "-------------------------"' 
filename:       /lib/modules/6.2.16-3-pve/zfs/icp.ko
license:        CDDL
author:         OpenZFS
-------------------------
filename:       /lib/modules/6.2.16-3-pve/zfs/spl.ko
license:        GPL
author:         OpenZFS
description:    Solaris Porting Layer
-------------------------
filename:       /lib/modules/6.2.16-3-pve/zfs/zavl.ko
license:        CDDL
author:         OpenZFS
description:    Generic AVL tree implementation
-------------------------
filename:       /lib/modules/6.2.16-3-pve/zfs/zcommon.ko
license:        CDDL
author:         OpenZFS
description:    Generic ZFS support
-------------------------
filename:       /lib/modules/6.2.16-3-pve/zfs/zfs.ko
license:        CDDL
author:         OpenZFS
description:    ZFS
-------------------------
filename:       /lib/modules/6.2.16-3-pve/zfs/zlua.ko
license:        Dual MIT/GPL
author:         Lua.org
description:    Lua Interpreter for ZFS
-------------------------
filename:       /lib/modules/6.2.16-3-pve/zfs/znvpair.ko
license:        CDDL
author:         OpenZFS
description:    Generic name/value pair implementation
-------------------------
filename:       /lib/modules/6.2.16-3-pve/zfs/zunicode.ko
license:        CDDL
author:         OpenZFS
description:    Unicode implementation
-------------------------
filename:       /lib/modules/6.2.16-3-pve/zfs/zzstd.ko
license:        Dual BSD/GPL
description:    ZSTD Compression for ZFS
-------------------------

OpenZFS 的 license 均为 CDDL

另外这个 zfs/spl.ko 模块引起了我的注意, 描述为 Solaris Porting Layer , 似乎是个中间层的 porting 代码。

查看 https://openzfs.org/wiki/Reduce_code_differences 果然如此:

Reduce code differences Jump to navigationJump to search One of the technical goals of OpenZFS is to reduce code differences between the various platforms that support ZFS. To accomplish this, we will:

Create a "porting layer" to abstract out the platform-specific code. The "Solaris Porting Layer" (SPL) is a good start at this. We can improve it by moving illumos/Solaris-specific code out of the main files and into platform-specific files. Split the ZPL into platform-independent and platform-specific parts. Long-term, consider if we can create a common repository to use for platform-independent ZFS code, rather than treating illumos as the de facto upstream repository. Any code in this repo would need to be able to be tested in a platform-independent way (e.g. in userland using libzpool), so that changes tested on one platform can be expected to work on every platform. Code tested by ztest would be the first candidate for this. Userland ZFS ioctls would enable running /sbin/zfs and /sbin/zpool, and thus most of the TestRunner test suite against libzpool. See Platform code differences for specific information on areas of divergence.

由于 ZFS 是从 illumos/Solaris port 到 linux 的,而 ZFS 又不想因为 Linux 而改动其核心代码,因此就有了这个 "porting layer" 把 Linux 上没有的一些东西做兼容处理。