[lvm-devel] [PATCH 2/11] Add upward link from underlying LV to stacked seg

Alasdair G Kergon agk at redhat.com
Mon Jan 14 22:53:45 UTC 2008


 /*
+ * Add/remove upward link from underlying LV to the segment using it
+ */
+int lv_add_user_seg(struct logical_volume *lv, struct lv_segment *seg);
+int lv_remove_user_seg(struct logical_volume *lv, struct lv_segment *seg);

need to rename - too ambiguous

+/*
+ * This is a function specialized for the common case where there is
+ * only one segment which uses the LV.
+ * e.g. the LV is a layer inserted by insert_layer_for_lv().
+ *
+ * In general, walk through lv->segs_using_this_lv.
+ */
+struct lv_segment *seg_using_lv(struct logical_volume *lv)
+{
+	struct seg_list *sl;
+
+	if (list_size(&lv->segs_using_this_lv) != 1)
+		return NULL;

Is it ever valid to return here and not have an error?

+		if (!lv_add_user_seg(log_lv, seg))

Needs a clearer name.

@@ -110,8 +110,8 @@ int check_lv_segments(struct logical_vol
 		}
 
Where is this new list validated?

Alasdair
-- 
agk at redhat.com




More information about the lvm-devel mailing list