<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix"><br>
      Thank you. Is that patch going to be added to the main source code
      base?<br>
      <br>
      I think I found an error (segfault), see below.<br>
      <br>
      ==> I have a few more improvement suggestions.<br>
      <br>
      * IMHO vgs/lvs should include a column called seg_size_pe, similar
      to seg_start and seg_start_pe<br>
      * 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.<br>
      <br>
      <tt>lvs --all -o +vg_extent_size</tt><tt><br>
      </tt><tt>  LV      VG     Attr   LSize   Origin Snap%  Move Log
        Copy%  Convert Ext  </tt><tt><br>
      </tt><tt>  boot    volume -wi-ao  
        1.00g                                       4.00m</tt><tt><br>
      </tt><tt>  copy    volume -wi-ao  
        2.00t                                       4.00m</tt><tt><br>
      </tt><tt>  emulate volume -wi-ao 
        50.00g                                       4.00m</tt><tt><br>
      </tt><tt>  home    volume -wi-ao
        150.00g                                       4.00m</tt><tt><br>
      </tt><tt>  p2p     volume -wi-a-
        300.00g                                       4.00m</tt><tt><br>
      </tt><tt>  root    volume -wi-ao  
        4.00g                                       4.00m</tt><tt><br>
      </tt><tt>  swap    volume -wi-ao  
        8.00g                                       4.00m</tt><tt><br>
      </tt><tt>  tmp     volume -wi-ao  
        2.00g                                       4.00m</tt><tt><br>
      </tt><tt>  usr     volume -wi-ao 
        20.00g                                       4.00m</tt><tt><br>
      </tt><tt>  var     volume -wi-ao 
        20.00g                                       4.00m</tt><br>
      <br>
      Possible error:<br>
      <br>
      <tt>root@localhost# lvs --rows --align</tt><tt><br>
      </tt><tt>Does not align, should it?</tt><tt><br>
      </tt><tt><br>
      </tt><b>==> SEGFAULT INFO</b><br>
      <br>
      <tt>root@localhost# pvs --all -o +vg_fmt</tt><tt><br>
      </tt><tt>Segmentation fault (core dumped)</tt><tt><br>
      </tt><tt><br>
        However the following seems to work.....<br>
        <br>
        root@localhost# pvs --all -o +vg_name</tt><tt><br>
      </tt><tt>  PV         VG     Fmt  Attr PSize PFree VG    </tt><tt><br>
      </tt><tt>  /dev/dm-0              --      0     0        </tt><tt><br>
      </tt><tt>  --- some entries removed for brevity ----</tt><tt><br>
      </tt><tt>  /dev/md127 volume lvm2 a-   5.46t 2.77t volume</tt><tt><br>
      </tt><tt>  --- some entries removed for brevity ----</tt><tt><br>
      </tt><tt>
          /dev/sde1              --      0     0        </tt><tt><br>
      </tt><tt><br>
      </tt><tt>Additional information that might help.<br>
      </tt><tt></tt><tt><br>
      </tt><tt>root@localhost# </tt><tt>pvs --version</tt><tt><br>
      </tt><tt>  LVM version:     2.02.66(2) (2010-05-20)</tt><tt><br>
      </tt><tt>  Library version: 1.02.48 (2010-05-20)</tt><tt><br>
      </tt><tt>  Driver version:  4.22.0</tt><tt><br>
      </tt><tt>root@localhost# cat /etc/lsb-release </tt><tt><br>
      </tt><tt>DISTRIB_ID=Ubuntu</tt><tt><br>
      </tt><tt>DISTRIB_RELEASE=12.04</tt><tt><br>
      </tt><tt>DISTRIB_CODENAME=precise</tt><tt><br>
      </tt><tt>DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"</tt><tt><br>
      </tt><tt><br>
      </tt><tt>root@localhost#</tt><tt> valgrind pvs --all -o +vg_fmt</tt><tt><br>
      </tt><tt>==14584== Memcheck, a memory error detector</tt><tt><br>
      </tt><tt>==14584== Copyright (C) 2002-2011, and GNU GPL'd, by
        Julian Seward et al.</tt><tt><br>
      </tt><tt>==14584== Using Valgrind-3.7.0 and LibVEX; rerun with -h
        for copyright info</tt><tt><br>
      </tt><tt>==14584== Command: pvs --all -o +vg_fmt</tt><tt><br>
      </tt><tt>==14584== </tt><tt><br>
      </tt><tt>==14584== Invalid read of size 8</tt><tt><br>
      </tt><tt>==14584==    at 0x548ED77: dm_report_field_string (in
        /lib/libdevmapper.so.1.02.1)</tt><tt><br>
      </tt><tt>==14584==    by 0x549006F: dm_report_object (in
        /lib/libdevmapper.so.1.02.1)</tt><tt><br>
      </tt><tt>==14584==    by 0x46B138: report_object (in /sbin/lvm)</tt><tt><br>
      </tt><tt>==14584==    by 0x423618: ??? (in /sbin/lvm)</tt><tt><br>
      </tt><tt>==14584==    by 0x4254B2: process_each_pv (in /sbin/lvm)</tt><tt><br>
      </tt><tt>==14584==    by 0x4230D3: ??? (in /sbin/lvm)</tt><tt><br>
      </tt><tt>==14584==    by 0x41AE60: lvm_run_command (in /sbin/lvm)</tt><tt><br>
      </tt><tt>==14584==    by 0x41B307: lvm2_main (in /sbin/lvm)</tt><tt><br>
      </tt><tt>==14584==    by 0x58CE76C: (below main)
        (libc-start.c:226)</tt><tt><br>
      </tt><tt>==14584==  Address 0x28 is not stack'd, malloc'd or
        (recently) free'd</tt><tt><br>
      </tt><tt>==14584== </tt><tt><br>
      </tt><tt>==14584== </tt><tt><br>
      </tt><tt>==14584== Process terminating with default action of
        signal 11 (SIGSEGV)</tt><tt><br>
      </tt><tt>==14584==  Access not within mapped region at address
        0x28</tt><tt><br>
      </tt><tt>==14584==    at 0x548ED77: dm_report_field_string (in
        /lib/libdevmapper.so.1.02.1)</tt><tt><br>
      </tt><tt>==14584==    by 0x549006F: dm_report_object (in
        /lib/libdevmapper.so.1.02.1)</tt><tt><br>
      </tt><tt>==14584==    by 0x46B138: report_object (in /sbin/lvm)</tt><tt><br>
      </tt><tt>==14584==    by 0x423618: ??? (in /sbin/lvm)</tt><tt><br>
      </tt><tt>==14584==    by 0x4254B2: process_each_pv (in /sbin/lvm)</tt><tt><br>
      </tt><tt>==14584==    by 0x4230D3: ??? (in /sbin/lvm)</tt><tt><br>
      </tt><tt>==14584==    by 0x41AE60: lvm_run_command (in /sbin/lvm)</tt><tt><br>
      </tt><tt>==14584==    by 0x41B307: lvm2_main (in /sbin/lvm)</tt><tt><br>
      </tt><tt>==14584==    by 0x58CE76C: (below main)
        (libc-start.c:226)</tt><tt><br>
      </tt><tt>==14584==  If you believe this happened as a result of a
        stack</tt><tt><br>
      </tt><tt>==14584==  overflow in your program's main thread
        (unlikely but</tt><tt><br>
      </tt><tt>==14584==  possible), you can try to increase the size of
        the</tt><tt><br>
      </tt><tt>==14584==  main thread stack using the --main-stacksize=
        flag.</tt><tt><br>
      </tt><tt>==14584==  The main thread stack size used in this run
        was 8388608.</tt><tt><br>
      </tt><tt>==14584== </tt><tt><br>
      </tt><tt><br>
      </tt><tt>root@localhost# </tt><tt>ltrace pvs --all -o +vg_fmt
        2>&1 | tail</tt><tt><br>
      </tt><tt>__ctype_toupper_loc()                            =
        0x7f2f0e83f768</tt><tt><br>
      </tt><tt>__ctype_toupper_loc()                            =
        0x7f2f0e83f768</tt><tt><br>
      </tt><tt>__ctype_toupper_loc()                            =
        0x7f2f0e83f768</tt><tt><br>
      </tt><tt>__sprintf_chk(0x1e86e88, 1, -1, 0x48daa5, 0x48dab8) = 2</tt><tt><br>
      </tt><tt>dm_pool_strdup(0x1e88120, 0x1e86e88, 0x1e86e8a, 0,
        0x48daa8) = 0x1e8e538</tt><tt><br>
      </tt><tt>dm_pool_alloc(0x1e88120, 8, 2, 0x7f2f0d892030, 0x48daa8)
        = 0x1e8e540</tt><tt><br>
      </tt><tt>dm_report_field_set_value(0x1e8e508, 0x1e8e538,
        0x1e8e540, 0x7f2f0d892030, 0x48daa8) = 0x1e8e540</tt><tt><br>
      </tt><tt>dm_report_field_string(0x1e88080, 0x1e8e550, 40,
        0x6b1fe0, 0x1e6cfe0 <unfinished ...></tt><tt><br>
      </tt><tt>--- SIGSEGV (Segmentation fault) ---</tt><tt><br>
      </tt><tt>+++ killed by SIGSEGV +++</tt><br>
      <tt>root@localhost#<br>
        <br>
      </tt><tt><tt>root@localhost#</tt> gdb --args pvs --all -o +vg_fmt</tt><tt><br>
      </tt><tt>GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1)
        7.4-2012.04</tt><tt><br>
      </tt><tt>Copyright (C) 2012 Free Software Foundation, Inc.</tt><tt><br>
      </tt><tt>License GPLv3+: GNU GPL version 3 or later
        <a class="moz-txt-link-rfc2396E" href="http://gnu.org/licenses/gpl.html"><http://gnu.org/licenses/gpl.html></a></tt><tt><br>
      </tt><tt>This is free software: you are free to change and
        redistribute it.</tt><tt><br>
      </tt><tt>There is NO WARRANTY, to the extent permitted by law. 
        Type "show copying"</tt><tt><br>
      </tt><tt>and "show warranty" for details.</tt><tt><br>
      </tt><tt>This GDB was configured as "x86_64-linux-gnu".</tt><tt><br>
      </tt><tt>For bug reporting instructions, please see:</tt><tt><br>
      </tt><tt><a class="moz-txt-link-rfc2396E" href="http://bugs.launchpad.net/gdb-linaro/"><http://bugs.launchpad.net/gdb-linaro/></a>...</tt><tt><br>
      </tt><tt>Reading symbols from /sbin/pvs...(no debugging symbols
        found)...done.</tt><tt><br>
      </tt><tt>(gdb) run</tt><tt><br>
      </tt><tt>Starting program: /sbin/pvs --all -o +vg_fmt</tt><tt><br>
      </tt><tt>[Thread debugging using libthread_db enabled]</tt><tt><br>
      </tt><tt>Using host libthread_db library
        "/lib/x86_64-linux-gnu/libthread_db.so.1".</tt><tt><br>
      </tt><tt>File descriptor 3 (socket:[46992174]) leaked on pvs
        invocation. Parent PID 14623: gdb</tt><tt><br>
      </tt><tt>File descriptor 4 (socket:[46992175]) leaked on pvs
        invocation. Parent PID 14623: gdb</tt><tt><br>
      </tt><tt>File descriptor 5 (pipe:[46992176]) leaked on pvs
        invocation. Parent PID 14623: gdb</tt><tt><br>
      </tt><tt>File descriptor 6 (pipe:[46992176]) leaked on pvs
        invocation. Parent PID 14623: gdb</tt><tt><br>
      </tt><tt><br>
      </tt><tt>Program received signal SIGSEGV, Segmentation fault.</tt><tt><br>
      </tt><tt>0x00007ffff757dd77 in dm_report_field_string () from
        /lib/libdevmapper.so.1.02.1</tt><tt><br>
      </tt><tt>(gdb) disassemble dm_report_field_string</tt><tt><br>
      </tt><tt>Dump of assembler code for function
        dm_report_field_string:</tt><tt><br>
      </tt><tt>   0x00007ffff757dd70 <+0>:    push   %rbx</tt><tt><br>
      </tt><tt>   0x00007ffff757dd71 <+1>:    mov    %rsi,%rbx</tt><tt><br>
      </tt><tt>   0x00007ffff757dd74 <+4>:    mov    (%rdi),%rdi</tt><tt><br>
      </tt><tt>=> 0x00007ffff757dd77 <+7>:    mov   
        (%rdx),%rsi</tt><tt><br>
      </tt><tt>   0x00007ffff757dd7a <+10>:    callq 
        0x7ffff7570a30 <dm_pool_strdup@plt></tt><tt><br>
      </tt><tt>   0x00007ffff757dd7f <+15>:    test   %rax,%rax</tt><tt><br>
      </tt><tt>(gdb) info registers </tt><tt><br>
      </tt><tt>rax            0x6dd550    7198032</tt><tt><br>
      </tt><tt>rbx            0x6dd550    7198032</tt><tt><br>
      </tt><tt>rcx            0x6b1fe0    7020512</tt><tt><br>
      </tt><tt>rdx            0x28    40</tt><tt><br>
      </tt><tt>rsi            0x6dd550    7198032</tt><tt><br>
      </tt><tt>rdi            0x6d7120    7172384</tt><tt><br>
      </tt><tt>rbp            0x6d7080    0x6d7080</tt><tt><br>
      </tt><br>
      <br>
      <br>
      On 07/20/2013 02:20 AM, Alasdair G Kergon wrote:<br>
    </div>
    <blockquote cite="mid:20130719232052.GB23574@agk-dp.fab.redhat.com"
      type="cite">
      <pre wrap="">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


--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -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;
 
</pre>
    </blockquote>
    <br>
  </body>
</html>