Skip to contentSkip to conversation

pvmove

linux-lvm Martin Papik 3 participants 9 messages Jul 19, 2013 – Sep 23, 2013

lore
Share & tools
lore
#0 lore raw

Hi everyone

I'm new to the mailing list but not to LVM, until now everything was crystal clear and working fine. Now I'm either stuck or found a minor issue. I'm trying to move move extents on a physical volume. Not from one physical volume to another.

root@myhost# pvmove  /dev/md127:151808-152063 /dev/md127:152064-152319
  No extents available for allocation
root@myhost#

I also tried pvmove /dev/md127:151808-152063 /dev/md127:152064 and a few other combination. There are enough free extents. The volume I've created is 1G. There's 800 GB free. I made sure the destination blocks are available, I've tried different ranges. Way below is the output of vgdisplay and a list of volumes and their extents.

Is this functionality (extent shuffling) supported? I mean is this a feature, bug or ignorance on my part?

PS, if you're wondering why would anyone want to move extents from a device to the very same device, you may notice in the output below that I have a few volumes spilt into pieces and I want to de-fragment it. I know it won't affect performance too much, probably at all. But it is going to help when (if?) I'm in dire need of dd if=/dev/xxx from the physical volume. Wouldn't be the first time (not the fault of LVM, disk+heat=bad blocks).

Thanks in advance for any ideas or scolding :-)

Martin

root@myhost# vgdisplay
  --- Volume group ---
  VG Name               volume
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  147
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                12
  Open LV               9
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               3.35 TiB
  PE Size               4.00 MiB
  Total PE              878905
  Alloc PE / Size       666880 / 2.54 TiB
  Free  PE / Size       212025 / 828.22 GiB
  VG UUID Gv2rC8-sMgQ-xGGK-5swv-9Gck-QA1G-k50ABy
root@myhost# vgs --all -o +lv_name,lv_size,snap_percent,seg_pe_ranges,segtype,seg_size
  VG     #PV #LV #SN Attr   VSize VFree   LV      LSize Snap%  PE 
Ranges                Type   SSize
  volume   1  12   0 wz--n- 3.35t 828.22g home 150.00g        
/dev/md127:0-25599       linear 100.00g
  volume   1  12   0 wz--n- 3.35t 828.22g home 150.00g        
/dev/md127:72085-74495   linear   9.42g
  volume   1  12   0 wz--n- 3.35t 828.22g home 150.00g        
/dev/md127:309248-319636 linear  40.58g
  volume   1  12   0 wz--n- 3.35t 828.22g var 20.00g        
/dev/md127:25600-30719   linear  20.00g
  volume   1  12   0 wz--n- 3.35t 828.22g usr 20.00g        
/dev/md127:30720-35839   linear  20.00g
  volume   1  12   0 wz--n- 3.35t 828.22g tmp 2.00g        
/dev/md127:35840-36351   linear   2.00g
  volume   1  12   0 wz--n- 3.35t 828.22g p2p 300.00g        
/dev/md127:74496-151295  linear 300.00g
  volume   1  12   0 wz--n- 3.35t 828.22g boot 1.00g        
/dev/md127:151296-151551 linear   1.00g
  volume   1  12   0 wz--n- 3.35t 828.22g root 4.00g        
/dev/md127:152320-153343 linear   4.00g
  volume   1  12   0 wz--n- 3.35t 828.22g copy 2.00t        
/dev/md127:181248-309247 linear 500.00g
  volume   1  12   0 wz--n- 3.35t 828.22g copy 2.00t        
/dev/md127:606208-712298 linear 414.42g
  volume   1  12   0 wz--n- 3.35t 828.22g copy 2.00t        
/dev/md127:156672-181247 linear  96.00g
  volume   1  12   0 wz--n- 3.35t 828.22g copy 2.00t        
/dev/md127:36352-72084   linear 139.58g
  volume   1  12   0 wz--n- 3.35t 828.22g copy 2.00t        
/dev/md127:319637-549524 linear 898.00g
  volume   1  12   0 wz--n- 3.35t 828.22g swap 8.00g        
/dev/md127:153344-155391 linear   8.00g
  volume   1  12   0 wz--n- 3.35t 828.22g emulate 50.00g        
/dev/md127:549525-562324 linear  50.00g
  volume   1  12   0 wz--n- 3.35t 828.22g test 1.00g        
/dev/md127:151552-151807 linear   1.00g
  volume   1  12   0 wz--n- 3.35t 828.22g test2 1.00g        
/dev/md127:151808-152063 linear   1.00g
root@myhost#
#1 lore raw

Dne 19.7.2013 20:14, Martin Papik napsal(a):

Quoted 10 lines

Hi everyone

I'm new to the mailing list but not to LVM, until now everything was crystal clear and working fine. Now I'm either stuck or found a minor issue. I'm trying to move move extents on a physical volume. Not from one physical volume to another.

root@myhost# pvmove  /dev/md127:151808-152063 /dev/md127:152064-152319
   No extents available for allocation
root@myhost#

Add --alloc anywhere

But I assume the tool could be a bit more smarter here. It looks more or less like a bug to me.

Zdenek

#2 lore raw

Dear Zdenek

Thank you very much, it works. I noticed a few more things. Not errors, just minor things that might be documented better or handled differently. Depending on the design philosophy.

"pvmove /dev/md127:152064-152319 /dev/md127:800000 --alloc anywhere" fails because /dev/md127:xx seems to be interpreted as "one extent starting at xx", I'm not sure that's what I'd guess from the man page.

"pvmove /dev/md127:152064-152319 /dev/md127:800000- --alloc anywhere" works, but the manual page indicates that the syntax is DestinationPhysicalVolume[:PE[-PE]...], which I would interpret as /dev/xx:111 OR /dev/xx:111-222, but not /dev/xx:111-, that would IMHO be DestinationPhysicalVolume[:PE[-[PE]]...].

I'd interpret /dev/md126:100 as a start of an area, since it has no explicit bound, where as /dev/md127:100-100 I would expect for a single extent, since there is an explicit bound. Does that make sense?

PS, how about a syntax variant where it can be /dev/md127:100+30 meaning 30 extents starting at 100? I understand it's often better to print ranges, but maybe in some cases start+length might work better. Or start-end+length for printing, and start[-end][+length] as input, and exit with error if both end and length are specified and they don't match (start+length!=length).

I'm not complaining, just suggesting enhancements. :-)

Again, thank you very much for your quick and helpful response.

Martin

Quoted 19 lines · Zdenek Kabelac

Dne 19.7.2013 20:14, Martin Papik napsal(a):

Quoted 10 lines

Hi everyone

I'm new to the mailing list but not to LVM, until now everything was crystal clear and working fine. Now I'm either stuck or found a minor issue. I'm trying to move move extents on a physical volume. Not from one physical volume to another.

root@myhost# pvmove  /dev/md127:151808-152063 /dev/md127:152064-152319
   No extents available for allocation
root@myhost#

Add --alloc anywhere

But I assume the tool could be a bit more smarter here. It looks more or less like a bug to me.

Zdenek

#3 lore raw

It uses lists of ranges separated by colons.

:x-y

If x is missing, 0 is inserted; if y is missing, the last extent on the device is inserted.

Man pages can always be improved with more examples!

For +length, try the patch below.

Alasdair

tools/toollib.c +10 -1
@@ -1001,7 +1001,7 @@ static int _parse_pes(struct dm_pool *mem, char *c, struct dm_list *pe_ranges,
 		      const char *pvname, uint32_t size)
 {
 	char *endptr;
-	uint32_t start, end;
+	uint32_t start, end, len;
 
 	/* Default to whole PV */
 	if (!c) {
@@ -1041,7 +1041,16 @@ static int _parse_pes(struct dm_pool *mem, char *c, struct dm_list *pe_ranges,
 					goto error;
 				c = endptr;
 			}
+		} else if (*c == '+') {	/* Length? */
+			c++;
+			if (isdigit(*c)) {
+				if (!xstrtouint32(c, &endptr, 10, &len))
+					goto error;
+				c = endptr;
+				end = start + (len ? (len - 1) : 0);
+			}
 		}
+
 		if (*c && *c != ':')
 			goto error;
 
#4 lore raw

Thank you. Is that patch going to be added to the main source code base?

I think I found an error (segfault), see below.

==> I have a few more improvement suggestions.

* IMHO vgs/lvs should include a column called seg_size_pe, similar to seg_start and seg_start_pe
* IMHO vgs/lvs/pvs should have an command line parameter, or option modifier allowing to not display empty columns, i.e. the following command might skip displaying origin, snap%, move, log, copy%, convert, because they have no values. That would allow me to show copy_percent column only when copy is in progress. Would be nice.

lvs --all -o +vg_extent_size

  LV      VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert Ext
  boot    volume -wi-ao 1.00g                                       4.00m
  copy    volume -wi-ao 2.00t                                       4.00m
  emulate volume -wi-ao 50.00g                                       4.00m
  home    volume -wi-ao 150.00g                                       4.00m
  p2p     volume -wi-a- 300.00g                                       4.00m
  root    volume -wi-ao 4.00g                                       4.00m
  swap    volume -wi-ao 8.00g                                       4.00m
  tmp     volume -wi-ao 2.00g                                       4.00m
  usr     volume -wi-ao 20.00g                                       4.00m
  var     volume -wi-ao 20.00g                                       4.00m

Possible error:

root@localhost# lvs --rows --align
Does not align, should it?

*==> SEGFAULT INFO*

root@localhost# pvs --all -o +vg_fmt
Segmentation fault (core dumped)

However the following seems to work.....

root@localhost# pvs --all -o +vg_name
  PV         VG     Fmt  Attr PSize PFree VG
  /dev/dm-0              --      0     0
  --- some entries removed for brevity ----
  /dev/md127 volume lvm2 a-   5.46t 2.77t volume
  --- some entries removed for brevity ----
  /dev/sde1              --      0     0

Additional information that might help.

root@localhost# pvs --version
  LVM version:     2.02.66(2) (2010-05-20)
  Library version: 1.02.48 (2010-05-20)
  Driver version:  4.22.0
root@localhost# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"

root@localhost#valgrind pvs --all -o +vg_fmt
==14584== Memcheck, a memory error detector
==14584== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==14584== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==14584== Command: pvs --all -o +vg_fmt
==14584==
==14584== Invalid read of size 8

==14584==    at 0x548ED77: dm_report_field_string (in /lib/libdevmapper.so.1.02.1)
==14584==    by 0x549006F: dm_report_object (in /lib/libdevmapper.so.1.02.1)
==14584==    by 0x46B138: report_object (in /sbin/lvm)
==14584==    by 0x423618: ??? (in /sbin/lvm)
==14584==    by 0x4254B2: process_each_pv (in /sbin/lvm)
==14584==    by 0x4230D3: ??? (in /sbin/lvm)
==14584==    by 0x41AE60: lvm_run_command (in /sbin/lvm)
==14584==    by 0x41B307: lvm2_main (in /sbin/lvm)
==14584==    by 0x58CE76C: (below main) (libc-start.c:226)

==14584== Address 0x28 is not stack'd, malloc'd or (recently) free'd ==14584==
==14584==
==14584== Process terminating with default action of signal 11 (SIGSEGV) ==14584== Access not within mapped region at address 0x28

==14584==    at 0x548ED77: dm_report_field_string (in /lib/libdevmapper.so.1.02.1)
==14584==    by 0x549006F: dm_report_object (in /lib/libdevmapper.so.1.02.1)
==14584==    by 0x46B138: report_object (in /sbin/lvm)
==14584==    by 0x423618: ??? (in /sbin/lvm)
==14584==    by 0x4254B2: process_each_pv (in /sbin/lvm)
==14584==    by 0x4230D3: ??? (in /sbin/lvm)
==14584==    by 0x41AE60: lvm_run_command (in /sbin/lvm)
==14584==    by 0x41B307: lvm2_main (in /sbin/lvm)
==14584==    by 0x58CE76C: (below main) (libc-start.c:226)
==14584==  If you believe this happened as a result of a stack
==14584==  overflow in your program's main thread (unlikely but
==14584==  possible), you can try to increase the size of the
==14584==  main thread stack using the --main-stacksize= flag.
==14584==  The main thread stack size used in this run was 8388608.

==14584==

root@localhost# ltrace pvs --all -o +vg_fmt 2>&1 | tail
__ctype_toupper_loc()                            = 0x7f2f0e83f768
__ctype_toupper_loc()                            = 0x7f2f0e83f768
__ctype_toupper_loc()                            = 0x7f2f0e83f768
__sprintf_chk(0x1e86e88, 1, -1, 0x48daa5, 0x48dab8) = 2
dm_pool_strdup(0x1e88120, 0x1e86e88, 0x1e86e8a, 0, 0x48daa8) = 0x1e8e538
dm_pool_alloc(0x1e88120, 8, 2, 0x7f2f0d892030, 0x48daa8) = 0x1e8e540
dm_report_field_set_value(0x1e8e508, 0x1e8e538, 0x1e8e540, 0x7f2f0d892030, 0x48daa8) = 0x1e8e540
dm_report_field_string(0x1e88080, 0x1e8e550, 40, 0x6b1fe0, 0x1e6cfe0 <unfinished ...>
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++
root@localhost#
root@localhost# gdb --args pvs --all -o +vg_fmt
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /sbin/pvs...(no debugging symbols found)...done.
(gdb) run
Starting program: /sbin/pvs --all -o +vg_fmt
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
File descriptor 3 (socket:[46992174]) leaked on pvs invocation. Parent PID 14623: gdb
File descriptor 4 (socket:[46992175]) leaked on pvs invocation. Parent PID 14623: gdb
File descriptor 5 (pipe:[46992176]) leaked on pvs invocation. Parent PID 14623: gdb
File descriptor 6 (pipe:[46992176]) leaked on pvs invocation. Parent PID 14623: gdb

Program received signal SIGSEGV, Segmentation fault. 0x00007ffff757dd77 in dm_report_field_string () from /lib/libdevmapper.so.1.02.1 (gdb) disassemble dm_report_field_string
Dump of assembler code for function dm_report_field_string:

   0x00007ffff757dd70 <+0>:    push   %rbx
   0x00007ffff757dd71 <+1>:    mov    %rsi,%rbx
   0x00007ffff757dd74 <+4>:    mov    (%rdi),%rdi
=> 0x00007ffff757dd77 <+7>:    mov (%rdx),%rsi
   0x00007ffff757dd7a <+10>:    callq 0x7ffff7570a30 <dm_pool_strdup@plt>
   0x00007ffff757dd7f <+15>:    test   %rax,%rax
(gdb) info registers
rax            0x6dd550    7198032
rbx            0x6dd550    7198032
rcx            0x6b1fe0    7020512
rdx            0x28    40
rsi            0x6dd550    7198032
rdi            0x6d7120    7172384
rbp            0x6d7080    0x6d7080
Quoted 42 lines · Alasdair G Kergon

It uses lists of ranges separated by colons.

   :x-y

If x is missing, 0 is inserted; if y is missing, the last extent on the device is inserted.

Man pages can always be improved with more examples!

For +length, try the patch below.

Alasdair

tools/toollib.c +10 -1
@@ -1001,7 +1001,7 @@ static int _parse_pes(struct dm_pool *mem, char *c, struct dm_list *pe_ranges,
  		      const char *pvname, uint32_t size)
  {
  	char *endptr;
-	uint32_t start, end;
+	uint32_t start, end, len;
 
  	/* Default to whole PV */
  	if (!c) {
@@ -1041,7 +1041,16 @@ static int _parse_pes(struct dm_pool *mem, char *c, struct dm_list *pe_ranges,
  					goto error;
  				c = endptr;
  			}
+		} else if (*c == '+') {	/* Length? */
+			c++;
+			if (isdigit(*c)) {
+				if (!xstrtouint32(c, &endptr, 10, &len))
+					goto error;
+				c = endptr;
+				end = start + (len ? (len - 1) : 0);
+			}
  		}
+
  		if (*c && *c != ':')
  			goto error;
 
#5 lore raw

Re: [linux-lvm] pvmove ==> segfault: pvs --all -o +vg_fmt

No reply yet so I thought I'd modify the subject to catch someone's eye.

Martin

Quoted 192 lines · Martin Papik

Thank you. Is that patch going to be added to the main source code base?

I think I found an error (segfault), see below.

==> I have a few more improvement suggestions.

* IMHO vgs/lvs should include a column called seg_size_pe, similar to seg_start and seg_start_pe
* IMHO vgs/lvs/pvs should have an command line parameter, or option modifier allowing to not display empty columns, i.e. the following command might skip displaying origin, snap%, move, log, copy%, convert, because they have no values. That would allow me to show copy_percent column only when copy is in progress. Would be nice.

lvs --all -o +vg_extent_size

  LV      VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert Ext
  boot    volume -wi-ao 1.00g                                       4.00m
  copy    volume -wi-ao 2.00t                                       4.00m

emulate volume -wi-ao 50.00g 4.00m
home volume -wi-ao 150.00g
4.00m
p2p volume -wi-a- 300.00g
4.00m

  root    volume -wi-ao 4.00g                                       4.00m
  swap    volume -wi-ao 8.00g                                       4.00m
  tmp     volume -wi-ao 2.00g                                       4.00m
  usr     volume -wi-ao 20.00g                                       4.00m
  var     volume -wi-ao 20.00g                                       4.00m

Possible error:

root@localhost# lvs --rows --align
Does not align, should it?

*==> SEGFAULT INFO*

root@localhost# pvs --all -o +vg_fmt
Segmentation fault (core dumped)

However the following seems to work.....

root@localhost# pvs --all -o +vg_name
  PV         VG     Fmt  Attr PSize PFree VG
  /dev/dm-0              --      0     0
  --- some entries removed for brevity ----
  /dev/md127 volume lvm2 a-   5.46t 2.77t volume
  --- some entries removed for brevity ----
  /dev/sde1              --      0     0

Additional information that might help.

root@localhost# pvs --version
  LVM version:     2.02.66(2) (2010-05-20)
  Library version: 1.02.48 (2010-05-20)
  Driver version:  4.22.0
root@localhost# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"

root@localhost#valgrind pvs --all -o +vg_fmt
==14584== Memcheck, a memory error detector
==14584== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==14584== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==14584== Command: pvs --all -o +vg_fmt
==14584==
==14584== Invalid read of size 8

==14584==    at 0x548ED77: dm_report_field_string (in /lib/libdevmapper.so.1.02.1)
==14584==    by 0x549006F: dm_report_object (in /lib/libdevmapper.so.1.02.1)
==14584==    by 0x46B138: report_object (in /sbin/lvm)
==14584==    by 0x423618: ??? (in /sbin/lvm)
==14584==    by 0x4254B2: process_each_pv (in /sbin/lvm)
==14584==    by 0x4230D3: ??? (in /sbin/lvm)
==14584==    by 0x41AE60: lvm_run_command (in /sbin/lvm)
==14584==    by 0x41B307: lvm2_main (in /sbin/lvm)
==14584==    by 0x58CE76C: (below main) (libc-start.c:226)

==14584== Address 0x28 is not stack'd, malloc'd or (recently) free'd ==14584==
==14584==
==14584== Process terminating with default action of signal 11 (SIGSEGV) ==14584== Access not within mapped region at address 0x28

==14584==    at 0x548ED77: dm_report_field_string (in /lib/libdevmapper.so.1.02.1)
==14584==    by 0x549006F: dm_report_object (in /lib/libdevmapper.so.1.02.1)
==14584==    by 0x46B138: report_object (in /sbin/lvm)
==14584==    by 0x423618: ??? (in /sbin/lvm)
==14584==    by 0x4254B2: process_each_pv (in /sbin/lvm)
==14584==    by 0x4230D3: ??? (in /sbin/lvm)
==14584==    by 0x41AE60: lvm_run_command (in /sbin/lvm)
==14584==    by 0x41B307: lvm2_main (in /sbin/lvm)
==14584==    by 0x58CE76C: (below main) (libc-start.c:226)
==14584==  If you believe this happened as a result of a stack
==14584==  overflow in your program's main thread (unlikely but
==14584==  possible), you can try to increase the size of the
==14584==  main thread stack using the --main-stacksize= flag.
==14584==  The main thread stack size used in this run was 8388608.

==14584==

root@localhost# ltrace pvs --all -o +vg_fmt 2>&1 | tail
__ctype_toupper_loc()                            = 0x7f2f0e83f768
__ctype_toupper_loc()                            = 0x7f2f0e83f768
__ctype_toupper_loc()                            = 0x7f2f0e83f768
__sprintf_chk(0x1e86e88, 1, -1, 0x48daa5, 0x48dab8) = 2
dm_pool_strdup(0x1e88120, 0x1e86e88, 0x1e86e8a, 0, 0x48daa8) = 0x1e8e538
dm_pool_alloc(0x1e88120, 8, 2, 0x7f2f0d892030, 0x48daa8) = 0x1e8e540
dm_report_field_set_value(0x1e8e508, 0x1e8e538, 0x1e8e540, 0x7f2f0d892030, 0x48daa8) = 0x1e8e540
dm_report_field_string(0x1e88080, 0x1e8e550, 40, 0x6b1fe0, 0x1e6cfe0 <unfinished ...>
killed by SIGSEGV +++ renamed from SIGSEGV (Segmentation fault) --- +0 -0

root@localhost#

root@localhost# gdb --args pvs --all -o +vg_fmt
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /sbin/pvs...(no debugging symbols found)...done.
(gdb) run
Starting program: /sbin/pvs --all -o +vg_fmt
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
File descriptor 3 (socket:[46992174]) leaked on pvs invocation. Parent PID 14623: gdb
File descriptor 4 (socket:[46992175]) leaked on pvs invocation. Parent PID 14623: gdb
File descriptor 5 (pipe:[46992176]) leaked on pvs invocation. Parent PID 14623: gdb
File descriptor 6 (pipe:[46992176]) leaked on pvs invocation. Parent PID 14623: gdb

Program received signal SIGSEGV, Segmentation fault. 0x00007ffff757dd77 in dm_report_field_string () from /lib/libdevmapper.so.1.02.1 (gdb) disassemble dm_report_field_string
Dump of assembler code for function dm_report_field_string:

   0x00007ffff757dd70 <+0>:    push   %rbx
   0x00007ffff757dd71 <+1>:    mov    %rsi,%rbx
   0x00007ffff757dd74 <+4>:    mov    (%rdi),%rdi
=> 0x00007ffff757dd77 <+7>:    mov (%rdx),%rsi
   0x00007ffff757dd7a <+10>:    callq 0x7ffff7570a30 <dm_pool_strdup@plt>
   0x00007ffff757dd7f <+15>:    test   %rax,%rax
(gdb) info registers
rax            0x6dd550    7198032
rbx            0x6dd550    7198032
rcx            0x6b1fe0    7020512
rdx            0x28    40
rsi            0x6dd550    7198032
rdi            0x6d7120    7172384
rbp            0x6d7080    0x6d7080
Quoted 42 lines · Alasdair G Kergon

It uses lists of ranges separated by colons.

   :x-y

If x is missing, 0 is inserted; if y is missing, the last extent on the device is inserted.

Man pages can always be improved with more examples!

For +length, try the patch below.

Alasdair

tools/toollib.c +10 -1
@@ -1001,7 +1001,7 @@ static int _parse_pes(struct dm_pool *mem, char *c, struct dm_list *pe_ranges,
  		      const char *pvname, uint32_t size)
  {
  	char *endptr;
-	uint32_t start, end;
+	uint32_t start, end, len;
 
  	/* Default to whole PV */
  	if (!c) {
@@ -1041,7 +1041,16 @@ static int _parse_pes(struct dm_pool *mem, char *c, struct dm_list *pe_ranges,
  					goto error;
  				c = endptr;
  			}
+		} else if (*c == '+') {	/* Length? */
+			c++;
+			if (isdigit(*c)) {
+				if (!xstrtouint32(c, &endptr, 10, &len))
+					goto error;
+				c = endptr;
+				end = start + (len ? (len - 1) : 0);
+			}
  		}
+
  		if (*c && *c != ':')
  			goto error;
 
#6 lore raw
In reply to Martin Papik
Quoted 1 line · Martin Papik

Thank you. Is that patch going to be added to the main source code base?

Committed for 2.02.103.

Quoted 3 lines

I think I found an error (segfault), see below.

LVM version: 2.02.66(2) (2010-05-20)

I've no interest in bugs reported against such an old version of the code, I'm afraid. If you reproduce with upstream code, then we'll look into it.

Alasdair

#8 lore raw
In reply to Martin Papik
Quoted 5 lines · Martin Papik

* IMHO vgs/lvs/pvs should have an command line parameter, or option modifier allowing to not display empty columns, i.e. the following command might skip displaying origin, snap%, move, log, copy%, convert, because they have no values. That would allow me to show copy_percent column only when copy is in progress. Would be nice.

Yes - I'm surprised we never had this suggested before.

- Some columns will gain a property saying they can be suppressed when empty.

- A new cmdline option/config setting to suppress empty fields.

- Implemented as an extension alongside the 'sort' option. (Like sort, you have to have all the output data prepared before you find out whether any columns are empty - even the headings can't be output before this point.)

- A way to flag an output data entry as empty. (zkabelac is about to commit some patches to tidy up the handling of empty fields so this change can follow those.)

Alasdair