[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH] (4/5) partial volume group activation without /dev/ioerror



Hi,

this patch is mostly orthogonal to the rest of the series. It uses the "error"
target of device-mapper to implement partial volume group activation. This used
to rely on /dev/ioerror, which is often not present on modern systems and is
generally cumbersome. The code will now create error maps of the right size for
each of the missing pieces of storage and use those.

Sun Jun  8 13:12:30 CEST 2008  me mornfall net
  * It's better when it compiles.
Sun Jun  8 13:11:14 CEST 2008  me mornfall net
  * Use human-readable names in error tables + coding style.
Sun Jun  8 13:09:56 CEST 2008  me mornfall net
  * First working iteration of /dev/ioerror-less activation.
Sun May 11 14:11:49 CEST 2008  me mornfall net
  * Sketch out how partial activation should work without /dev/ioerror.
diff -rN -u -p old-hotspare-two/lib/activate/dev_manager.c new-hotspare-two/lib/activate/dev_manager.c
--- old-hotspare-two/lib/activate/dev_manager.c	2008-07-08 14:37:28.062694828 +0200
+++ new-hotspare-two/lib/activate/dev_manager.c	2008-07-08 14:37:28.118696477 +0200
@@ -700,6 +700,30 @@ bad:
 	return NULL;
 }
 
+char *_add_error_device(struct dev_manager *dm, struct dm_tree *dtree,
+			struct lv_segment *seg, int s)
+{
+	char *id, *name;
+	char errid[32];
+	struct dm_tree_node *node;
+	int size;
+
+	sprintf(errid, "missing_%d", s);
+
+	if (!(id = build_dlid(dm, seg->lv->lvid.s, errid))) 
+		return_0;
+
+	if (!(name = build_dm_name(dm->mem, seg->lv->vg->name,
+				   seg->lv->name, errid)))
+		return_0;
+	if (!(node = dm_tree_add_new_dev(dtree, name, id, 0, 0, 0, 0, 0)))
+		return_0;
+	if (!dm_tree_node_add_error_target(node, size))
+		return_0;
+
+	return id;
+}
+
 int add_areas_line(struct dev_manager *dm, struct lv_segment *seg,
 		   struct dm_tree_node *node, uint32_t start_area,
 		   uint32_t areas)
@@ -713,11 +737,14 @@ int add_areas_line(struct dev_manager *d
 		     (!seg_pvseg(seg, s) ||
 		      !seg_pv(seg, s) ||
 		      !seg_dev(seg, s))) ||
-		    (seg_type(seg, s) == AREA_LV && !seg_lv(seg, s)))
-			dm_tree_node_add_target_area(node,
-							dm->stripe_filler,
-							NULL, UINT64_C(0));
-		else if (seg_type(seg, s) == AREA_PV)
+		    (seg_type(seg, s) == AREA_LV && !seg_lv(seg, s))) {
+			struct dm_tree **tree = (struct dm_tree **) node; // FIXME
+			dlid = _add_error_device(dm, *tree, seg, s);
+			if (!dlid)
+				return_0;
+			dm_tree_node_add_target_area(node, NULL, dlid,
+						     extent_size * seg_le(seg, s));
+		} else if (seg_type(seg, s) == AREA_PV)
 			dm_tree_node_add_target_area(node,
 							dev_name(seg_dev(seg, s)),
 							NULL,

-- 
Peter Rockai | me()mornfall!net | prockai()redhat!com
 http://blog.mornfall.net | http://web.mornfall.net

"In My Egotistical Opinion, most people's C programs should be
 indented six feet downward and covered with dirt."
     -- Blair P. Houghton on the subject of C program indentation

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]