master - pvmove: Accept PE ranges as start+length.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7233e584adeadd1186eb8cb26d45d65c1f446725 Commit: 7233e584adeadd1186eb8cb26d45d65c1f446725 Parent: bbcc120e5a2c781dc372c4d7329a262247f68f98 Author: Alasdair G Kergon <[email protected]> AuthorDate: Mon Sep 23 19:50:34 2013 +0100 Committer: Alasdair G Kergon <[email protected]> CommitterDate: Mon Sep 23 19:50:34 2013 +0100
pvmove: Accept PE ranges as start+length.
--- WHATS_NEW | 1 + man/pvmove.8.in | 7 +++++++ tools/toollib.c | 11 ++++++++++- 3 files changed, 18 insertions(+), 1 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.103 - ====================================== + Support start+length notation with command line PE ranges. Exit cleanly with message when pvmove cannot restart because LV is inactive. Version 2.02.102 - 23rd September 2013
man/pvmove.8.in +7 -0
@@ -123,6 +123,13 @@ inclusive on /dev/sdb1 - like this: .sp .B pvmove /dev/sdb1:1000-1999 .P +A range can also be specified as start+length, so +.sp +.B pvmove /dev/sdb1:1000+1000 +.P +also refers to 1000 Physical Extents starting from Physical Extent number 1000. +(Counting starts from 0, so this refers to the 1001st to the 2000th inclusive.) +.P To move a range of Physical Extents to a specific location (which must have sufficent free extents) use the form: .sp
tools/toollib.c +10 -1
@@ -1081,7 +1081,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) {
@@ -1121,7 +1121,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;