The writing client kept the caps of the files it wrote last. Every lookup of the verification client on one of them made the MDS recall the caps entry by entry, which cost about five seconds per lookup in the lab and stalled a 100,000-file verification near its end. Verify now opens a fresh target client, closes the writer, which returns all caps at once, and keeps writing through the fresh client. The claim lock is held through a client of its own, so it survives the change. Verify also checks non-directory entries in parallel with the configured number of workers. The walk and the directories stay serial, so skipped subtrees are handled in walk order. Transfer statistics report the duration of each round in seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
941 B
Go
41 lines
941 B
Go
//go:build ceph && cgo
|
|
|
|
package migration
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"git.zb-server.de/Sebi/CephfsMig/internal/cephfsnative"
|
|
"git.zb-server.de/Sebi/CephfsMig/internal/storage"
|
|
)
|
|
|
|
func openNativeEngine(ctx context.Context, c Config, x Executor, log io.Writer) (Engine, io.Closer, error) {
|
|
if err := ctx.Err(); err != nil {
|
|
return Engine{}, nil, err
|
|
}
|
|
|
|
source, err := cephfsnative.Open(options(c.Source))
|
|
if err != nil {
|
|
return Engine{}, nil, err
|
|
}
|
|
|
|
target, err := cephfsnative.Open(options(c.Target))
|
|
if err != nil {
|
|
source.Close()
|
|
return Engine{}, nil, err
|
|
}
|
|
|
|
openTarget := func() (storage.FS, error) {
|
|
v, err := cephfsnative.Open(options(c.Target))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return v, nil
|
|
}
|
|
|
|
backend := &nativeTransport{source: source, target: target, config: c, log: log, openTarget: openTarget}
|
|
return Engine{Exec: x, Log: log, Transport: backend, Access: nativeAccess{backend}}, backend, nil
|
|
}
|