loop: parse and store disk sequence number

When loop devices are re-used, the disk sequence number is increased.
Parse it when creating a loop device and store it.
The kernel will never return DISKSEQ=0, so use it to signal that it's
not supported by the current kernel.
This commit is contained in:
Luca Boccassi
2021-07-28 19:59:38 +01:00
parent 122adcb294
commit bcef1743a5
3 changed files with 39 additions and 0 deletions
+1
View File
@@ -14,6 +14,7 @@ struct LoopDevice {
dev_t devno;
char *node;
bool relinquished;
uint64_t diskseq; /* Block device sequence number, monothonically incremented by the kernel on create/attach, or 0 if we don't know */
uint64_t uevent_seqnum_not_before; /* uevent sequm right before we attached the loopback device, or UINT64_MAX if we don't know */
usec_t timestamp_not_before; /* CLOCK_MONOTONIC timestamp taken immediately before attaching the loopback device, or USEC_INFINITY if we don't know */
};