Re: [PATCH v8 08/11] btrfs: add raid stripe tree pretty printer

From: Johannes Thumshirn
Date: Wed Sep 13 2023 - 01:34:24 EST


On 12.09.23 22:42, David Sterba wrote:
>> +struct raid_encoding_map {
>> + u8 encoding;
>> + char name[16];
>> +};
>> +
>> +static const struct raid_encoding_map raid_map[] = {
>> + { BTRFS_STRIPE_DUP, "DUP" },
>> + { BTRFS_STRIPE_RAID0, "RAID0" },
>> + { BTRFS_STRIPE_RAID1, "RAID1" },
>> + { BTRFS_STRIPE_RAID1C3, "RAID1C3" },
>> + { BTRFS_STRIPE_RAID1C4, "RAID1C4" },
>> + { BTRFS_STRIPE_RAID5, "RAID5" },
>> + { BTRFS_STRIPE_RAID6, "RAID6" },
>> + { BTRFS_STRIPE_RAID10, "RAID10" }
>> +};
>
> Instead of another table tranlating constants to raid names, can you
> somehow utilize the btrfs_raid_array table? If the STRIPE values match
> the RAID (the indexes to the table) you could add a simple wrapper.

Sure.