Skip to content

[WIP] Raidz Expansion: multiple devices expanding #17588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fuporovvStack
Copy link
Contributor

@fuporovvStack fuporovvStack commented Aug 2, 2025

Motivation and Context

Allow to attach multiple raidz children at once, by applying single reflow process for all newly attached devices in parallel.

This PR allows to attach multiple devices to raidz in same time in parallel. The zpool command is executed by the next way:

$ zpool attach poolname raidz1-0 /path/to/dev0 /path/to/dev1 ... /path/to/devX

Description

The multiple devices raidz expnding will be completed after single reflow process iteration. The number of attached devices should be less, then raidz have initially. The older versions of ZFS with raidz expansion support will not be able to work with raidz expanded with the multiple raidz attached devices.

The multiple devices raidz expansion become possible by adding new vdev label config variable ZPOOL_CONFIG_RAIDZ_EXPAND_VDEVS additionally to ZPOOL_CONFIG_RAIDZ_EXPAND_TXGS. This variable is an array of values of devices attached per raidz expansion iteration. Updated on every reflow process completion, same as ZPOOL_CONFIG_RAIDZ_EXPAND_TXGS array. Both ZPOOL_CONFIG_RAIDZ_EXPAND_TXGS and ZPOOL_CONFIG_RAIDZ_EXPAND_VDEVS should have the same size and used to build raidz txg avl tree to compute raidz width dependent of bp birth txg value.

I did not found any reasons, why it would be impossible from raidz math point of view.
If you have any concerns or suggestions regarding raidz math and multiple devices raidz expanding process, please let me know.

Notes:

  • It possible to try multiple devices raidz expansion using zhack utility, zhack was modified appropriately.
  • Single device raidz expansion considered as "worked" with modified raidz logic. Passed some number of ztest iterations.

TODO:

  • The appropriate ZFS feature flag need to be added.
  • userspace:
    • zpool/cmd:
      • zpool attach should support multiple device paths as arguments - clean reimplementation is required
      • validate same device is not attached multiple times
      • zpool attach man page should be updated
    • ztest:
      • ztest issues need to be reproduced clearly and fixed for multiple devices raidz attaching
      • ztest logic should be refactored and retested
    • zfs-tests.sh:
      • additional tests of raidz_test tool should be added
      • multiple devices raidz attach test cases needed to be added
  • kernel:
    • vdev_raidz core logic refactoring is required
    • ensure aggregation logic is compatible with multidev expansion
    • not sure that raidz_reconstruct() should not to be modified

How Has This Been Tested?

No zfs-tests.sh tests scripts for now.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

Allow to attach multiple raidz children at once, by applying
single reflow process for all newly attached devices in parallel.

The zpool attach is executed by the same way, as for single device
attaching, but now multiple devices could be passed as arguments
at once.

XXX: More detailed/clean description:
	- rze logic modifications explanation
	- zpool attach examples, etc
	- zfs feature is required

Sponsored-by: vStack, Inc.
Signed-off-by: Fedor Uporov <[email protected]>
@amotin amotin marked this pull request as draft August 3, 2025 16:40
@github-actions github-actions bot added the Status: Work in Progress Not yet ready for general review label Aug 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Work in Progress Not yet ready for general review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants