Skip to content

Add block.create_options to block storage drivers #3308

@huoxingdawang

Description

@huoxingdawang

Is there an existing issue for this?

  • There is no existing issue for this feature

What are you currently unable to do

When using Incus with a LINSTOR storage backend where LINSTOR itself uses ZFS as the underlying storage pool (e.g., with volblocksize=16K), it is often necessary to tune the filesystem creation parameters to align I/O with the underlying backend's block size.

For example, with a ZFS volblocksize of 16 KiB, one would want to create ext4 filesystems with:

mkfs.ext4 -b 4096 -E stripe-width=4,stride=4 <device>

This ensures that ext4's internal I/O patterns align with the ZFS block boundaries, avoiding read-modify-write amplification and improving performance.

LINSTOR natively supports filesystem configuration via:

linstor resource-group set-property default FileSystem/Type ext4
linstor resource-group set-property default FileSystem/MkfsParams "-b 4096 -E stripe-width=4,stride=4"

However, Incus does not delegate filesystem creation to LINSTOR. Instead, it invokes makeFSType() (utils.go) directly to format the block device after it is allocated. As a result, any FileSystem/MkfsParams configuration set on the LINSTOR resource group is completely ignored by Incus.

The makeFSType function currently only accepts a Label via its mkfsOptions struct and hard-codes ext4 extra options (-E nodiscard,lazy_itable_init=0,lazy_journal_init=0), providing no way to pass additional user-defined parameters.

What do you think would need to be added

Add a new block.mkfs_options configuration key to the LINSTOR driver, mirroring the pattern already used by block.filesystem and block.mount_options.

And I am glad to submit a PR implementing this change if possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EasyGood for new contributors

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions