From 4b27025223206c392c259e6c7cb98c40781801fd Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 15 Jul 2025 17:21:03 +0200 Subject: [PATCH] discover-image: pick up subvol ctime, too The btrfs subvol ctime is conceptually what we call the images "mtime", hence expose it like that, since we get it anyway these days. --- src/shared/btrfs-util.c | 1 + src/shared/btrfs-util.h | 3 ++- src/shared/discover-image.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shared/btrfs-util.c b/src/shared/btrfs-util.c index 869eb490f8e..349a1691071 100644 --- a/src/shared/btrfs-util.c +++ b/src/shared/btrfs-util.c @@ -323,6 +323,7 @@ int btrfs_subvol_get_info_fd(int fd, uint64_t subvol_id, BtrfsSubvolInfo *ret) { *ret = (BtrfsSubvolInfo) { .subvol_id = info.treeid, .otime = info.otime.sec * USEC_PER_SEC + (info.otime.nsec / NSEC_PER_USEC), + .ctime = info.ctime.sec * USEC_PER_SEC + (info.ctime.nsec / NSEC_PER_USEC), .read_only = FLAGS_SET(info.flags, BTRFS_SUBVOL_RDONLY), }; diff --git a/src/shared/btrfs-util.h b/src/shared/btrfs-util.h index 63fc1d0b32d..d002618bd80 100644 --- a/src/shared/btrfs-util.h +++ b/src/shared/btrfs-util.h @@ -8,7 +8,8 @@ typedef struct BtrfsSubvolInfo { uint64_t subvol_id; - usec_t otime; + usec_t otime; /* creation time */ + usec_t ctime; /* change time */ sd_id128_t uuid; sd_id128_t parent_uuid; diff --git a/src/shared/discover-image.c b/src/shared/discover-image.c index d39c3a13563..58777c683b2 100644 --- a/src/shared/discover-image.c +++ b/src/shared/discover-image.c @@ -430,7 +430,7 @@ static int image_make( filename, info.read_only || read_only, info.otime, - 0, + info.ctime, ret); if (r < 0) return r; -- 2.47.3