diff --git a/seaweed-block/cmd/io-uring-probe/probe_linux_amd64.go b/seaweed-block/cmd/io-uring-probe/probe_linux_amd64.go index a5dc0e8079..d419a6848c 100644 --- a/seaweed-block/cmd/io-uring-probe/probe_linux_amd64.go +++ b/seaweed-block/cmd/io-uring-probe/probe_linux_amd64.go @@ -207,6 +207,7 @@ func runProbe(requestedDepth uint32) (probeReport, error) { report.SubmitSyscalls = ring.submitSyscalls return report, fmt.Errorf("write round: %w", err) } + seenWrites := make(map[uint64]bool, len(writeCQEs)) for i, cqe := range writeCQEs { if cqe.Result != probeBlockSize { report.SubmitSyscalls = ring.submitSyscalls @@ -218,6 +219,10 @@ func runProbe(requestedDepth uint32) (probeReport, error) { probeBlockSize, ) } + if cqe.UserData < 1 || cqe.UserData > uint64(len(payloads)) || seenWrites[cqe.UserData] { + return report, fmt.Errorf("unexpected write completion user_data=%d", cqe.UserData) + } + seenWrites[cqe.UserData] = true } fsyncCQEs, submitted, err := ring.submitAndWait([]ringOperation{{ @@ -232,7 +237,7 @@ func runProbe(requestedDepth uint32) (probeReport, error) { if err != nil { return report, fmt.Errorf("fsync round: %w", err) } - if len(fsyncCQEs) != 1 || fsyncCQEs[0].Result != 0 { + if len(fsyncCQEs) != 1 || fsyncCQEs[0].UserData != 1000 || fsyncCQEs[0].Result != 0 { return report, fmt.Errorf("fsync completion=%+v want one successful completion", fsyncCQEs) } diff --git a/seaweed-block/cmd/io-uring-probe/probe_linux_amd64_test.go b/seaweed-block/cmd/io-uring-probe/probe_linux_amd64_test.go index 00e0a37357..54ebf3eeca 100644 --- a/seaweed-block/cmd/io-uring-probe/probe_linux_amd64_test.go +++ b/seaweed-block/cmd/io-uring-probe/probe_linux_amd64_test.go @@ -2,7 +2,22 @@ package main -import "testing" +import ( + "testing" + "unsafe" +) + +func TestLinuxUAPIStructSizes(t *testing.T) { + if got := unsafe.Sizeof(ioUringParams{}); got != 120 { + t.Fatalf("io_uring_params size=%d want=120", got) + } + if got := unsafe.Sizeof(ioUringSQE{}); got != 64 { + t.Fatalf("io_uring_sqe size=%d want=64", got) + } + if got := unsafe.Sizeof(ioUringCQE{}); got != 16 { + t.Fatalf("io_uring_cqe size=%d want=16", got) + } +} func TestRunProbeCompletesWritesFsyncAndReopen(t *testing.T) { report, err := runProbe(8) diff --git a/seaweed-block/internal/docs/qa-assignments/phase168-d1-io-uring-capability-qa-signoff.md b/seaweed-block/internal/docs/qa-assignments/phase168-d1-io-uring-capability-qa-signoff.md new file mode 100644 index 0000000000..cd6392b1ae --- /dev/null +++ b/seaweed-block/internal/docs/qa-assignments/phase168-d1-io-uring-capability-qa-signoff.md @@ -0,0 +1,97 @@ +# Phase 168 D1 io_uring Capability Gate + +Status: developer gate PASS at `aa538bf`; independent review and QA pending. + +## Scope + +This gate answers one narrow question before any product integration: + +> Can the supported Linux build use a bounded `io_uring` to submit +> non-contiguous file writes, consume every completion, issue a durability +> barrier, and verify the bytes after close/reopen? + +It does not add a storage selector, change `parallelwal`, claim a performance +gain, or enable a mounted path. + +## Dependency Decision + +The spike uses the repository's existing `golang.org/x/sys/unix` dependency +for syscall numbers, `mmap`, and `munmap`. The small Linux UAPI structures +needed by the probe are local to `cmd/io-uring-probe`. + +| Property | Decision | +|---|---| +| New module | none | +| License | existing `x/sys` three-clause BSD-style license | +| CGO | not required | +| Linux boundary | `linux/amd64` build-tagged raw UAPI probe | +| Other platforms | explicit unsupported stub; Windows amd64 cross-build gate | +| Product API exposure | none | +| Wrapper comparison | deferred; no wrapper is necessary to prove D1 | + +A wrapper is not selected during D1 because the executable raw spike is +bounded and passes without adding a module or CGO boundary. D2 must move only +the proven minimum into an internal execution seam; it must not make the +probe package a public storage abstraction. + +## Developer Evidence + +Exact source commit: `aa538bf` + +Environment: + +```text +host=m02 +kernel_release=6.17.0-23-generic +io_uring_disabled=0 +seccomp=0 +``` + +Gate: + +```text +phase168_io_uring_capability_status=ok +product_selector_added=false +parallelwal_integration_added=false +linux_probe_test=pass +linux_write_fsync_reopen=pass +required_opcodes=write,fsync +dependency_added=false +cgo_required=false +windows_cross_compile=pass +unsupported_platform_boundary=explicit +``` + +Probe: + +```text +io_uring_probe_status=ok +platform=linux/amd64 +kernel_release=6.17.0-23-generic +io_uring_supported=true +refusal_reason=- +queue_depth=8 +write_opcode_supported=true +fsync_opcode_supported=true +submitted_ops=4 +submit_syscalls=4 +write_completions=3 +fsync_completions=1 +completion_count=4 +verified_bytes=12288 +implementation=raw_linux_uapi +dependency=golang.org/x/sys/unix +cgo_required=false +``` + +The three writes use offsets `0`, `12288`, and `4096`, so they are deliberately +non-contiguous in submission order. The barrier is an `IORING_OP_FSYNC`, not an +`os.File.Sync` hidden outside the ring. Every CQE is matched by `user_data`, +write lengths are checked, and all payloads are verified after reopening the +file. + +## D1 Verdict + +D1 may close only after the follow-up exact-commit run and adversarial review +confirm the same result. Passing D1 permits D2 implementation work; it does not +permit a selector, default change, performance claim, or mounted/RF3 claim. diff --git a/seaweed-block/scripts/run-phase168-io-uring-capability-gate.sh b/seaweed-block/scripts/run-phase168-io-uring-capability-gate.sh old mode 100644 new mode 100755