All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RAID: Make RAID 4/5/6 display sync status under heading s/Copy%/Cpy%Sync
@ 2012-10-11 16:58 Jonathan Brassow
  2012-10-12  6:55 ` Zdenek Kabelac
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Brassow @ 2012-10-11 16:58 UTC (permalink / raw)
  To: lvm-devel

RAID: Make RAID 4/5/6 display sync status under heading s/Copy%/Cpy%Sync

The heading 'Copy%' is specific to PVMOVE volumes, but can be generalized
to apply to LVM mirrors also.  It is a bit awkward to use 'Copy%' for
RAID 4/5/6, however - 'Sync%' would be more appropriate.  This is why
RAID 4/5/6 have not displayed their sync status by any means available to
'lvs' yet.

Example (old):
[root at hayes-02 lvm2]# lvs vg
  LV      VG   Attr      LSize  Pool Origin Data%  Move Log Cpy%Sy Convert
  lv    vg   -wi-a----  1.00g
  raid1 vg   rwi-a-r--  1.00g                             100.00
  raid4 vg   rwi-a-r--  1.01g
  raid5 vg   rwi-a-r--  1.01g
  raid6 vg   rwi-a-r--  1.01g

This patch changes the heading to 'Cpy%Sync' and allows RAID 4/5/6 to print
their sync percent in this field.

Example (new):
[root at hayes-02 lvm2]# lvs vg
  LV    VG   Attr      LSize Pool Origin Data%  Move Log Cpy%Sync Convert
  lv    vg   -wi-a---- 1.00g                                             
  raid1 vg   rwi-a-r-- 1.00g                               100.00        
  raid4 vg   rwi-a-r-- 1.01g                               100.00        
  raid5 vg   rwi-a-r-- 1.01g                               100.00        
  raid6 vg   rwi-a-r-- 1.01g                               100.00        

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>

Index: lvm2/lib/report/columns.h
===================================================================
--- lvm2.orig/lib/report/columns.h
+++ lvm2/lib/report/columns.h
@@ -78,7 +78,7 @@ FIELD(LVS, lv, NUM, "OSize", lvid, 5, or
 FIELD(LVS, lv, NUM, "Data%", lvid, 6, datapercent, data_percent, "For snapshot and thin pools and volumes, the percentage full if LV is active.", 0)
 FIELD(LVS, lv, NUM, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0)
 FIELD(LVS, lv, NUM, "Meta%", lvid, 6, metadatapercent, metadata_percent, "For thin pools, the percentage of metadata full if LV is active.", 0)
-FIELD(LVS, lv, NUM, "Copy%", lvid, 6, copypercent, copy_percent, "For mirrors and pvmove, current percentage in-sync.", 0)
+FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, copy_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0)
 FIELD(LVS, lv, STR, "Move", lvid, 4, movepv, move_pv, "For pvmove, Source PV of temporary LV created by pvmove.", 0)
 FIELD(LVS, lv, STR, "Convert", lvid, 7, convertlv, convert_lv, "For lvconvert, Name of temporary LV created by lvconvert.", 0)
 FIELD(LVS, lv, STR, "Log", lvid, 3, loglv, mirror_log, "For mirrors, the LV holding the synchronisation log.", 0)
Index: lvm2/lib/report/report.c
===================================================================
--- lvm2.orig/lib/report/report.c
+++ lvm2/lib/report/report.c
@@ -899,13 +899,14 @@ static int _copypercent_disp(struct dm_r
 		return 0;
 	}
 
-	if ((!(lv->status & PVMOVE) && !(lv->status & MIRRORED)) ||
-	    !lv_mirror_percent(lv->vg->cmd, lv, 0, &percent,
-			       NULL) || (percent == PERCENT_INVALID)) {
-		*sortval = UINT64_C(0);
-		dm_report_field_set_value(field, "", sortval);
-		return 1;
-	}
+	if (seg_is_raid(first_seg(lv))) {
+		if (!lv_raid_percent(lv, &percent) ||
+		    (percent == PERCENT_INVALID))
+			goto no_copypercent;
+	} else if ((!(lv->status & PVMOVE) && !(lv->status & MIRRORED)) ||
+		   !lv_mirror_percent(lv->vg->cmd, lv, 0, &percent, NULL) ||
+		   (percent == PERCENT_INVALID))
+		goto no_copypercent;
 
 	percent = copy_percent(lv);
 
@@ -923,6 +924,11 @@ static int _copypercent_disp(struct dm_r
 	dm_report_field_set_value(field, repstr, sortval);
 
 	return 1;
+
+no_copypercent:
+	*sortval = UINT64_C(0);
+	dm_report_field_set_value(field, "", sortval);
+	return 1;
 }
 
 static int _dtpercent_disp(int metadata, struct dm_report *rh,




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] RAID: Make RAID 4/5/6 display sync status under heading s/Copy%/Cpy%Sync
  2012-10-11 16:58 [PATCH] RAID: Make RAID 4/5/6 display sync status under heading s/Copy%/Cpy%Sync Jonathan Brassow
@ 2012-10-12  6:55 ` Zdenek Kabelac
  2012-10-12 16:11   ` Brassow Jonathan
  0 siblings, 1 reply; 3+ messages in thread
From: Zdenek Kabelac @ 2012-10-12  6:55 UTC (permalink / raw)
  To: lvm-devel

Dne 11.10.2012 18:58, Jonathan Brassow napsal(a):
> RAID: Make RAID 4/5/6 display sync status under heading s/Copy%/Cpy%Sync
>
> The heading 'Copy%' is specific to PVMOVE volumes, but can be generalized
> to apply to LVM mirrors also.  It is a bit awkward to use 'Copy%' for
> RAID 4/5/6, however - 'Sync%' would be more appropriate.  This is why
> RAID 4/5/6 have not displayed their sync status by any means available to
> 'lvs' yet.
>
> Example (old):
> [root at hayes-02 lvm2]# lvs vg
>    LV      VG   Attr      LSize  Pool Origin Data%  Move Log Cpy%Sy Convert
>    lv    vg   -wi-a----  1.00g
>    raid1 vg   rwi-a-r--  1.00g                             100.00
>    raid4 vg   rwi-a-r--  1.01g
>    raid5 vg   rwi-a-r--  1.01g
>    raid6 vg   rwi-a-r--  1.01g
>
> This patch changes the heading to 'Cpy%Sync' and allows RAID 4/5/6 to print
> their sync percent in this field.
>
> Example (new):
> [root at hayes-02 lvm2]# lvs vg
>    LV    VG   Attr      LSize Pool Origin Data%  Move Log Cpy%Sync Convert
>    lv    vg   -wi-a---- 1.00g
>    raid1 vg   rwi-a-r-- 1.00g                               100.00
>    raid4 vg   rwi-a-r-- 1.01g                               100.00
>    raid5 vg   rwi-a-r-- 1.01g                               100.00
>    raid6 vg   rwi-a-r-- 1.01g                               100.00
>
> Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
>
> Index: lvm2/lib/report/columns.h
> ===================================================================
> --- lvm2.orig/lib/report/columns.h
> +++ lvm2/lib/report/columns.h
> @@ -78,7 +78,7 @@ FIELD(LVS, lv, NUM, "OSize", lvid, 5, or
>   FIELD(LVS, lv, NUM, "Data%", lvid, 6, datapercent, data_percent, "For snapshot and thin pools and volumes, the percentage full if LV is active.", 0)
>   FIELD(LVS, lv, NUM, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0)
>   FIELD(LVS, lv, NUM, "Meta%", lvid, 6, metadatapercent, metadata_percent, "For thin pools, the percentage of metadata full if LV is active.", 0)
> -FIELD(LVS, lv, NUM, "Copy%", lvid, 6, copypercent, copy_percent, "For mirrors and pvmove, current percentage in-sync.", 0)
> +FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, copy_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0)


Just add new one if needed - and keep the old one available for users (staying 
backward compatible)

You may update default columns written by lvs command and change Copy% field 
to something else.

Though IMHO   Copy%  looks better then Cpy%Sync...


Zdenek




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] RAID: Make RAID 4/5/6 display sync status under heading s/Copy%/Cpy%Sync
  2012-10-12  6:55 ` Zdenek Kabelac
@ 2012-10-12 16:11   ` Brassow Jonathan
  0 siblings, 0 replies; 3+ messages in thread
From: Brassow Jonathan @ 2012-10-12 16:11 UTC (permalink / raw)
  To: lvm-devel


On Oct 12, 2012, at 1:55 AM, Zdenek Kabelac wrote:

> Dne 11.10.2012 18:58, Jonathan Brassow napsal(a):
>> RAID: Make RAID 4/5/6 display sync status under heading s/Copy%/Cpy%Sync
>> 
>> The heading 'Copy%' is specific to PVMOVE volumes, but can be generalized
>> to apply to LVM mirrors also.  It is a bit awkward to use 'Copy%' for
>> RAID 4/5/6, however - 'Sync%' would be more appropriate.  This is why
>> RAID 4/5/6 have not displayed their sync status by any means available to
>> 'lvs' yet.
>> 
>> Example (old):
>> [root at hayes-02 lvm2]# lvs vg
>>   LV      VG   Attr      LSize  Pool Origin Data%  Move Log Cpy%Sy Convert
>>   lv    vg   -wi-a----  1.00g
>>   raid1 vg   rwi-a-r--  1.00g                             100.00
>>   raid4 vg   rwi-a-r--  1.01g
>>   raid5 vg   rwi-a-r--  1.01g
>>   raid6 vg   rwi-a-r--  1.01g
>> 
>> This patch changes the heading to 'Cpy%Sync' and allows RAID 4/5/6 to print
>> their sync percent in this field.
>> 
>> Example (new):
>> [root at hayes-02 lvm2]# lvs vg
>>   LV    VG   Attr      LSize Pool Origin Data%  Move Log Cpy%Sync Convert
>>   lv    vg   -wi-a---- 1.00g
>>   raid1 vg   rwi-a-r-- 1.00g                               100.00
>>   raid4 vg   rwi-a-r-- 1.01g                               100.00
>>   raid5 vg   rwi-a-r-- 1.01g                               100.00
>>   raid6 vg   rwi-a-r-- 1.01g                               100.00
>> 
>> Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
>> 
>> Index: lvm2/lib/report/columns.h
>> ===================================================================
>> --- lvm2.orig/lib/report/columns.h
>> +++ lvm2/lib/report/columns.h
>> @@ -78,7 +78,7 @@ FIELD(LVS, lv, NUM, "OSize", lvid, 5, or
>>  FIELD(LVS, lv, NUM, "Data%", lvid, 6, datapercent, data_percent, "For snapshot and thin pools and volumes, the percentage full if LV is active.", 0)
>>  FIELD(LVS, lv, NUM, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0)
>>  FIELD(LVS, lv, NUM, "Meta%", lvid, 6, metadatapercent, metadata_percent, "For thin pools, the percentage of metadata full if LV is active.", 0)
>> -FIELD(LVS, lv, NUM, "Copy%", lvid, 6, copypercent, copy_percent, "For mirrors and pvmove, current percentage in-sync.", 0)
>> +FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, copy_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0)
> 
> 
> Just add new one if needed - and keep the old one available for users (staying backward compatible)
> 
> You may update default columns written by lvs command and change Copy% field to something else.
> 
> Though IMHO   Copy%  looks better then Cpy%Sync...

i had similar thoughts about whether or not to just create a new field.  I've been over this with agk and this is how I arrived at the patch above.

 brassow



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-12 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-11 16:58 [PATCH] RAID: Make RAID 4/5/6 display sync status under heading s/Copy%/Cpy%Sync Jonathan Brassow
2012-10-12  6:55 ` Zdenek Kabelac
2012-10-12 16:11   ` Brassow Jonathan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.