Skip to contentSkip to conversation

mdadm --detail was incorrect for shrinking reshapes

PATCH In review Andrew Burgess 2 participants 2 messages Jun 20, 2011 – Jun 23, 2011 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mdadm --detail was incorrect for shrinking reshapes

Since info->delta_disks is signed it doesn't need to be special-cased.

This allowed my 9->8 reshape to display correctly instead of as 8->7

(the "This is pretty boring" context is apparently the universe's opinion of my first patch!)

mdadm> git diff

Detail.c +0 -0
index 375189d..40806cf 100644
@@ -430,12 +430,9 @@ This is pretty boring
 			printf("  Reshape pos'n : %llu%s\n", (unsigned  

long long) info->reshape_progress<<9,
human_size((unsigned long
long)info->reshape_progress<<9));
#endif
- if (info->delta_disks > 0)
+ if (info->delta_disks != 0)
printf(" Delta Devices : %d,
(%d->%d)\n",
info->delta_disks,
array.raid_disks - info->delta_disks, array.raid_disks);
- if (info->delta_disks < 0)
- printf(" Delta Devices : %d, (%d->%d)\n",
- info->delta_disks, array.raid_disks, array.raid_disks + info->delta_disks);
if (info->new_level != array.level) {
char *c = map_num(pers,
info->new_level);
printf(" New Level : %s\n",
c?c:"-unknown-");

#1 lore raw
Quoted 31 lines · On Mon, 20 Jun 2011 09:06:55 -0700 Andrew Burgess <[email protected]> wrote:

Since info->delta_disks is signed it doesn't need to be special-cased.

This allowed my 9->8 reshape to display correctly instead of as 8->7

(the "This is pretty boring" context is apparently the universe's opinion of my first patch!)

mdadm> git diff

Detail.c +1 -1
index 375189d..40806cf 100644
@@ -430,12 +430,9 @@ This is pretty boring
  			printf("  Reshape pos'n : %llu%s\n", (unsigned  
 long long) info->reshape_progress<<9,
  			       human_size((unsigned long  
 long)info->reshape_progress<<9));
  #endif
-			if (info->delta_disks > 0)
+			if (info->delta_disks != 0)
  				printf("  Delta Devices : %d,  
 (%d->%d)\n",
  				       info->delta_disks,  

array.raid_disks - info->delta_disks, array.raid_disks);

Detail.c +0 -2
-			if (info->delta_disks < 0)
-				printf("  Delta Devices : %d,  

(%d->%d)\n",

Detail.c +0 -1
-				       info->delta_disks,  

array.raid_disks, array.raid_disks + info->delta_disks);
if (info->new_level != array.level) {

Quoted 8 lines

char *c = map_num(pers,
info->new_level);
printf(" New Level : %s\n",
c?c:"-unknown-");
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Thanks.

BTW "format=flowed" doesn't really work for patches.. Fortunately it was small enough that I could just apply it by hand.

I had originally planned that "raid_disk" should always be the maximum of the "before" and "after" number of devices in the array - so that it needed exactly "raid_disks" devices to be non-degraded etc. It seems that didn't really work out but I never fixed this code to reflect reality.

Thanks for the patch, it is applied now.

NeilBrown