btrfs-progs: mkfs: print type of subvolume in the listing

Print indicators in the summary if the subvolume is read-write,
read-only or default:

$ mkfs.btrfs --subvol ro:subvolro --subvol rw:subvolrw --subvol default-ro:defaultro --rootdir /rootdir/path img
...
Rootdir from:       /rootdir/path
  Compress:         no
  Subvolume (rw):   subvolrw
  Subvolume (ro):   subvolro
  Subvolume (dro):  defaultro
...

The path is relative to the rootdir path and may not be a subvolume in
the source directory so drop the rootdir as this may be confusing.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2025-02-11 06:12:38 +01:00
parent 6a5e20ebde
commit 4bfcadabdf

View File

@ -2078,8 +2078,11 @@ raid_groups:
/* Print subvolumes now as btrfs_mkfs_fill_dir() deletes the list. */
list_for_each_entry(rds, &subvols, list) {
pr_verbose(LOG_DEFAULT, " Subvolume: %s\n",
rds->full_path);
pr_verbose(LOG_DEFAULT, " Subvolume (%s%s): %s%s\n",
rds->is_default ? "d" : "",
rds->readonly ? "ro" : "rw",
rds->is_default ? "" : " ",
rds->dir);
}
ret = btrfs_mkfs_fill_dir(trans, source_dir, root,