Skip to content

Set creation/change time (otime/ctime) for offline-created subvolumes and convertd root subvolume - #1157

Open
koraynilay wants to merge 2 commits into
kdave:develfrom
koraynilay:convert-creation-time
Open

Set creation/change time (otime/ctime) for offline-created subvolumes and convertd root subvolume#1157
koraynilay wants to merge 2 commits into
kdave:develfrom
koraynilay:convert-creation-time

Conversation

@koraynilay

@koraynilay koraynilay commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Fix subvol->otime and subvol->ctime not being set on:

  • the root subvolume of a btrfs-convertd filesystem
  • subvolumes created by mkfs.btrfs using --rootdir and --subvol options
  • (less important) the ext2_saved subvolume of a btrfs-convert'd filesystem

Thanks

…subvol

Before this, btrfs-convert would leave the root subvol of the converted
fs with 0 as both otime and ctime, showing "-" when using
btrfs subvolume show /path.

This patch uses the code from mkfs.btrfs's btrfs_create_tree_root() to
set the otime/ctime to the root subvol and generate its UUID right away
(instead of having to wait for btrfs_rebuild_uuid_tree(), not
necessarily needed but cleaner).

This way the timestamp of the filesystem conversion will be available in
the "Creation time" field of btrfs subvolume show /path output, while
the original ext* "Filesystem created" timestamp is available with stat
as the mountpoint's birth time.

Assisted-by: Claude:opus-4.6 antigravity-cli-1.1.7
Assisted-by: Gemini:3.1-pro antigravity-cli-1.1.7
Signed-off-by: koraynilay <koray.fra@gmail.com>
…d subvolumes

Update common/root-tree-utils.c's btrfs_make_subvolume() to also
generate a UUID and set otime and ctime of subvolumes created offline
(if it's a normal subvolume).

This is essentially the same change as commit 0cdfd08
("btrfs-progs: convert: set creation/change time (otime/ctime) of root
subvol") but that applies to:
* mkfs.btrfs' --rootdir and --subvol options
* btrfs-convert's ext2_saved subvolume

Assisted-by: Gemini:3.1-pro antigravity-cli-1.1.7
Signed-off-by: koraynilay <koray.fra@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant