diff --git a/docs/raw-transfer.md b/docs/raw-transfer.md index 04a3217..7957f28 100644 --- a/docs/raw-transfer.md +++ b/docs/raw-transfer.md @@ -44,14 +44,62 @@ of the shared MDS metadata pool remains outside the migration. The following symbols were checked in the library actually running in the lab: -| Interface | Present | -| --- | --- | -| ceph_open_snapdiff | yes | -| ceph_open_snapdiff2 | no | -| ceph_readdir_snapdiff2 | no | -| ceph_file_blockdiff_init | yes | -| ceph_file_blockdiff | yes | -| ceph_file_blockdiff_finish | yes | +| Interface | Ceph 21.2.0 (lab) | Ceph `main` (2026-12-03) | +| --- | --- | --- | +| ceph_open_snapdiff | yes | yes | +| ceph_open_snapdiff2 | no | yes, unreleased | +| ceph_readdir_snapdiff2 | no | yes, unreleased | +| ceph_close_snapdiff2 | no | yes, unreleased | +| ceph_file_blockdiff_init | yes | yes | +| ceph_file_blockdiff | yes | yes | +| ceph_file_blockdiff_finish | yes | yes | + +### snapdiff2: available in Ceph `main` only + +As of 2026-12-03, the snapdiff2 interface exists in the development branch +`main` of Ceph, but in no release: the v21.2.0 header does not declare it, +and the lab library does not export it. cephmig does not use it; nothing is +built until a release contains it. + +What `main` contains, read from the source code: + +- `ceph_open_snapdiff2(cmount, root_path, rel_path, snap1, snap2, diff_mask, &out)`, + `ceph_readdir_snapdiff2` and `ceph_close_snapdiff2`, with an opaque handle + `struct ceph_snapdiff_info2`. The entries have the same type as in v1 + (`ceph_snapdiff_entry_t`: directory entry and snapshot ID; removed entries + carry the former snapshot ID). +- `diff_mask` selects which file metadata changes count as a difference: + `CEPH_SNAPDIFF_MODE`, `_UID`, `_GID`, `_SIZE`, `_NLINK`, `_MTIME`, `_ATIME`, + `_CTIME`, `_BTIME`. +- libcephfs only passes the mask through. It is a field `mask` of the MDS + request `CEPH_MDS_OP_READDIR_SNAPDIFF` (`ceph_mds_request_args.snapdiff`), + so it is most likely evaluated by the MDS. The MDS handler itself was not + read; this point is unconfirmed. +- Sources: [libcephfs.h](https://github.com/ceph/ceph/blob/main/src/include/cephfs/libcephfs.h), + [libcephfs.cc](https://github.com/ceph/ceph/blob/main/src/libcephfs.cc), + [ceph_fs.h](https://github.com/ceph/ceph/blob/main/src/include/ceph_fs.h). + +Consequences for cephmig: + +- Snapdiff runs against the **source** cluster. A newer libcephfs alone is + not enough; the source MDS must run a release that evaluates the mask. + An older MDS presumably ignores the field and behaves like v1. +- With `CEPH_SNAPDIFF_CTIME`, snapdiff2 should report the changes v1 missed + in the lab (chmod, xattr changes, writes through a hardlink alias, + overwrites with a reset mtime), because all of them change the ctime. +- It compares the two snapshots in the MDS, so unlike the rctime shortcut it + depends neither on delayed rctime propagation nor on client clocks. It + could therefore replace the rctime check in intermediate rounds and, after + a lab proof, possibly shorten `finalize`. +- Open: v1 reported every directory, including unchanged ones. The sources + do not say whether snapdiff2 behaves differently; without that, it cannot + be used to skip subtrees. + +Once a release contains snapdiff2, the next step is a lab test with that +release: repeat the snapdiff test cases (chmod, xattr change, alias write, +overwrite with reset mtime, untouched subtrees) and check which entries are +reported. The copier would then detect the symbol at runtime and fall back +to the current path without it. The installed Ceph 21.2.0 configuration knows `cephfs_mirror_blockdiff_min_file_size` with a default of 16 MiB.