Comment 7 for bug 1729145

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :

Just to clarify on UUIDs - there are 3 types of UUIDs in question:

1. cache set UUIDs (upstream docs mention that multiple cache devices per cache set are not supported but a configuration with M:N as in <cache_devices>:<backing_devices> has been taken into account)
2. cache device superblock UUIDs;
3. backing device superblock UUIDs.

We are interested in uevents containing backing device superblock UUIDs to reliably create by-uuid symlinks and, ideally, have persistent /dev/bcache<n> names based on those UUIDs (although the latter is out of scope for this particular bug).

The following code in bcache-tools provides more clarity on how suberblock UUIDs are generated in userspace:

https://github.com/g2p/bcache-tools/blob/v1.0.8/make-bcache.c#L448-L458 loops over cache devices and backing devices calling write_sb for each device
https://github.com/g2p/bcache-tools/blob/v1.0.8/make-bcache.c#L170-L174 (write_sb which takes device type into account)
https://github.com/g2p/bcache-tools/blob/v1.0.8/make-bcache.c#L211-L221 - selects a type of suberblock which is either cache or backing device (cdev or bdev), writes bcache magic, generates a ***suberblock UUID***, writes a passed cache set UUID into in-memory suberblock representation along with block size and bucket size
https://github.com/g2p/bcache-tools/blob/v1.0.8/make-bcache.c#L284-L288 (pwrites the in-memory representation to a given block device)