1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

pvmove: Accept PE ranges as start+length.

This commit is contained in:
Alasdair G Kergon 2013-09-23 19:50:34 +01:00
parent bbcc120e5a
commit 7233e584ad
3 changed files with 18 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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;