feat: ec module#72
Conversation
0bdfee7 to
e57455b
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a new SPDK bdev_ec (erasure coding) module intended for Longhorn’s EC volumes, along with RPC/CLI surfaces, unit tests, and a small NVMe reconnect enhancement to refresh namespace capacity after a target-side resize.
Changes:
- Add the
bdev_ecmodule (WIB + unmapped-bitmap metadata, UNMAP fan-out, RMW path, resize support, and JSON-RPC handlers). - Add Python RPC/CLI bindings and a new unit test suite for EC bitmap/geometry logic.
- Refresh NVMe namespace
blockcntduring reconnect and notify upper layers of size changes.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/unittest.sh | Runs the new EC unit test binary from the unit test driver script. |
| test/unit/lib/bdev/Makefile | Adds the EC unit-test subdirectory to the unit-test build. |
| test/unit/lib/bdev/ec/Makefile | New unit-test subdir makefile for EC tests. |
| test/unit/lib/bdev/ec/bdev_ec.c/Makefile | Builds the EC unit test source via the SPDK unittest makefile. |
| test/unit/lib/bdev/ec/bdev_ec.c/bdev_ec_ut.c | Adds unit tests covering geometry math and unmapped-bitmap blob logic. |
| python/spdk/rpc/bdev.py | Adds Python RPC client wrappers for EC lifecycle/ops RPCs. |
| python/spdk/cli/bdev.py | Adds CLI commands for EC create/delete/status/replace/rebuild/resize. |
| module/bdev/nvme/bdev_nvme.c | Refreshes namespace blockcnt during reconnect and notifies bdev layer. |
| module/bdev/Makefile | Adds ec module directory to the bdev module build list. |
| module/bdev/ec/Makefile | New build rules for the EC module library. |
| module/bdev/ec/bdev_ec.h | Adds the EC module’s public header/API surface. |
| module/bdev/ec/bdev_ec_wib.c | Implements WIB persist/load and WIB status query. |
| module/bdev/ec/bdev_ec_unmap.c | Implements UNMAP handling (bitmap-backed fan-out + split head/tail zero-fill). |
| module/bdev/ec/bdev_ec_rpc.c | Adds JSON-RPC handlers for EC lifecycle/data-plane/control operations. |
| module/bdev/ec/bdev_ec_rmw.c | Implements RMW path for sub-stripe writes (including zero-fill). |
| module/bdev/ec/bdev_ec_resize.c | Implements async in-place resize of EC bdevs after base growth. |
| module/bdev/ec/bdev_ec_bitmap.c | Implements unmapped-bitmap on-disk format, persist/load, and bit-clear queue. |
| mk/spdk.modules.mk | Registers bdev_ec in the global modules list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
29cbeba to
fea1ddd
Compare
4849864 to
a9cf467
Compare
| struct ec_bdev *ec = ec_from_bdev_io(ec_io->bdev_io); | ||
|
|
||
| ec_io->is_zero_fill = true; | ||
| ec->unmaps_via_write_zeros++; | ||
| return ec_submit_write(ec_io); | ||
| } |
There was a problem hiding this comment.
This is by design. A single-stripe UNMAP never goes through the native path - it doesn't set bitmap bits or send UNMAP to the base disks; instead, it gets zero-filled (explained in ec_submit_unmap). So the count is not meant to add up. I reworded the comments so the gap doesn't read like a leak.
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
…mitter thread longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
… documentation longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
…b APIs longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
…s slot longhorn/longhorn-1061 Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
Which issue(s) this PR fixes:
Issue longhorn/longhorn#1061
What this PR does / why we need it:
Implement EC module.
Special notes for your reviewer:
NoneAdditional documentation or context
None