diff -u --recursive --new-file /usr/src/linux/MAGIC linux/MAGIC
--- /usr/src/linux/MAGIC	Sat Jan 14 08:32:05 1995
+++ linux/MAGIC	Thu Apr 13 21:53:05 1995
@@ -52,6 +52,7 @@
 0x00	fd.h
 0x03	hdreg.h
 0x06	lp.h
+0x09	md.h
 0x12	fs.h
 'C'	soundcard.h
 'K'	kd.h
diff -u --recursive --new-file /usr/src/linux/arch/i386/config.in linux/arch/i386/config.in
--- /usr/src/linux/arch/i386/config.in	Thu Feb 16 22:28:47 1995
+++ linux/arch/i386/config.in	Thu Apr 13 21:53:05 1995
@@ -22,6 +22,11 @@
 fi
 
 bool 'XT harddisk support' CONFIG_BLK_DEV_XD n
+bool 'Multiple devices driver support' CONFIG_BLK_DEV_MD n
+if [ "$CONFIG_BLK_DEV_MD" = "y" ]; then
+ bool '   Linear (append) mode' CONFIG_MD_LINEAR n
+ bool '   Striped (RAID-0-like) mode' CONFIG_MD_STRIPED y
+fi
 bool 'Networking support' CONFIG_NET y
 bool 'Limit memory to low 16MB' CONFIG_MAX_16M n
 bool 'PCI bios support' CONFIG_PCI n
diff -u --recursive --new-file /usr/src/linux/drivers/block/Makefile linux/drivers/block/Makefile
--- /usr/src/linux/drivers/block/Makefile	Fri Mar 31 15:11:41 1995
+++ linux/drivers/block/Makefile	Thu Apr 13 21:53:05 1995
@@ -91,6 +91,22 @@
 BLOCK_MODULE_OBJS := $(BLOCK_MODULE_OBJS) sonycd535.o
 endif
 
+ifdef CONFIG_BLK_DEV_MD
+OBJS := $(OBJS) md.o
+SRCS := $(SRCS) md.c
+
+ifdef CONFIG_MD_LINEAR
+OBJS := $(OBJS) linear.o
+SRCS := $(SRCS) linear.c
+endif
+
+ifdef CONFIG_MD_STRIPED
+OBJS := $(OBJS) raid0.o
+SRCS := $(SRCS) raid0.c
+endif
+
+endif
+
 all: block.a
 
 block.a: $(OBJS)
diff -u --recursive --new-file /usr/src/linux/drivers/block/blk.h linux/drivers/block/blk.h
--- /usr/src/linux/drivers/block/blk.h	Sat Apr  8 08:06:03 1995
+++ linux/drivers/block/blk.h	Thu Apr 13 21:53:05 1995
@@ -54,6 +54,9 @@
 #ifdef CONFIG_SBPCD
 extern unsigned long sbpcd_init(unsigned long, unsigned long);
 #endif CONFIG_SBPCD
+#ifdef CONFIG_BLK_DEV_MD
+extern unsigned long md_init(unsigned long mem_start, unsigned long mem_end);
+#endif
 extern void set_device_ro(int dev,int flag);
 
 extern void floppy_init(void);
@@ -129,6 +132,19 @@
 #define DEVICE_ON(device)
 #define DEVICE_OFF(device)
 
+/* Kludge to use the same number for both char and block major numbers */
+#elif  (MAJOR_NR == MD_MAJOR) && defined(MD_DRIVER)
+
+#ifndef MD_PERSONALITY
+
+#define DEVICE_NAME "Multiple devices driver"
+#define DEVICE_REQUEST do_md_request
+#define DEVICE_NR(device) (MINOR(device))
+#define DEVICE_ON(device)
+#define DEVICE_OFF(device)
+
+#endif
+
 #elif (MAJOR_NR == SCSI_TAPE_MAJOR)
 
 #define DEVICE_NAME "scsitape"
@@ -222,7 +238,7 @@
 
 #endif /* MAJOR_NR == whatever */
 
-#if (MAJOR_NR != SCSI_TAPE_MAJOR) && !defined(IDE_DRIVER)
+#if ((MAJOR_NR != SCSI_TAPE_MAJOR) && !defined(IDE_DRIVER)) || defined(MD_DRIVER)
 
 #ifndef CURRENT
 #define CURRENT (blk_dev[MAJOR_NR].current_request)
@@ -254,8 +270,10 @@
 
 #endif /* DEVICE_TIMEOUT */
 
+#ifndef MD_PERSONALITY
 static void (DEVICE_REQUEST)(void);
-
+#endif
+  
 #ifdef DEVICE_INTR
 #define CLEAR_INTR SET_INTR(NULL)
 #else
@@ -274,11 +292,11 @@
 			panic(DEVICE_NAME ": block not locked"); \
 	}
 
-#endif /* (MAJOR_NR != SCSI_TAPE_MAJOR) && !defined(IDE_DRIVER) */
+#endif /* ((MAJOR_NR != SCSI_TAPE_MAJOR) && !defined(IDE_DRIVER)) || defined(MD_DRIVER) */
 
 /* end_request() - SCSI devices have their own version */
 
-#if ! SCSI_MAJOR(MAJOR_NR)
+#if ! SCSI_MAJOR(MAJOR_NR) || (defined(MD_DRIVER) && !defined(MD_PERSONALITY))
 
 #ifdef IDE_DRIVER
 static void end_request(byte uptodate, byte hwif) {
@@ -326,7 +344,41 @@
 	req->dev = -1;
 	wake_up(&wait_for_request);
 }
-#endif /* ! SCSI_MAJOR(MAJOR_NR) */
+#endif /* ! SCSI_MAJOR(MAJOR_NR) || defined(MD_DRIVER) */
+
+#ifdef MD_PERSONALITY
+extern inline void end_redirect (void)
+{
+  struct request *req = CURRENT;
+  struct buffer_head * bh;
+
+  req->errors = 0;
+  
+  if ((bh = req->bh) != NULL)
+  {
+    req->bh = bh->b_reqnext;
+    bh->b_reqnext = NULL;
+    
+    if ((bh = req->bh) != NULL)
+    {
+      req->current_nr_sectors = bh->b_size >> 9;
+      
+      if (req->nr_sectors < req->current_nr_sectors)
+      {
+	req->nr_sectors = req->current_nr_sectors;
+	printk("end_redirect : buffer-list destroyed\n");
+      }
+      
+      req->buffer = bh->b_data;
+      return;
+    }
+  }
+
+  CURRENT = req->next;
+  req->dev = -1;
+  wake_up(&wait_for_request);
+}
+#endif /* MD_PERSONALITY */
 
 #endif /* defined(MAJOR_NR) || defined(IDE_DRIVER) */
 
diff -u --recursive --new-file /usr/src/linux/drivers/block/linear.c linux/drivers/block/linear.c
--- /usr/src/linux/drivers/block/linear.c
+++ linux/drivers/block/linear.c	Thu Apr 13 21:53:05 1995
@@ -0,0 +1,176 @@
+
+#include <linux/md.h>
+#include <linux/linear.h>
+#include <linux/malloc.h>
+
+#define MAJOR_NR MD_MAJOR
+#define MD_DRIVER
+#define MD_PERSONALITY
+
+#include "blk.h"
+
+static int linear_run (int minor, struct md_dev *md_dev)
+{
+  int current=0, i, size, dev0_size, nb_zone;
+  struct linear_data *data;
+
+  md_dev->private=kmalloc (sizeof (struct linear_data), GFP_KERNEL);
+  data=(struct linear_data *) md_dev->private;
+
+  /*
+     Find out the smallest device. This was previously done
+     at registery time, but since it violates modularity,
+     I moved it here... Any comment ? ;-)
+   */
+
+  data->smallest=devices[minor];
+  for (i=1; i<md_dev->nb_dev; i++)
+    if (data->smallest->size > devices[minor][i].size)
+      data->smallest=devices[minor]+i;
+  
+  nb_zone=data->nr_zones=
+    md_size[minor]/data->smallest->size +
+    (md_size[minor]%data->smallest->size ? 1 : 0);
+  
+  data->hash_table=kmalloc (sizeof (struct linear_hash)*nb_zone, GFP_KERNEL);
+
+  size=devices[minor][current].size;
+
+  i=0;
+  while (current<md_dev->nb_dev)
+  {
+    data->hash_table[i].dev0=devices[minor]+current;
+
+    if (size>=data->smallest->size) /* If we completly fill the slot */
+    {
+      data->hash_table[i++].dev1=NULL;
+      size-=data->smallest->size;
+
+      if (!size)
+      {
+	if (++current==md_dev->nb_dev) continue;
+	size=devices[minor][current].size;
+      }
+
+      continue;
+    }
+
+    if (++current==md_dev->nb_dev) /* Last dev, set dev1 as NULL */
+    {
+      data->hash_table[i].dev1=NULL;
+      continue;
+    }
+
+    dev0_size=size;		/* Here, we use a 2nd dev to fill the slot */
+    size=devices[minor][current].size;
+    data->hash_table[i++].dev1=devices[minor]+current;
+    size-=(data->smallest->size - dev0_size);
+  }
+
+  return 0;
+}
+
+static int linear_stop (int minor, struct md_dev *md_dev)
+{
+  struct linear_data *data=(struct linear_data *) md_dev->private;
+
+  kfree (data->hash_table);
+  kfree (data);
+
+  return 0;
+}
+
+
+static int linear_map (int minor, struct md_dev *md_dev, struct request *req)
+{
+  struct linear_data *data=(struct linear_data *) md_dev->private;
+  struct linear_hash *hash;
+  struct real_dev *tmp_dev;
+  long block, rblock;
+  struct buffer_head *bh;
+  int rw;
+
+  block=req->sector >> 1;
+  hash=data->hash_table+(block/data->smallest->size);
+  
+  if (block >= (hash->dev0->size + hash->dev0->offset))
+  {
+    if (!hash->dev1)
+      printk ("linear_map : hash->dev1==NULL for block %ld\n", block);
+    tmp_dev=hash->dev1;
+  }
+  else
+    tmp_dev=hash->dev0;
+  
+  if (block >= (tmp_dev->size + tmp_dev->offset) || block < tmp_dev->offset)
+    printk ("Block %ld out of bounds on dev %04x size %d offset %d\n", block, tmp_dev->dev, tmp_dev->size, tmp_dev->offset);
+  
+  rblock=(block-(tmp_dev->offset));
+  
+  if ((bh=req->bh))		/* This a buffer request */
+  {
+    if (req->cmd==WRITE)
+      mark_buffer_dirty (bh, 0);/* re-dirtyfy buffer ! */
+
+    rw=req->cmd;
+    end_redirect ();		/* Must be done BEFORE redirection ! */
+    bh->b_rdev=tmp_dev->dev;
+    make_request (tmp_dev->dev, rblock*(bh->b_size>>9), rw, bh);
+  }
+  else				/* This is a paging request */
+  {
+    CURRENT=req->next;
+    req->next=NULL;
+    req->dev=tmp_dev->dev;
+    req->sector=rblock << 1;
+    add_request (blk_dev+MAJOR (tmp_dev->dev), req);
+  }
+
+  return 0;
+}
+
+
+static int linear_status (char *page, int minor, struct md_dev *md_dev)
+{
+  int sz=0;
+
+#undef MD_DEBUG
+#ifdef MD_DEBUG
+  int j;
+  struct linear_data *data=(struct linear_data *) md_dev->private;
+  
+  sz+=sprintf (page+sz, "      ");
+  for (j=0; j<data->nr_zones; j++)
+  {
+    sz+=sprintf (page+sz, "[%s",
+		 partition_name (data->hash_table[j].dev0->dev));
+
+    if (data->hash_table[j].dev1)
+      sz+=sprintf (page+sz, "/%s] ",
+		   partition_name(data->hash_table[j].dev1->dev));
+    else
+      sz+=sprintf (page+sz, "] ");
+  }
+
+  sz+=sprintf (page+sz, "\n");
+#endif
+  return sz;
+}
+
+
+static struct md_personality linear_personality=
+{
+  "linear",
+  linear_map,
+  linear_run,
+  linear_stop,
+  linear_status,
+  0
+};
+
+
+void linear_init (void)
+{
+  register_md_personality (LINEAR, &linear_personality);
+}
+
diff -u --recursive --new-file /usr/src/linux/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
--- /usr/src/linux/drivers/block/ll_rw_blk.c	Thu Apr 13 21:52:41 1995
+++ linux/drivers/block/ll_rw_blk.c	Thu Apr 13 21:55:30 1995
@@ -233,7 +233,7 @@
  * It disables interrupts so that it can muck with the
  * request-lists in peace.
  */
-static void add_request(struct blk_dev_struct * dev, struct request * req)
+void add_request(struct blk_dev_struct * dev, struct request * req)
 {
 	struct request * tmp;
 	short		 disk_index;
@@ -271,24 +271,27 @@
 	req->next = tmp->next;
 	tmp->next = req;
 
-/* for SCSI devices, call request_fn unconditionally */
-	if (scsi_major(MAJOR(req->dev)))
+/* for SCSI devices, call request_fn unconditionally
+   (MD_MAJOR conflicts with SCSI_TAPE_MAJOR...) */
+	if (scsi_major(MAJOR(req->dev)) && MAJOR(req->dev)!=MD_MAJOR)
 		(dev->request_fn)();
 
 	sti();
 }
 
-static void make_request(int major,int rw, struct buffer_head * bh)
+void make_request(dev_t dev, unsigned int sector,
+		  int rw, struct buffer_head * bh)
 {
-	unsigned int sector, count;
+	unsigned int count;
 	struct request * req;
 	int rw_ahead, max_req;
+	int major=MAJOR(dev);
 
 /* WRITEA/READA is special case - it is not really needed, so if the */
 /* buffer is locked, we just forget about it, else it's a normal read */
 	rw_ahead = (rw == READA || rw == WRITEA);
 	if (rw_ahead) {
-		if (bh->b_lock)
+		if (bh->b_lock && bh->b_dev==bh->b_rdev)
 			return;
 		if (rw == READA)
 			rw = READ;
@@ -300,18 +303,18 @@
 		return;
 	}
 	count = bh->b_size >> 9;
-	sector = bh->b_blocknr * count;
 	if (blk_size[major])
-		if (blk_size[major][MINOR(bh->b_dev)] < (sector + count)>>1) {
+		if (blk_size[major][MINOR(dev)] < (sector + count)>>1) {
 			bh->b_dirt = bh->b_uptodate = 0;
 			bh->b_req = 0;
 			return;
 		}
 	/* Uhhuh.. Nasty dead-lock possible here.. */
-	if (bh->b_lock)
+	if (bh->b_lock && bh->b_dev==bh->b_rdev)
 		return;
 	/* Maybe the above fixes it, and maybe it doesn't boot. Life is interesting */
-	lock_buffer(bh);
+	if (bh->b_dev==bh->b_rdev)
+	  lock_buffer(bh);
 	if ((rw == WRITE && !bh->b_dirt) || (rw == READ && bh->b_uptodate)) {
 		unlock_buffer(bh);
 		return;
@@ -344,7 +347,7 @@
 #endif CONFIG_BLK_DEV_HD
 			req = req->next;
 		while (req) {
-			if (req->dev == bh->b_dev &&
+			if (req->dev == dev &&
 			    !req->sem &&
 			    req->cmd == rw &&
 			    req->sector + req->nr_sectors == sector &&
@@ -358,7 +361,7 @@
 				return;
 			}
 
-			if (req->dev == bh->b_dev &&
+			if (req->dev == dev &&
 			    !req->sem &&
 			    req->cmd == rw &&
 			    req->sector - count == sector &&
@@ -380,7 +383,7 @@
 	}
 
 /* find an unused request. */
-	req = get_request(max_req, bh->b_dev);
+	req = get_request(max_req, dev);
 	sti();
 
 /* if no request available: if rw_ahead, forget it; otherwise try again blocking.. */
@@ -443,7 +446,7 @@
 
 void ll_rw_block(int rw, int nr, struct buffer_head * bh[])
 {
-	unsigned int major;
+	unsigned int major, sector;
 	struct request plug;
 	int correct_size;
 	struct blk_dev_struct * dev;
@@ -499,7 +502,13 @@
 	for (i = 0; i < nr; i++) {
 		if (bh[i]) {
 			bh[i]->b_req = 1;
-			make_request(major, rw, bh[i]);
+			
+			/* Md needs this for redirection and error recovery */
+			bh[i]->b_rdev = bh[i]->b_dev;
+			bh[i]->b_rw = rw;
+
+			sector = bh[i]->b_blocknr * (bh[i]->b_size >> 9);
+			make_request(bh[i]->b_dev, sector, rw, bh[i]);
 			if (rw == READ || rw == READA)
 				kstat.pgpgin++;
 			else
@@ -597,7 +606,10 @@
 #ifdef CONFIG_SBPCD
 	mem_start = sbpcd_init(mem_start, mem_end);
 #endif CONFIG_SBPCD
-	if (ramdisk_size)
+#ifdef CONFIG_BLK_DEV_MD
+	mem_start = md_init(mem_start, mem_end);
+#endif CONFIG_BLK_DEV_MD
+	  if (ramdisk_size)
 		mem_start += rd_init(mem_start, ramdisk_size*1024);
 	return mem_start;
 }
diff -u --recursive --new-file /usr/src/linux/drivers/block/md.c linux/drivers/block/md.c
--- /usr/src/linux/drivers/block/md.c
+++ linux/drivers/block/md.c	Thu Apr 13 21:53:05 1995
@@ -0,0 +1,516 @@
+
+/*
+   md.c : Multiple Devices driver for Linux
+          Copyright (C) 1994, 1995 Marc ZYNGIER
+	  <zyngier@amertume.ufr-info-p7.ibp.fr> or
+	  <maz@gloups.fdn.fr>
+
+   A lot of inspiration came from hd.c ...
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+   
+   You should have received a copy of the GNU General Public License
+   (for example /usr/src/linux/COPYING); if not, write to the Free
+   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
+*/
+
+#include <linux/malloc.h>
+#include <linux/mm.h>
+#include <linux/md.h>
+#include <linux/hdreg.h>
+#include <linux/fs.h>
+#include <linux/blkdev.h>
+#include <errno.h>
+
+#define MAJOR_NR MD_MAJOR
+#define MD_DRIVER
+
+#include "blk.h"
+
+static struct hd_struct md_hd_struct[MAX_MD_DEV];
+static int md_blocksizes[MAX_MD_DEV];
+int md_size[MAX_MD_DEV]={0, };
+
+static void md_geninit (void);
+
+static struct gendisk md_gendisk=
+{
+  MD_MAJOR,
+  "md",
+  0,
+  1,
+  MAX_MD_DEV,
+  md_geninit,
+  md_hd_struct,
+  md_size,
+  MAX_MD_DEV,
+  NULL,
+  NULL
+};
+
+static struct md_personality *pers[MAX_MD_DEV]={NULL, };
+
+struct real_dev devices[MAX_MD_DEV][MAX_REAL];
+struct md_dev md_dev[MAX_MD_DEV];
+
+static struct gendisk *find_gendisk (dev_t dev)
+{
+  struct gendisk *tmp=gendisk_head;
+
+  while (tmp != NULL)
+  {
+    if (tmp->major==MAJOR(dev))
+      return (tmp);
+    
+    tmp=tmp->next;
+  }
+
+  return (NULL);
+}
+
+
+/* Picked up from genhd.c */
+char *partition_name (dev_t dev)
+{
+  static char name[10];		/* This should be long
+				   enough for a device name ! */
+  struct gendisk *hd=find_gendisk (dev);
+  char base_name;
+  int minor=MINOR(dev);
+
+  if (!hd)
+  {
+    printk ("No gendisk entry for dev %04x\n", dev);
+    sprintf (name, "dev %04x", dev);
+    return (name);
+  }
+
+  base_name = (hd->major == IDE1_MAJOR) ? 'c' : 'a';
+  sprintf(name, "%s%c%d",
+	  hd->major_name,
+	  base_name + (minor >> hd->minor_shift),
+	  minor & ((1 << hd->minor_shift) - 1));
+  return (name);
+}
+
+
+static void set_ra (void)
+{
+  int i, j, current=INT_MAX;
+
+  for (i=0; i<MAX_MD_DEV; i++)
+  {
+    if (!md_dev[i].pers)
+      continue;
+    
+    for (j=0; j<MAX_REAL; j++)
+      if (read_ahead[MAJOR(devices[i][j].dev)]<current)
+	current=read_ahead[MAJOR(devices[i][j].dev)];
+  }
+  
+  read_ahead[MD_MAJOR]=current;
+}
+
+
+static int md_ioctl (struct inode *inode, struct file *file,
+                     unsigned int cmd, unsigned long arg)
+{
+  int minor, index, err, current_ra;
+  struct gendisk *gen_real;
+  struct hd_geometry *loc = (struct hd_geometry *) arg;
+
+  if (!suser())
+    return -EACCES;
+
+  if (((minor=MINOR(inode->i_rdev))>=MAX_MD_DEV))
+    return -EINVAL;
+
+  switch (cmd)
+  {
+    case REGISTER_DEV:
+    if (MAJOR((dev_t) arg)==MD_MAJOR || md_dev[minor].nb_dev==MAX_REAL)
+      return -EINVAL;
+
+    if (!fs_may_mount ((dev_t) arg) || md_dev[minor].pers)
+      return -EBUSY;
+
+    if (!(gen_real=find_gendisk ((dev_t) arg)))
+      return -ENOENT;
+
+    index=md_dev[minor].nb_dev++;
+    devices[minor][index].dev=(dev_t) arg;
+
+    /* Lock the device by inserting a dummy inode. This doesn't
+       smeel very good, but I need to be consistent with the
+       mount stuff, specially with fs_may_mount. If someone have
+       a better idea, please help ! */
+    
+    devices[minor][index].inode=get_empty_inode ();
+    devices[minor][index].inode->i_dev=(dev_t) arg; /* don't care about
+						       other fields */
+    insert_inode_hash (devices[minor][index].inode);
+    
+    /* Devices sizes are rounded to a multiple of page (needed for
+       paging). This is NOT done by fdisk when partitionning,
+       but that's a DOS thing anyway... */
+    
+    devices[minor][index].size=gen_real->sizes[MINOR((dev_t) arg)] & (PAGE_MASK>>10);
+    devices[minor][index].offset=index ?
+      (devices[minor][index-1].offset + devices[minor][index-1].size) : 0;
+
+    if (!index)
+      md_size[minor]=devices[minor][index].size;
+    else
+      md_size[minor]+=devices[minor][index].size;
+
+    printk("REGISTER_DEV %s to md%x done\n", partition_name((dev_t) arg), minor);
+    break;
+
+    case START_MD:
+    if (!md_dev[minor].nb_dev)
+      return -EINVAL;
+
+    if (md_dev[minor].pers)
+      return -EBUSY;
+
+    md_dev[minor].repartition=(int) arg;
+    
+    if ((index=PERSONALITY(minor)>>(PERSONALITY_SHIFT)) >= MAX_PERSONALITY ||
+	!pers[index])
+      return -EINVAL;
+
+    md_dev[minor].pers=pers[index];
+
+    if ((err=md_dev[minor].pers->run (minor, md_dev+minor)))
+    {
+      md_dev[minor].pers=NULL;
+      return (err);
+    }
+
+    /* FIXME : We assume here we have blocks
+       that are twice as large as sectors.
+       THIS MAY NOT BE TRUE !!! */
+    md_hd_struct[minor].start_sect=0;
+    md_hd_struct[minor].nr_sects=md_size[minor]<<1;
+
+    /* It would be better to have a per-md-dev read_ahead. Currently,
+       we only use the smallest read_ahead among md-attached devices */
+
+    current_ra=read_ahead[MD_MAJOR];
+    
+    for (index=0; index<md_dev[minor].nb_dev; index++)
+      if (current_ra>read_ahead[MAJOR(devices[minor][index].dev)])
+	current_ra=read_ahead[MAJOR(devices[minor][index].dev)];
+
+    read_ahead[MD_MAJOR]=current_ra;
+    
+    printk ("START_DEV md%x %s\n", minor, pers[index]->name);
+    break;
+
+    case STOP_MD:
+    if (inode->i_count>1 || md_dev[minor].busy>1) /* ioctl : one open channel */
+    {
+      printk ("STOP_MD md%x failed : i_count=%d, busy=%d\n", minor, inode->i_count, md_dev[minor].busy);
+      return -EBUSY;
+    }
+
+    if (md_dev[minor].pers)
+    {
+      /*  The device won't exist anymore -> flush it now */
+      fsync_dev (inode->i_rdev);
+      invalidate_buffers (inode->i_rdev);
+      md_dev[minor].pers->stop (minor, md_dev+minor);
+    }
+
+    /* Remove locks. */
+    for (index=0; index<md_dev[minor].nb_dev; index++)
+      clear_inode (devices[minor][index].inode);
+
+    set_ra ();			/* calculate new read_ahead */
+    
+    md_dev[minor].nb_dev=md_size[minor]=0;
+    md_dev[minor].pers=NULL;
+
+    printk ("STOP_DEV md%x\n", minor);
+    break;
+
+    case BLKGETSIZE:   /* Return device size */
+    if  (!arg)  return -EINVAL;
+    err=verify_area (VERIFY_WRITE, (long *) arg, sizeof(long));
+    if (err)
+      return err;
+    put_fs_long (md_hd_struct[MINOR(inode->i_rdev)].nr_sects, (long *) arg);
+    break;
+
+    case BLKFLSBUF:
+    fsync_dev (inode->i_rdev);
+    invalidate_buffers (inode->i_rdev);
+    break;
+
+    case BLKRASET:
+    if (arg > 0xff)
+      return -EINVAL;
+    read_ahead[MAJOR(inode->i_rdev)] = arg;
+    return 0;
+    
+    case BLKRAGET:
+    if  (!arg)  return -EINVAL;
+    err=verify_area (VERIFY_WRITE, (long *) arg, sizeof(long));
+    if (err)
+      return err;
+    put_fs_long (read_ahead[MAJOR(inode->i_rdev)], (long *) arg);
+    break;
+
+    case HDIO_GETGEO:
+    if (!loc)  return -EINVAL;
+    err = verify_area(VERIFY_WRITE, loc, sizeof(*loc));
+    if (err)
+      return err;
+    put_fs_byte(2, (char *) &loc->heads);
+    put_fs_byte(4, (char *) &loc->sectors);
+    put_fs_word(md_hd_struct[minor].nr_sects/8, (short *) &loc->cylinders);
+    put_fs_long(md_hd_struct[MINOR(inode->i_rdev)].start_sect,
+		(long *) &loc->start);
+    break;
+    
+    default:
+    printk ("Unknown md_ioctl %d\n", cmd);
+    return -EINVAL;
+  }
+
+  return (0);
+}
+
+
+static int md_open (struct inode *inode, struct file *file)
+{
+  int minor=MINOR(inode->i_rdev);
+
+  md_dev[minor].busy++;
+  /* printk ("md_open called. busy[%d] is now %d\n", minor, busy[minor]);*/
+  return (0);			/* Always succed */
+}
+
+
+static void md_release (struct inode *inode, struct file *file)
+{
+  int minor=MINOR(inode->i_rdev);
+
+  sync_dev (inode->i_rdev);
+  md_dev[minor].busy--;
+}
+
+
+static struct file_operations md_fops=
+{
+  NULL,
+  block_read,
+  block_write,
+  NULL,
+  NULL,
+  md_ioctl,
+  NULL,
+  md_open,
+  md_release,
+  block_fsync
+};
+
+
+static inline int requeue_request (int minor, struct request *req)
+{
+  if (!md_dev[minor].pers)
+  {
+    printk ("Oops ! md_dev[%04x].pers=NULL\n", minor);
+    return -1;
+  }
+
+  return (md_dev[minor].pers->map(minor, md_dev+minor, req));
+}
+
+static void do_md_request (void)
+{
+  int minor;
+
+  while (1)
+  {
+    INIT_REQUEST;
+    minor=MINOR(CURRENT->dev);
+    
+    switch (requeue_request (minor, CURRENT))
+    {
+      case -1:
+      end_request (0);		/* Fail the usual way */
+      break;
+
+      case 0:			/* Allright, redirection was succesful */
+      break;
+
+      default:
+      end_request (1);		/* Recovered error using redundancy */
+    }
+  }
+}
+
+
+static void md_geninit (void)
+{
+  int i;
+  
+  for(i=0;i<MAX_MD_DEV;i++)
+  {
+    md_blocksizes[i] = 1024;
+    md_gendisk.part[i].start_sect=-1;
+    md_dev[i].pers=NULL;
+  }
+
+  blksize_size[MAJOR_NR] = md_blocksizes;
+}
+
+
+int get_md_status (char *page)
+{
+  int sz=0, i, j;
+
+  sz+=sprintf( page+sz, "Personalities : ");
+  for (i=0; i<MAX_PERSONALITY; i++)
+    if (pers[i])
+      sz+=sprintf (page+sz, "[%d %s] ", i, pers[i]->name);
+
+  page[sz-1]='\n';
+
+  sz+=sprintf (page+sz, "read_ahead %d sectors\n", read_ahead[MD_MAJOR]);
+  
+  for (i=0; i<MAX_MD_DEV; i++)
+  {
+    sz+=sprintf (page+sz, "md%d : %sactive", i, md_dev[i].pers ? "" : "in");
+
+    if (md_dev[i].pers)
+      sz+=sprintf (page+sz, " %s", md_dev[i].pers->name);
+
+    for (j=0; j<md_dev[i].nb_dev; j++)
+      sz+=sprintf (page+sz, " %s", partition_name(devices[i][j].dev));
+
+    if (md_dev[i].nb_dev)
+      sz+=sprintf (page+sz, " %d blocks\n", md_size[i]);
+    else
+      sz+=sprintf (page+sz, "\n");
+
+    if (!md_dev[i].pers)
+      continue;
+
+    sz+=md_dev[i].pers->status (page+sz, i, md_dev+i);
+  }
+  
+  return (sz);
+}
+
+void md_valid_device (int minor, dev_t dev, int mode)
+{
+  int i;
+
+  for (i=0; i<md_dev[minor].nb_dev; i++)
+    if (devices[minor][i].dev==dev)
+      break;
+
+  if (i>md_dev[minor].nb_dev)
+  {
+    printk ("Oops, dev %04x not found in md_valid_device\n", dev);
+    return;
+  }
+
+  switch (mode)
+  {
+    case VALID:
+    /* Don't consider INVALID_NEXT as a real invalidation.
+       Maybe that's not the good way to treat such a thing,
+       we'll see. */
+    if (devices[minor][i].invalid==INVALID_ALWAYS)
+    {
+      devices[minor][i].fault_count=0; /* reset fault count */
+      if (md_dev[minor].invalid_dev_count)
+	md_dev[minor].invalid_dev_count--;
+    }
+    break;
+
+    case INVALID:
+    if (devices[minor][i].invalid != VALID )
+      return;			/* Don't invalidate twice */
+    
+    if (++devices[minor][i].fault_count > MAX_FAULT(minor) &&
+	MAX_FAULT(minor)!=0xFF)
+    {
+      /* We cannot tolerate this fault.
+	 So sing a song, and say GoodBye to this device... */
+      
+      mode=INVALID_ALWAYS;
+      md_dev[minor].invalid_dev_count++;
+    }
+    else
+      /* FIXME :
+	 If we reached the max_invalid_dev count, doing one
+	 more invalidation will kill the md_dev. So we choose
+	 not to invalid the physical dev in such a case. But
+	 next access will probably fail... */
+      if (md_dev[minor].invalid_dev_count<=md_dev[minor].pers->max_invalid_dev)
+	mode=INVALID_NEXT;
+      else
+	mode=VALID;
+  }
+  
+  devices[minor][i].invalid=mode;
+}
+
+
+int md_can_reemit (int minor)
+{
+  return(md_dev[minor].pers->max_invalid_dev &&
+	 md_dev[minor].invalid_dev_count<=md_dev[minor].pers->max_invalid_dev);
+}
+
+
+int register_md_personality (int p_num, struct md_personality *p)
+{
+  int i=(p_num >> PERSONALITY_SHIFT);
+
+  if (i >= MAX_PERSONALITY)
+    return -EINVAL;
+
+  pers[i]=p;
+
+  printk ("%s personality registered\n", p->name);
+  
+  return 0;
+}
+
+void raid0_init (void);
+void linear_init (void);
+
+unsigned long md_init (unsigned long mem_start,
+		       unsigned long mem_long)
+{
+  printk ("md driver %s MAX_MD_DEV=%d, MAX_REAL=%d\n", MD_VERSION, MAX_MD_DEV, MAX_REAL);
+
+  if (register_blkdev (MD_MAJOR, "md", &md_fops))
+  {
+    printk ("Unable to get major %d for md\n", MD_MAJOR);
+    return (mem_start);
+  }
+
+  blk_dev[MD_MAJOR].request_fn=DEVICE_REQUEST;
+  read_ahead[MD_MAJOR]=INT_MAX;
+  md_gendisk.next=gendisk_head;
+
+  gendisk_head=&md_gendisk;
+
+#ifdef CONFIG_MD_LINEAR
+  linear_init ();
+#endif
+#ifdef CONFIG_MD_STRIPED
+  raid0_init ();
+#endif
+  
+  return (mem_start);
+}
diff -u --recursive --new-file /usr/src/linux/drivers/block/raid0.c linux/drivers/block/raid0.c
--- /usr/src/linux/drivers/block/raid0.c
+++ linux/drivers/block/raid0.c	Thu Apr 13 21:53:05 1995
@@ -0,0 +1,258 @@
+
+#include <linux/md.h>
+#include <linux/raid0.h>
+#include <linux/malloc.h>
+
+#define MAJOR_NR MD_MAJOR
+#define MD_DRIVER
+#define MD_PERSONALITY
+
+#include "blk.h"
+
+static void create_strip_zones (int minor, struct md_dev *md_dev)
+{
+  int i, j, c=0;
+  int current_offset=0;
+  struct real_dev *smallest_by_zone;
+  struct raid0_data *data=(struct raid0_data *) md_dev->private;
+  
+  data->nr_strip_zones=1;
+  
+  for (i=1; i<md_dev->nb_dev; i++)
+  {
+    for (j=0; j<i; j++)
+      if (devices[minor][i].size==devices[minor][j].size)
+      {
+	c=1;
+	break;
+      }
+
+    if (!c)
+      data->nr_strip_zones++;
+
+    c=0;
+  }
+
+  data->strip_zone=kmalloc (sizeof(struct strip_zone)*data->nr_strip_zones,
+			      GFP_KERNEL);
+
+  data->smallest=NULL;
+  
+  for (i=0; i<data->nr_strip_zones; i++)
+  {
+    data->strip_zone[i].dev_offset=current_offset;
+    smallest_by_zone=NULL;
+    c=0;
+
+    for (j=0; j<md_dev->nb_dev; j++)
+      if (devices[minor][j].size>current_offset)
+      {
+	data->strip_zone[i].dev[c++]=devices[minor]+j;
+	if (!smallest_by_zone ||
+	    smallest_by_zone->size > devices[minor][j].size)
+	  smallest_by_zone=devices[minor]+j;
+      }
+
+    data->strip_zone[i].nb_dev=c;
+    data->strip_zone[i].size=(smallest_by_zone->size-current_offset)*c;
+
+    if (!data->smallest ||
+	data->smallest->size > data->strip_zone[i].size)
+      data->smallest=data->strip_zone+i;
+
+    data->strip_zone[i].zone_offset=i ? (data->strip_zone[i-1].zone_offset+
+					   data->strip_zone[i-1].size) : 0;
+    current_offset=smallest_by_zone->size;
+  }
+}
+
+static int raid0_run (int minor, struct md_dev *md_dev)
+{
+  int current=0, i=0, size, zone0_size, nb_zone, min;
+  struct raid0_data *data;
+
+  min=1 << FACTOR_SHIFT(FACTOR(minor));
+  
+  for (i=0; i<md_dev->nb_dev; i++)
+    if (devices[minor][i].size<min)
+    {
+      printk ("Cannot use %dk chunks on dev %s\n", min,
+	      partition_name (devices[minor][i].dev));
+      return -EINVAL;
+    }
+  
+  /* Resize devices according to the factor */
+  md_size[minor]=0;
+  
+  for (i=0; i<md_dev->nb_dev; i++)
+  {
+    devices[minor][i].size &= ~((1 << FACTOR_SHIFT(FACTOR(minor))) - 1);
+    md_size[minor] += devices[minor][i].size;
+  }
+
+  md_dev->private=kmalloc (sizeof (struct raid0_data), GFP_KERNEL);
+  data=(struct raid0_data *) md_dev->private;
+  
+  create_strip_zones (minor, md_dev);
+
+  nb_zone=data->nr_zones=
+    md_size[minor]/data->smallest->size +
+    (md_size[minor]%data->smallest->size ? 1 : 0);
+  
+  data->hash_table=kmalloc (sizeof (struct raid0_hash)*nb_zone, GFP_KERNEL);
+
+  size=data->strip_zone[current].size;
+
+  i=0;
+  while (current<data->nr_strip_zones)
+  {
+    data->hash_table[i].zone0=data->strip_zone+current;
+
+    if (size>=data->smallest->size)/* If we completly fill the slot */
+    {
+      data->hash_table[i++].zone1=NULL;
+      size-=data->smallest->size;
+
+      if (!size)
+      {
+	if (++current==data->nr_strip_zones) continue;
+	size=data->strip_zone[current].size;
+      }
+
+      continue;
+    }
+
+    if (++current==data->nr_strip_zones) /* Last dev, set unit1 as NULL */
+    {
+      data->hash_table[i].zone1=NULL;
+      continue;
+    }
+
+    zone0_size=size;		/* Here, we use a 2nd dev to fill the slot */
+    size=data->strip_zone[current].size;
+    data->hash_table[i++].zone1=data->strip_zone+current;
+    size-=(data->smallest->size - zone0_size);
+  }
+
+  return (0);
+}
+
+
+static int raid0_stop (int minor, struct md_dev *md_dev)
+{
+  struct raid0_data *data=(struct raid0_data *) md_dev->private;
+
+  kfree (data->hash_table);
+  kfree (data->strip_zone);
+  kfree (data);
+
+  return 0;
+}
+
+
+static int raid0_map (int minor, struct md_dev *md_dev, struct request *req)
+{
+  struct raid0_data *data=(struct raid0_data *) md_dev->private;
+  static struct raid0_hash *hash;
+  struct strip_zone *zone;
+  struct real_dev *tmp_dev;
+  int blk_in_chunk, factor, chunk, rw;
+  long block, rblock;
+  struct buffer_head *bh;
+
+  factor=FACTOR(minor);
+  block=req->sector >> 1;
+  hash=data->hash_table+(block/data->smallest->size);
+
+  if (block >= (hash->zone0->size +
+		hash->zone0->zone_offset))
+  {
+    if (!hash->zone1)
+      printk ("raid0_map : hash->zone1==NULL for block %ld\n", block);
+    zone=hash->zone1;
+  }
+  else
+    zone=hash->zone0;
+  
+  blk_in_chunk=block & ((1UL << FACTOR_SHIFT(factor)) - 1);
+  chunk=(block - zone->zone_offset) / (zone->nb_dev<<FACTOR_SHIFT(factor));
+  tmp_dev=zone->dev[(block >> FACTOR_SHIFT(factor)) % zone->nb_dev];
+  rblock=(chunk << FACTOR_SHIFT(factor)) + blk_in_chunk + zone->dev_offset;
+
+  if ((bh=req->bh))		/* This a buffer request */
+  {
+    if (req->cmd==WRITE)
+      mark_buffer_dirty (bh, 0);/* re-dirtyfy buffer ! */
+
+    rw=req->cmd;
+    end_redirect ();		/* Must be done BEFORE redirection ! */
+    bh->b_rdev=tmp_dev->dev;
+    make_request (tmp_dev->dev, rblock*(bh->b_size>>9), rw, bh);
+  }
+  else				/* This is a paging request */
+  {
+    CURRENT=req->next;
+    req->next=NULL;
+    req->dev=tmp_dev->dev;
+    req->sector=rblock << 1;
+    add_request (blk_dev+MAJOR (tmp_dev->dev), req);
+  }
+
+  return 0;
+}
+
+
+static int raid0_status (char *page, int minor, struct md_dev *md_dev)
+{
+  int sz=0;
+#undef MD_DEBUG
+#ifdef MD_DEBUG
+  int j, k;
+  struct raid0_data *data=(struct raid0_data *) md_dev->private;
+  
+  sz+=sprintf (page+sz, "      ");
+  for (j=0; j<data->nr_zones; j++)
+  {
+    sz+=sprintf (page+sz, "[z%d",
+		 data->hash_table[j].zone0-data->strip_zone);
+    if (data->hash_table[j].zone1)
+      sz+=sprintf (page+sz, "/z%d] ",
+		   data->hash_table[j].zone1-data->strip_zone);
+    else
+      sz+=sprintf (page+sz, "] ");
+  }
+  
+  sz+=sprintf (page+sz, "\n");
+  
+  for (j=0; j<data->nr_strip_zones; j++)
+  {
+    sz+=sprintf (page+sz, "      z%d=[", j);
+    for (k=0; k<data->strip_zone[j].nb_dev; k++)
+      sz+=sprintf (page+sz, "%s/",
+		   partition_name(data->strip_zone[j].dev[k]->dev));
+    sz--;
+    sz+=sprintf (page+sz, "] zo=%d do=%d s=%d\n",
+		 data->strip_zone[j].zone_offset,
+		 data->strip_zone[j].dev_offset,
+		 data->strip_zone[j].size);
+  }
+#endif
+  return sz;
+}
+
+
+static struct md_personality raid0_personality=
+{
+  "raid0",
+  raid0_map,
+  raid0_run,
+  raid0_stop,
+  raid0_status,
+  0
+};
+
+
+void raid0_init (void)
+{
+  register_md_personality (RAID0, &raid0_personality);
+}
diff -u --recursive --new-file /usr/src/linux/fs/proc/array.c linux/fs/proc/array.c
--- /usr/src/linux/fs/proc/array.c	Sat Apr  8 08:06:06 1995
+++ linux/fs/proc/array.c	Thu Apr 13 21:53:05 1995
@@ -44,6 +44,10 @@
 #include <linux/delay.h>
 #include <linux/mm.h>
 
+#ifdef CONFIG_BLK_DEV_MD
+#include <linux/md.h>
+#endif
+
 #include <asm/segment.h>
 #include <asm/pgtable.h>
 #include <asm/io.h>
@@ -805,6 +809,11 @@
 
 		case PROC_IOPORTS:
 			return get_ioport_list(page);
+
+#ifdef CONFIG_BLK_DEV_MD
+		case PROC_MD:
+			return get_md_status(page);
+#endif
 	}
 	return -EBADF;
 }
diff -u --recursive --new-file /usr/src/linux/fs/proc/root.c linux/fs/proc/root.c
--- /usr/src/linux/fs/proc/root.c	Sat Jan 14 08:32:18 1995
+++ linux/fs/proc/root.c	Thu Apr 13 21:53:05 1995
@@ -80,6 +80,9 @@
 #ifdef CONFIG_PROFILE
 	{ PROC_PROFILE,		7, "profile"},
 #endif
+#ifdef CONFIG_BLK_DEV_MD
+	{ PROC_MD,              6, "mdstat"},
+#endif
 };
 
 #define NR_ROOT_DIRENTRY ((sizeof (root_dir))/(sizeof (root_dir[0])))
diff -u --recursive --new-file /usr/src/linux/include/linux/blkdev.h linux/include/linux/blkdev.h
--- /usr/src/linux/include/linux/blkdev.h	Sun Jan  1 18:22:18 1995
+++ linux/include/linux/blkdev.h	Thu Apr 13 21:53:05 1995
@@ -40,6 +40,11 @@
 extern struct wait_queue * wait_for_request;
 extern void resetup_one_dev(struct gendisk *dev, int drive);
 
+/* md needs those functions to requeue requests */
+extern void add_request(struct blk_dev_struct * dev, struct request * req);
+extern void make_request(dev_t dev, unsigned int sector,
+			 int rw, struct buffer_head * bh);
+
 extern int * blk_size[MAX_BLKDEV];
 
 extern int * blksize_size[MAX_BLKDEV];
diff -u --recursive --new-file /usr/src/linux/include/linux/fs.h linux/include/linux/fs.h
--- /usr/src/linux/include/linux/fs.h	Sat Mar  4 20:20:07 1995
+++ linux/include/linux/fs.h	Thu Apr 13 21:53:05 1995
@@ -133,7 +133,9 @@
 	unsigned long b_size;		/* block size */
 	unsigned long b_blocknr;	/* block number */
 	dev_t b_dev;			/* device (0 = free) */
+	dev_t b_rdev;		        /* Real device */
 	unsigned short b_count;		/* users using this block */
+	char b_rw;		        /* Used last for read or write */
 	unsigned char b_uptodate;
 	unsigned char b_dirt;		/* 0-clean,1-dirty */
 	unsigned char b_lock;		/* 0 - ok, 1 -locked */
diff -u --recursive --new-file /usr/src/linux/include/linux/linear.h linux/include/linux/linear.h
--- /usr/src/linux/include/linux/linear.h
+++ linux/include/linux/linear.h	Thu Apr 13 21:53:05 1995
@@ -0,0 +1,17 @@
+
+#ifndef _LINEAR_H
+#define _LINEAR_H
+
+struct linear_hash
+{
+  struct real_dev *dev0, *dev1;
+};
+
+struct linear_data
+{
+  struct linear_hash *hash_table; /* Dynamically allocated */
+  struct real_dev *smallest;
+  int nr_zones;
+};
+
+#endif
diff -u --recursive --new-file /usr/src/linux/include/linux/major.h linux/include/linux/major.h
--- /usr/src/linux/include/linux/major.h	Thu Apr 13 21:52:44 1995
+++ linux/include/linux/major.h	Thu Apr 13 21:53:05 1995
@@ -26,7 +26,7 @@
  *  6 - lp
  *  7 - /dev/vcs*
  *  8 -                        scsi disk
- *  9 - scsi tape
+ *  9 - scsi tape              multiple devices driver
  * 10 - mice
  * 11 -                        scsi cdrom
  * 12 - qic02 tape
@@ -60,6 +60,7 @@
 #define VCS_MAJOR	7
 #define SCSI_DISK_MAJOR	8
 #define SCSI_TAPE_MAJOR	9
+#define MD_MAJOR        9
 #define MOUSE_MAJOR	10
 #define SCSI_CDROM_MAJOR 11
 #define QIC02_TAPE_MAJOR 12
diff -u --recursive --new-file /usr/src/linux/include/linux/md.h linux/include/linux/md.h
--- /usr/src/linux/include/linux/md.h
+++ linux/include/linux/md.h	Thu Apr 13 21:53:05 1995
@@ -0,0 +1,125 @@
+
+/*
+   md.h : Multiple Devices driver for Linux
+          Copyright (C) 1994, 1995 Marc ZYNGIER
+	  <zyngier@amertume.ufr-info-p7.ibp.fr> or
+	  <maz@gloups.fdn.fr>
+	  
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+   
+   You should have received a copy of the GNU General Public License
+   (for example /usr/src/linux/COPYING); if not, write to the Free
+   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
+*/
+
+#ifndef _MD_H
+#define _MD_H
+
+#include <sys/types.h>
+#include <linux/fs.h>
+#include <linux/major.h>
+#include <linux/mm.h>
+#include <linux/blkdev.h>
+
+#define MD_VERSION "v0.19"
+
+/* ioctls */
+#define REGISTER_DEV (MD_MAJOR<<8 | 1)
+#define START_MD     (MD_MAJOR<<8 | 2)
+#define STOP_MD      (MD_MAJOR<<8 | 3)
+
+/*
+   personalities :
+   Byte 0 : Chunk size factor
+   Byte 1 : Fault tolerance count for each physical device
+            (   0 means no fault tolerance,
+             0xFF means always tolerate faults)
+   Byte 2 : Personality
+   Byte 3 : Reserved.
+ */
+
+#define FAULT_SHIFT       8
+#define PERSONALITY_SHIFT 16
+
+#define FACTOR_MASK       0xFFUL
+#define FAULT_MASK        0xFF00UL
+#define PERSONALITY_MASK  0xFF0000UL
+
+#define RESERVED          0	/* Not used by now */
+#define LINEAR            (1UL << PERSONALITY_SHIFT)
+#define STRIPED           (2UL << PERSONALITY_SHIFT)
+#define RAID0             STRIPED
+#define STRIPPED          STRIPED /* Long lasting spelling mistake... */
+
+#define MAX_PERSONALITY   4
+
+#ifdef __KERNEL__
+
+#define MAX_REAL     8
+#define MAX_MD_DEV   4
+
+#define FACTOR(a)         (md_dev[(a)].repartition & FACTOR_MASK)
+#define MAX_FAULT(a)      ((md_dev[(a)].repartition & FAULT_MASK)>>8)
+#define PERSONALITY(a)    (md_dev[(a)].repartition & PERSONALITY_MASK)
+
+#define FACTOR_SHIFT(a) (PAGE_SHIFT + (a) - 10)
+
+/* Invalidation modes */
+#define VALID          0
+#define INVALID_NEXT   1
+#define INVALID_ALWAYS 2
+#define INVALID        3	/* Only useful to md_valid_device */
+
+struct real_dev
+{
+  dev_t dev;			/* Device number */
+  int size;			/* Device size (in blocks) */
+  int offset;			/* Real device offset (in blocks) in md dev
+				   (only used in linear mode) */
+  struct inode *inode;		/* Lock inode */
+  int fault_count;		/* Fault counter for invalidation */
+  int invalid;			/* Indicate if the device is disabled :
+				   VALID          - valid
+				   INVALID_NEXT   - disabled for next access
+				   INVALID_ALWAYS - permanently disabled
+				   (for redundancy modes only) */
+};
+
+struct md_dev;
+
+struct md_personality
+{
+  char *name;
+  int (*map)(int minor, struct md_dev *md_dev, struct request *req);
+  int (*run)(int minor, struct md_dev *md_dev);
+  int (*stop)(int minor, struct md_dev *md_dev);
+  int (*status)(char *page, int minor, struct md_dev *md_dev);
+  int max_invalid_dev;
+};
+
+struct md_dev
+{
+  struct md_personality *pers;
+  int repartition;
+  int invalid_dev_count;
+  int busy;
+  int nb_dev;
+  void *private;
+};
+
+extern struct real_dev devices[MAX_MD_DEV][MAX_REAL];
+extern struct md_dev md_dev[MAX_MD_DEV];
+extern int md_size[MAX_MD_DEV];
+
+extern int get_md_status (char *page);
+char *partition_name (dev_t dev);
+extern void md_valid_device (int minor, dev_t dev, int mode);
+extern int md_can_reemit (int minor);
+
+extern int register_md_personality (int p_num, struct md_personality *p);
+
+#endif __KERNEL__
+#endif _MD_H
diff -u --recursive --new-file /usr/src/linux/include/linux/proc_fs.h linux/include/linux/proc_fs.h
--- /usr/src/linux/include/linux/proc_fs.h	Thu Feb 16 22:28:39 1995
+++ linux/include/linux/proc_fs.h	Thu Apr 13 21:53:05 1995
@@ -30,7 +30,10 @@
 	PROC_KSYMS,
 	PROC_DMA,	
 	PROC_IOPORTS,
-	PROC_PROFILE /* whether enabled or not */
+	PROC_PROFILE, /* whether enabled or not */
+#ifdef CONFIG_BLK_DEV_MD
+	PROC_MD
+#endif
 };
 
 enum pid_directory_inos {
diff -u --recursive --new-file /usr/src/linux/include/linux/raid0.h linux/include/linux/raid0.h
--- /usr/src/linux/include/linux/raid0.h
+++ linux/include/linux/raid0.h	Thu Apr 13 21:53:06 1995
@@ -0,0 +1,28 @@
+
+#ifndef _RAID0_H
+#define _RAID0_H
+
+struct strip_zone
+{
+  int zone_offset;		/* Zone offset in md_dev */
+  int dev_offset;		/* Zone offset in real dev */
+  int size;			/* Zone size */
+  int nb_dev;			/* Number of devices attached to the zone */
+  struct real_dev *dev[MAX_REAL]; /* Devices attached to the zone */
+};
+
+struct raid0_hash
+{
+  struct strip_zone *zone0, *zone1;
+};
+
+struct raid0_data
+{
+  struct raid0_hash *hash_table; /* Dynamically allocated */
+  struct strip_zone *strip_zone; /* This one too */
+  int nr_strip_zones;
+  struct strip_zone *smallest;
+  int nr_zones;
+};
+
+#endif
