]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm: Change displaying of devices in --detail
authorAnna Sztukowska <anna.sztukowska@intel.com>
Wed, 28 Aug 2024 10:04:35 +0000 (12:04 +0200)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Fri, 30 Aug 2024 09:15:06 +0000 (11:15 +0200)
The counts of active, working, failed and spare devices were not
printed when the number was zero.

Refactor the code to always display the counts of all device types,
regardless of their number. This way, it is more reliable for users.

Signed-off-by: Anna Sztukowska <anna.sztukowska@intel.com>
Detail.c

index f8b9e8479cce268082aa395f4cfa82d81b703dfa..331e1da300acf7cf1f6c27dfa0c6cbbac7ea6224 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -549,16 +549,10 @@ int Detail(char *dev, struct context *c)
                } else if (inactive && !is_container) {
                        printf("             State : inactive\n");
                }
-               if (array.raid_disks)
-                       printf("    Active Devices : %d\n", array.active_disks);
-               if (array.working_disks > 0)
-                       printf("   Working Devices : %d\n",
-                              array.working_disks);
-               if (array.raid_disks) {
-                       printf("    Failed Devices : %d\n", array.failed_disks);
-                       if (!external)
-                               printf("     Spare Devices : %d\n", array.spare_disks);
-               }
+               printf("    Active Devices : %d\n", array.active_disks);
+               printf("   Working Devices : %d\n", array.working_disks);
+               printf("    Failed Devices : %d\n", array.failed_disks);
+               printf("     Spare Devices : %d\n", array.spare_disks);
                printf("\n");
                if (array.level == 5) {
                        str = map_num(r5layout, array.layout);