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 On 07/20/2013 02:20 AM, Alasdair G Kergon wrote: 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; |
_______________________________________________ linux-lvm mailing list linux-lvm@redhat.com https://www.redhat.com/mailman/listinfo/linux-lvm read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/