1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

abstract _is_contiguous()

This commit is contained in:
Alasdair Kergon 2006-10-07 11:34:53 +00:00
parent b4ccb00b36
commit 7dce16f234

View File

@ -732,6 +732,20 @@ static int _comp_area(const void *l, const void *r)
return 0;
}
/*
* Is PV area contiguous to PV segment?
*/
static int _is_contiguous(struct pv_segment *pvseg, struct pv_area *pva)
{
if (pvseg->pv != pva->map->pv)
return 0;
if (pvseg->pe + pvseg->len != pva->start)
return 0;
return 1;
}
/*
* Is pva contiguous to any existing areas or on the same PV?
*/
@ -755,10 +769,7 @@ static int _check_contiguous(struct lv_segment *prev_lvseg, struct pv_area *pva,
if (!(prev_pvseg = seg_pvseg(prev_lvseg, s)))
continue; /* FIXME Broken */
if ((prev_pvseg->pv != pva->map->pv))
continue;
if (prev_pvseg->pe + prev_pvseg->len == pva->start) {
if (_is_contiguous(prev_pvseg, pva)) {
areas[s] = pva;
return 1;
}