[lvm-devel] [PATCH] metadata: skip MDA_IGNORED flags PV write metadata

Yi Wang wang.yi59 at zte.com.cn
Mon Mar 13 02:37:44 UTC 2023


From: Long YunJian <long.yunjian at zte.com.cn>

If we set vgmetadatacopies value which less than PV available numbers in a VG,
and use pvmetadataignore default 0, vgcreate save metadata to all pvs, included those
set MDA_IGNORED flags PV. It is misleading into thinking that the set MDA_IGNORED PV
is still in use. It also influence vgcreate performance in lots of PV environment.
So, we add filter condition to avoid write metadata to those set MDA_IGNORED flags PV.

Signed-off-by: Long YunJian <long.yunjian at zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59 at zte.com.cn>
---
 lib/metadata/metadata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 10af75665..7ca2e9f77 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3017,7 +3017,7 @@ int vg_write(struct volume_group *vg)
 	dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
 		mda_dev = mda_get_device(mda);
 
-		if (mda->status & MDA_FAILED)
+		if (mda->status & MDA_FAILED || mda->status & MDA_IGNORED)
 			continue;
 
 		/*
-- 
2.31.1



More information about the lvm-devel mailing list