[PATCH v2 0/6] block: add a sequence number to disks
From: Matteo Croce
Date: Thu May 20 2021 - 09:57:07 EST
From: Matteo Croce <mcroce@xxxxxxxxxxxxx>
With this series a monotonically increasing number is added to disks,
precisely in the genhd struct, and it's exported in sysfs and uevent.
This helps the userspace correlate events for devices that reuse the
same device, like loop.
The first patch is the core one, the 2..4 expose the information in
different ways, the 5th increases the seqnum on media change and
the last one increases the sequence number for loop devices upon
attach, detach or reconfigure.
If merged, this feature will immediately used by the userspace:
https://github.com/systemd/systemd/issues/17469#issuecomment-762919781
v1 -> v2:
- increase seqnum on media change
- increase on loop detach
Matteo Croce (6):
block: add disk sequence number
block: add ioctl to read the disk sequence number
block: refactor sysfs code
block: export diskseq in sysfs
block: increment sequence number
loop: increment sequence number
Documentation/ABI/testing/sysfs-block | 12 +++++++
block/genhd.c | 46 ++++++++++++++++++++++++---
block/ioctl.c | 2 ++
drivers/block/loop.c | 5 +++
include/linux/genhd.h | 2 ++
include/uapi/linux/fs.h | 1 +
6 files changed, 64 insertions(+), 4 deletions(-)
--
2.31.1