[PATCH] 0/4: Add the ability to splice a list into another list

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

 



Hi all,

These are preliminary patches to modify dmraid so that we can have
multiple raid_dev structures per physical device.  The DDF1
specification allows for a disk to participate in multiple RAID arrays,
which is what is gained from these patches.  They've been tested against
2.6.16.19 + dmraid45 on Ubuntu 6.06, and seem to be pretty stable.  At
this stage, I'm looking for comments about the code because it touches
core dmraid code and could (but shouldn't) break support for hardware
that I don't have.

This first patch is a simple one that adds an operation to splice a
headless doubly-linked list into an existing headed list.  The headless
lists are created in the second patch.

--D

Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
diff -Naurp v11.orig/include/dmraid/list.h v11-mdisk3/include/dmraid/list.h
--- v11.orig/include/dmraid/list.h	2005-09-13 06:37:33.000000000 -0700
+++ v11-mdisk3/include/dmraid/list.h	2006-06-01 16:35:57.000000000 -0700
@@ -67,4 +67,26 @@ static inline void __list_add(struct lis
              pos != (head); \
              pos = n, n = pos->next)
 
+/*
+ * Insert list into the list anchored by head.
+ * Assume that "list" is a self-contained loop.
+ */
+static inline void list_splice(struct list_head *list, struct list_head *head)
+{
+	struct list_head *l1, *h1;
+
+	if (list_empty(list)) {
+		list_add_tail(list, head);
+		return;
+	}
+
+	l1 = list->next;
+	h1 = head->next;
+
+	head->next = l1;
+	l1->prev = head;
+	list->next = h1;
+	h1->prev = list;
+}
+
 #endif
_______________________________________________

Ataraid-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/ataraid-list

[Index of Archives]     [Linux RAID]     [Linux Device Mapper]     [Linux IDE]     [Linux SCSI]     [Kernel]     [Linux Books]     [Linux Admin]     [GFS]     [RPM]     [Yosemite Campgrounds]     [AMD 64]

  Powered by Linux