summaryrefslogtreecommitdiff
path: root/include/linux/raid
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 20:18:41 -0800
committerLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 20:18:41 -0800
commitc37fa164f793735b32aa3f53154ff1a7659e6442 (patch)
treebfd5741e0e9b26374f2dc1668905cf6f12c18aba /include/linux/raid
parent1d66e22e0f6b1cca563d240f90697b05860dca4d (diff)
v2.4.9.9 -> v2.4.9.10
- Alan Cox: continued merging - Mingming Cao: make msgrcv/shmat check the queue/segment ID's properly - Greg KH: USB serial init failure fix, Xircom serial converter driver - Neil Brown: nsfd/raid/md/lockd cleanups - Ingo Molnar: multipath RAID personality, raid xor update - Hugh Dickins/Marcelo Tosatti: swapin read-ahead race fix - Vojtech Pavlik: fix up some of the infrastructure for x86-64 - Robert Love: AMD 761 AGP GART support - Jens Axboe: fix SCSI-generic queue handling race - me: be sane about page reference bits
Diffstat (limited to 'include/linux/raid')
-rw-r--r--include/linux/raid/md_compatible.h4
-rw-r--r--include/linux/raid/md_k.h11
-rw-r--r--include/linux/raid/md_u.h1
-rw-r--r--include/linux/raid/multipath.h87
4 files changed, 98 insertions, 5 deletions
diff --git a/include/linux/raid/md_compatible.h b/include/linux/raid/md_compatible.h
index f693fcf58e02..74dadd4bb663 100644
--- a/include/linux/raid/md_compatible.h
+++ b/include/linux/raid/md_compatible.h
@@ -27,12 +27,14 @@
/* 000 */
#define md__get_free_pages(x,y) __get_free_pages(x,y)
-#ifdef __i386__
+#if defined(__i386__) || defined(__x86_64__)
/* 001 */
static __inline__ int md_cpu_has_mmx(void)
{
return test_bit(X86_FEATURE_MMX, &boot_cpu_data.x86_capability);
}
+#else
+#define md_cpu_has_mmx(x) (0)
#endif
/* 002 */
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 3b51e92fe555..851df24f4a5a 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -17,17 +17,18 @@
#define MD_RESERVED 0UL
#define LINEAR 1UL
-#define STRIPED 2UL
-#define RAID0 STRIPED
+#define RAID0 2UL
#define RAID1 3UL
#define RAID5 4UL
#define TRANSLUCENT 5UL
#define HSM 6UL
-#define MAX_PERSONALITY 7UL
+#define MULTIPATH 7UL
+#define MAX_PERSONALITY 8UL
static inline int pers_to_level (int pers)
{
switch (pers) {
+ case MULTIPATH: return -4;
case HSM: return -3;
case TRANSLUCENT: return -2;
case LINEAR: return -1;
@@ -35,7 +36,7 @@ static inline int pers_to_level (int pers)
case RAID1: return 1;
case RAID5: return 5;
}
- panic("pers_to_level()");
+ BUG();
return MD_RESERVED;
}
@@ -171,6 +172,7 @@ struct mdk_rdev_s
mdp_super_t *sb;
unsigned long sb_offset;
+ int alias_device; /* device alias to the same disk */
int faulty; /* if faulty do not issue IO requests */
int desc_nr; /* descriptor index in the superblock */
};
@@ -258,6 +260,7 @@ static inline kdev_t mddev_to_kdev(mddev_t * mddev)
extern mdk_rdev_t * find_rdev(mddev_t * mddev, kdev_t dev);
extern mdk_rdev_t * find_rdev_nr(mddev_t *mddev, int nr);
+extern mdp_disk_t *get_spare(mddev_t *mddev);
/*
* iterates through some rdev ringlist. It's safe to remove the
diff --git a/include/linux/raid/md_u.h b/include/linux/raid/md_u.h
index 22a1543808c9..a2df5c2a42af 100644
--- a/include/linux/raid/md_u.h
+++ b/include/linux/raid/md_u.h
@@ -35,6 +35,7 @@
#define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)
#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
+#define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a)
/* usage */
#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
diff --git a/include/linux/raid/multipath.h b/include/linux/raid/multipath.h
new file mode 100644
index 000000000000..db2f3ec99bda
--- /dev/null
+++ b/include/linux/raid/multipath.h
@@ -0,0 +1,87 @@
+#ifndef _MULTIPATH_H
+#define _MULTIPATH_H
+
+#include <linux/raid/md.h>
+
+struct multipath_info {
+ int number;
+ int raid_disk;
+ kdev_t dev;
+ int sect_limit;
+ int head_position;
+
+ /*
+ * State bits:
+ */
+ int operational;
+ int write_only;
+ int spare;
+
+ int used_slot;
+};
+
+struct multipath_private_data {
+ mddev_t *mddev;
+ struct multipath_info multipaths[MD_SB_DISKS];
+ int nr_disks;
+ int raid_disks;
+ int working_disks;
+ mdk_thread_t *thread;
+ struct multipath_info *spare;
+ md_spinlock_t device_lock;
+
+ /* buffer pool */
+ /* buffer_heads that we have pre-allocated have b_pprev -> &freebh
+ * and are linked into a stack using b_next
+ * multipath_bh that are pre-allocated have MPBH_PreAlloc set.
+ * All these variable are protected by device_lock
+ */
+ struct buffer_head *freebh;
+ int freebh_cnt; /* how many are on the list */
+ struct multipath_bh *freer1;
+ struct multipath_bh *freebuf; /* each bh_req has a page allocated */
+ md_wait_queue_head_t wait_buffer;
+
+ /* for use when syncing multipaths: */
+ unsigned long start_active, start_ready,
+ start_pending, start_future;
+ int cnt_done, cnt_active, cnt_ready,
+ cnt_pending, cnt_future;
+ int phase;
+ int window;
+ md_wait_queue_head_t wait_done;
+ md_wait_queue_head_t wait_ready;
+ md_spinlock_t segment_lock;
+};
+
+typedef struct multipath_private_data multipath_conf_t;
+
+/*
+ * this is the only point in the RAID code where we violate
+ * C type safety. mddev->private is an 'opaque' pointer.
+ */
+#define mddev_to_conf(mddev) ((multipath_conf_t *) mddev->private)
+
+/*
+ * this is our 'private' 'collective' MULTIPATH buffer head.
+ * it contains information about what kind of IO operations were started
+ * for this MULTIPATH operation, and about their status:
+ */
+
+struct multipath_bh {
+ atomic_t remaining; /* 'have we finished' count,
+ * used from IRQ handlers
+ */
+ int cmd;
+ unsigned long state;
+ mddev_t *mddev;
+ struct buffer_head *master_bh;
+ struct buffer_head *multipath_bh_list;
+ struct buffer_head bh_req;
+ struct multipath_bh *next_r1; /* next for retry or in free list */
+};
+/* bits for multipath_bh.state */
+#define MPBH_Uptodate 1
+#define MPBH_SyncPhase 2
+#define MPBH_PreAlloc 3 /* this was pre-allocated, add to free list */
+#endif