[lvm-devel] [LVM2 RFC PATCH] Tidy extent-related variables in allocation code

Jun'ichi Nomura j-nomura at ce.jp.nec.com
Tue Aug 21 22:59:19 UTC 2007


Hi,

This patch is rfc, not very well tested yet.

Current allocation code is very hard to read and I think
part of the reason is the ambiguity of 'extents' variables.
Some are length of LV, others are the number of extents.
It makes the code prone to introduce errors.

For example, in _find_parallel_space(), this code:
       if (needed - *allocated > free_pes) {
                log_error("Insufficient free space: %" PRIu32
                            " extents needed,"
                            " but only %" PRIu32 " available",
                            needed - *allocated, free_pes);
checks the free physical extents.
But since 'needed' and 'allocated' are the length of LV,
the comparison doesn't work as expected if the LV is mirrored
because 1-extent of n-way mirrored LV requires n-extents.

I would like to know if the idea of renaming makes sense
and if there are better names of variables and conversion functions.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-allocate-rename-extents-variables.patch
Type: text/x-patch
Size: 13552 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20070821/3ec4c7c3/attachment.bin>


More information about the lvm-devel mailing list