Comment 9 for bug 1729145

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

I reviewed this once again:

1. persistent /dev/bcache<i> - not possible or needed due to how kernel enumeration works
2. our userspace handles /dev/by-dname/<symlink> properly so we just need CACHED_UUID given to us during coldplug in some way to properly create /dev/bcache/by-uuid/<link> symlinks and consequently by-dname symlinks.

3. bcache, like almost all block device drivers, gets "struct device_type disk_type" by using alloc_disk from genhd.c which gives us standard contents for the uevent file. Partitions are a notable exception and use "struct device_type part_type" which has a .uevent field (http://elixir.free-electrons.com/linux/v4.14.2/source/block/partition-generic.c#L223) that allows customization of uevent file contents in a bus-, class- and type-specific manner (http://elixir.free-electrons.com/linux/v4.14.2/source/drivers/base/core.c#L903).

cat /sys/class/block/nvme0n1/uevent
MAJOR=259
MINOR=0
DEVNAME=nvme0n1
DEVTYPE=disk

as opposed to the following with partitions

cat /sys/class/block/nvme0n1p1/uevent
MAJOR=259
MINOR=1
DEVNAME=nvme0n1p1
DEVTYPE=partition
PARTN=1
PARTNAME=Basic data partition

While we could have a new block device type of "bcache" with a custom uevent content that had CACHED_UUID of a superblock this would be a userspace breakage which is hardly upstreamable.