Skip to content

Slim down ZFS library #1383

@wkozaczuk

Description

@wkozaczuk

The ZFS filesystem driver is implemented as a shared library libsolaris.so. It is 800K in size, and more importantly, it implements many features that are of little if any use on a unikernel.

More specifically, the following features can be disabled/commented out:

  • support for not used vdevs - "file", "missing", "raidz", "hole", "spare", "replacing"
  • support for dynamically adding/removing vdevs
  • support for l2arc and spares (see spa_add_spares() and spa_add_l2cache() for example)
  • drivers/zfs.cc and zfs_ioctl should only be used by zfs_builder
  • adjust some macros like VERIFY in bsd/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h to deflate rodata

I propose we disable these features with relevant ifdefs and potentially enhance the build process to produce two versions of libsolaris.so:

  • slimmed down for use in regular runtime image
  • full one (or at least with drivers/zfs.cc and zfs_ioctl) for use by zfs_builder

The work-in-progress branch can be found here: https://github.com/wkozaczuk/osv/tree/zfs_slim, where I managed to shrink libsolaris.so to 576 KB in size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions