Skip to contentSkip to conversation

make vg_mark_partial_lvs more robust and export it

PATCH New Petr Rockai 2 participants 4 messages Feb 16, 2011 – Mar 19, 2011 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make vg_mark_partial_lvs more robust and export it

Hi,

the following patch makes vg_mark_partial_lvs also clear existing PARTIAL_LV flags, so it can be issued repeatedly on the same VG, keeping the PARTIAL_LV flags up to date.

This will be useful in a vgreduce --removemissing --force refactor later.

The patch is simple and straightforward.

Yours,
Petr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vg-mark-partial.diff
Type: text/x-diff
Size: 2200 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20110216/6521ca64/attachment.bin>
-------------- next part --------------

Signature · 1 line
id' Ash = Ash; id' Dust = Dust; id' _ = undefined
#1 lore raw

PATCH 1/1 make vg_mark_partial_lvs more robust and export it

Hey again,

Quoted 5 lines · Petr Rockai

the following patch makes vg_mark_partial_lvs also clear existing PARTIAL_LV flags, so it can be issued repeatedly on the same VG, keeping the PARTIAL_LV flags up to date.

The patch is simple and straightforward.

scratch that. It introduces a bug nevertheless. Attaching a fixed version.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vg-mark-partial.diff
Type: text/x-diff
Size: 3607 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20110216/a3f0eefa/attachment.bin>
-------------- next part --------------

Signature · 1 line
id' Ash = Ash; id' Dust = Dust; id' _ = undefined

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

PATCH 1/1 make vg_mark_partial_lvs more robust and export it

Dne 16.2.2011 09:57, Petr Rockai napsal(a):

Quoted 25 lines

Hey again,

Quoted 5 lines · Petr Rockai
Quoted 5 lines

the following patch makes vg_mark_partial_lvs also clear existing PARTIAL_LV flags, so it can be issued repeatedly on the same VG, keeping the PARTIAL_LV flags up to date.

The patch is simple and straightforward.

scratch that. It introduces a bug nevertheless. Attaching a fixed version.

vg-mark-partial.diff

(quoted diff) +1 -5
-int vg_mark_partial_lvs(struct volume_group *vg)
+int vg_mark_partial_lvs(struct volume_group *vg, int clear)
 {
-	struct logical_volume *lv;
 	struct lv_list *lvl;
 
-	dm_list_iterate_items(lvl, &vg->lvs) {
-		lv = lvl->lv;
-		if (!_lv_mark_if_partial(lv))

Review

Quoted 10 lines
(quoted diff) +7 -1
+	if (clear)
+		dm_list_iterate_items(lvl, &vg->lvs)
+			lvl->lv->status &= ~PARTIAL_LV;
+
+	dm_list_iterate_items(lvl, &vg->lvs)
+		if (!_lv_mark_if_partial(lvl->lv))
 			return_0;
-	}
+
 	return 1;

Probably nothing against the patch itself - but maybe we can we find a better solution for this list scanning?

We are often going through the whole list to find the information we could comfortable store in other places - like list of partial lvs maybe, or we may already know there is not partial LV in the whole VG (vg flag ?)

This kind of code adds O(n) complexity for lots of operations. (When you have 10000LVs it has some measurable impact).

I think similar is the 'unknown' segment which requires full scan.

Zdenek

#4 lore raw

PATCH 1/1 make vg_mark_partial_lvs more robust and export it

Re,

I am attaching an updated patch (since the CVS went conflicting with the last version). It still does a scan of the LVs for the clear, but you obviously can't do any better without a major rework of the status flag system (where the flags would be sets of LVs instead of bits in the LVs). So we don't.

The patch applies to current CVS and passes tests. Please review (it is very simple and prerequisite for other patches)...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vg-mark-partial.diff
Type: text/x-diff
Size: 3475 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20110319/209cc751/attachment.bin>
-------------- next part --------------

Yours,
Petr

Signature · 1 line
id' Ash = Ash; id' Dust = Dust; id' _ = undefined