btrfs: comment about fsid and metadata_uuid relationship
authorAnand Jain <anand.jain@oracle.com>
Wed, 6 Sep 2023 16:16:41 +0000 (00:16 +0800)
committerDavid Sterba <dsterba@suse.com>
Thu, 12 Oct 2023 14:44:04 +0000 (16:44 +0200)
Add a comment explaining the relationship between fsid and metadata_uuid
in the on-disk superblock and the in-memory struct btrfs_fs_devices.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.h

index 2128a032c3b74d5baa3784fefaf4f1bea6806496..576bfcb5b76486a62950843c373ad127feaa3d93 100644 (file)
@@ -290,6 +290,15 @@ struct btrfs_fs_devices {
         * - Following shall be true at all times:
         *   - metadata_uuid == btrfs_header::fsid
         *   - metadata_uuid == btrfs_dev_item::fsid
+        *
+        * - Relations between fsid and metadata_uuid in sb and fs_devices:
+        *   - Normal:
+        *       fs_devices->fsid == fs_devices->metadata_uuid == sb->fsid
+        *       sb->metadata_uuid == 0
+        *
+        *   - When the BTRFS_FEATURE_INCOMPAT_METADATA_UUID flag is set:
+        *       fs_devices->fsid == sb->fsid
+        *       fs_devices->metadata_uuid == sb->metadata_uuid
         */
        u8 metadata_uuid[BTRFS_FSID_SIZE];