[linux-lvm] Re: [PATCH LVM2] (2/3) use _for_each_pv() from _check_contiguous()

Jun'ichi Nomura j-nomura at ce.jp.nec.com
Mon Oct 9 16:27:19 UTC 2006


Alasdair G Kergon wrote:
>> This patch rewrites _check_contiguous() to use _for_each_pv().
>  
> I think the existing FIXME got dropped and I suspect there are problems
> with multiple levels of recursion.  (h->index++ ?)

I think the FIXME was intended for the case of stacked LV.
The index here is used to flatten the stacked LV to linear array
of PVs.
To complete it, we need to use the index in other places, too.

In _allocate(),
         /* Upper bound if none of the PVs in prev_lvseg is in pvms */
         /* FIXME Work size out properly */
         if (prev_lvseg)
                 areas_size += prev_lvseg->area_count;

and in _find_parallel_space(),
         if (prev_lvseg) {
                 ix_offset = prev_lvseg->area_count;

we can count the number of PVs constituting the last extent of
the prev_lvseg correctly by _for_each_pv().

What do you think about the attached patch?

It adds index calculation in _for_each_pv() (I replaced
'top_level_area_index' because it seemed aiming for similar
purpose) and fixes the 2 places above.
If you pass a pointer to counter, _for_each_pv() increments
the counter for each AREA_PV and passes the current number to
call back function. Upon return from the top level _for_each_pv(),
the counter should have the number of PVs in flattend LV.
As long as we use the same set of parameters for _for_each_pv(),
the counter value can be used as consistent index.

I also attached hypothetical metadata of stacked LV
(RAID0+1 and RAID10).

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 07-area_count-calculation-fix.patch
Type: text/x-patch
Size: 4327 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20061009/1f5904d9/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mirror-stripe.vg
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20061009/1f5904d9/attachment.ksh>


More information about the linux-lvm mailing list