Skip to contentSkip to conversation

Fix _for_each_pv() to return correct segment end

PATCH New Jun'ichi Nomura 1 participant 1 message Aug 29, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix _for_each_pv() to return correct segment end

Hi,

_for_each_pv() is a function to walk through all PVs used by given part of LV. The function is expected to set smallest length of PV segment consists of the part of LV.
However, current code doesn't work as expected.

As a result, build_parallel_areas_from_lv() considers only the first segment of the LV and fails to build appropriate list of PVs to be avoided.

Attached patch fixes this problem.
Applicable to 2.02.09.

Thanks,

Signature · 1 line
Jun'ichi Nomura, NEC Corporation of America

_for_each_pv() is a function to walk through all PVs used by given part of LV. The function is expected to set smallest length of PV segment consists of the part of LV.
However, current code doesn't work as expected.

As a result, build_parallel_areas_from_lv() considers only the first segment of the LV and fails to build appropriate list of PVs to be avoided.

lib/metadata/lv_manip.c +1 -1
diff -urp LVM2.00/lib/metadata/lv_manip.c LVM2.01/lib/metadata/lv_manip.c
@@ -1358,7 +1358,7 @@ static int _for_each_pv(struct cmd_conte
 	/* Remaining logical length of segment */
 	remaining_seg_len = seg->len - (le - seg->le);
 
-	if (len > remaining_seg_len)
+	if (remaining_seg_len > len)
 		remaining_seg_len = len;
 
 	if (spvs->len > remaining_seg_len)