summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/blkdev.h3
-rw-r--r--include/linux/cyclades.h10
-rw-r--r--include/linux/dasd.h225
-rw-r--r--include/linux/fb.h3
-rw-r--r--include/linux/genhd.h30
-rw-r--r--include/linux/kernel_stat.h13
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h48
-rw-r--r--include/linux/pagemap.h1
-rw-r--r--include/linux/raid/md.h2
-rw-r--r--include/linux/raid/md_k.h41
-rw-r--r--include/linux/raid/raid1.h79
-rw-r--r--include/linux/raid/raid5.h118
-rw-r--r--include/linux/raid/xor.h12
-rw-r--r--include/linux/sysctl.h9
14 files changed, 563 insertions, 31 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index fb673b0af..371069369 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -163,4 +163,7 @@ extern int * max_segments[MAX_BLKDEV];
#define blkdev_next_request(req) blkdev_entry_to_request((req)->queue.next)
#define blkdev_prev_request(req) blkdev_entry_to_request((req)->queue.prev)
+extern void drive_stat_acct (kdev_t dev, int rw,
+ unsigned long nr_sectors, int new_io);
+
#endif
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 9aff2f0af..7452d838d 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -7,6 +7,10 @@
*
* This file contains the general definitions for the cyclades.c driver
*$Log: cyclades.h,v $
+ *Revision 3.1 2000/04/19 18:52:52 ivan
+ *converted address fields to unsigned long and added fields for physical
+ *addresses on cyclades_card structure;
+ *
*Revision 3.0 1998/11/02 14:20:59 ivan
*added nports field on cyclades_card structure;
*
@@ -500,8 +504,10 @@ struct ZFW_CTRL {
/* Per card data structure */
struct cyclades_card {
- long base_addr;
- long ctl_addr;
+ unsigned long base_phys;
+ unsigned long ctl_phys;
+ unsigned long base_addr;
+ unsigned long ctl_addr;
int irq;
int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */
int first_line; /* minor number of first channel on card */
diff --git a/include/linux/dasd.h b/include/linux/dasd.h
new file mode 100644
index 000000000..98c3c0424
--- /dev/null
+++ b/include/linux/dasd.h
@@ -0,0 +1,225 @@
+
+#ifndef DASD_H
+#define DASD_H
+
+/* First of all the external stuff */
+#include <linux/ioctl.h>
+#include <linux/major.h>
+#include <linux/wait.h>
+
+#define IOCTL_LETTER 'D'
+#define BIODASDFORMAT _IO(IOCTL_LETTER,0) /* Format the volume or an extent */
+#define BIODASDDISABLE _IO(IOCTL_LETTER,1) /* Disable the volume (for Linux) */
+#define BIODASDENABLE _IO(IOCTL_LETTER,2) /* Enable the volume (for Linux) */
+/* Stuff for reading and writing the Label-Area to/from user space */
+#define BIODASDGTVLBL _IOR(IOCTL_LETTER,3,dasd_volume_label_t)
+#define BIODASDSTVLBL _IOW(IOCTL_LETTER,4,dasd_volume_label_t)
+#define BIODASDRWTB _IOWR(IOCTL_LETTER,5,int)
+#define BIODASDRSID _IOR(IOCTL_LETTER,6,senseid_t)
+
+typedef
+union {
+ char bytes[512];
+ struct {
+ /* 80 Bytes of Label data */
+ char identifier[4]; /* e.g. "LNX1", "VOL1" or "CMS1" */
+ char label[6]; /* Given by user */
+ char security;
+ char vtoc[5]; /* Null in "LNX1"-labelled partitions */
+ char reserved0[5];
+ long ci_size;
+ long blk_per_ci;
+ long lab_per_ci;
+ char reserved1[4];
+ char owner[0xe];
+ char no_part;
+ char reserved2[0x1c];
+ /* 16 Byte of some information on the dasd */
+ short blocksize;
+ char nopart;
+ char unused;
+ long unused2[3];
+ /* 7*10 = 70 Bytes of partition data */
+ struct {
+ char type;
+ long start;
+ long size;
+ char unused;
+ } part[7];
+ } __attribute__ ((packed)) label;
+} dasd_volume_label_t;
+
+typedef union {
+ struct {
+ unsigned long no;
+ unsigned int ct;
+ } __attribute__ ((packed)) input;
+ struct {
+ unsigned long noct;
+ } __attribute__ ((packed)) output;
+} __attribute__ ((packed)) dasd_xlate_t;
+
+int dasd_init (void);
+#ifdef MODULE
+int init_module (void);
+void cleanup_module (void);
+#endif /* MODULE */
+
+/* Definitions for blk.h */
+/* #define DASD_MAGIC 0x44415344 is ascii-"DASD" */
+/* #define dasd_MAGIC 0x64617364; is ascii-"dasd" */
+#define DASD_MAGIC 0xC4C1E2C4 /* is ebcdic-"DASD" */
+#define dasd_MAGIC 0x8481A284 /* is ebcdic-"dasd" */
+#define DASD_NAME "dasd"
+#define DASD_PARTN_BITS 2
+#define DASD_MAX_DEVICES (256>>DASD_PARTN_BITS)
+
+#define MAJOR_NR DASD_MAJOR
+#define PARTN_BITS DASD_PARTN_BITS
+
+#ifdef __KERNEL__
+/* Now lets turn to the internal sbtuff */
+/*
+ define the debug levels:
+ - 0 No debugging output to console or syslog
+ - 1 Log internal errors to syslog, ignore check conditions
+ - 2 Log internal errors and check conditions to syslog
+ - 3 Log internal errors to console, log check conditions to syslog
+ - 4 Log internal errors and check conditions to console
+ - 5 panic on internal errors, log check conditions to console
+ - 6 panic on both, internal errors and check conditions
+ */
+#define DASD_DEBUG 4
+
+#define DASD_PROFILE
+/*
+ define the level of paranoia
+ - 0 quite sure, that things are going right
+ - 1 sanity checking, only to avoid panics
+ - 2 normal sanity checking
+ - 3 extensive sanity checks
+ - 4 exhaustive debug messages
+ */
+#define DASD_PARANOIA 2
+
+/*
+ define the depth of flow control, which is logged as a check condition
+ - 0 No flow control messages
+ - 1 Entry of functions logged like check condition
+ - 2 Entry and exit of functions logged like check conditions
+ - 3 Internal structure broken down
+ - 4 unrolling of loops,...
+ */
+#define DASD_FLOW_CONTROL 0
+
+#if DASD_DEBUG > 0
+#define PRINT_DEBUG(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
+#define PRINT_INFO(x...) printk ( KERN_INFO PRINTK_HEADER x )
+#define PRINT_WARN(x...) printk ( KERN_WARNING PRINTK_HEADER x )
+#define PRINT_ERR(x...) printk ( KERN_ERR PRINTK_HEADER x )
+#define PRINT_FATAL(x...) panic ( PRINTK_HEADER x )
+#else
+#define PRINT_DEBUG(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
+#define PRINT_INFO(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
+#define PRINT_WARN(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
+#define PRINT_ERR(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
+#define PRINT_FATAL(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
+#endif /* DASD_DEBUG */
+
+#define INTERNAL_ERRMSG(x,y...) \
+"Internal error: in file " __FILE__ " line: %d: " x, __LINE__, y
+#define INTERNAL_CHKMSG(x,y...) \
+"Inconsistency: in file " __FILE__ " line: %d: " x, __LINE__, y
+#define INTERNAL_FLWMSG(x,y...) \
+"Flow control: file " __FILE__ " line: %d: " x, __LINE__, y
+
+#if DASD_DEBUG > 4
+#define INTERNAL_ERROR(x...) PRINT_FATAL ( INTERNAL_ERRMSG ( x ) )
+#elif DASD_DEBUG > 2
+#define INTERNAL_ERROR(x...) PRINT_ERR ( INTERNAL_ERRMSG ( x ) )
+#elif DASD_DEBUG > 0
+#define INTERNAL_ERROR(x...) PRINT_WARN ( INTERNAL_ERRMSG ( x ) )
+#else
+#define INTERNAL_ERROR(x...)
+#endif /* DASD_DEBUG */
+
+#if DASD_DEBUG > 5
+#define INTERNAL_CHECK(x...) PRINT_FATAL ( INTERNAL_CHKMSG ( x ) )
+#elif DASD_DEBUG > 3
+#define INTERNAL_CHECK(x...) PRINT_ERR ( INTERNAL_CHKMSG ( x ) )
+#elif DASD_DEBUG > 1
+#define INTERNAL_CHECK(x...) PRINT_WARN ( INTERNAL_CHKMSG ( x ) )
+#else
+#define INTERNAL_CHECK(x...)
+#endif /* DASD_DEBUG */
+
+#if DASD_DEBUG > 3
+#define INTERNAL_FLOW(x...) PRINT_ERR ( INTERNAL_FLWMSG ( x ) )
+#elif DASD_DEBUG > 2
+#define INTERNAL_FLOW(x...) PRINT_WARN ( INTERNAL_FLWMSG ( x ) )
+#else
+#define INTERNAL_FLOW(x...)
+#endif /* DASD_DEBUG */
+
+#if DASD_FLOW_CONTROL > 0
+#define FUNCTION_ENTRY(x) INTERNAL_FLOW( x "entered %s\n","" );
+#else
+#define FUNCTION_ENTRY(x)
+#endif /* DASD_FLOW_CONTROL */
+
+#if DASD_FLOW_CONTROL > 1
+#define FUNCTION_EXIT(x) INTERNAL_FLOW( x "exited %s\n","" );
+#else
+#define FUNCTION_EXIT(x)
+#endif /* DASD_FLOW_CONTROL */
+
+#if DASD_FLOW_CONTROL > 2
+#define FUNCTION_CONTROL(x...) INTERNAL_FLOW( x );
+#else
+#define FUNCTION_CONTROL(x...)
+#endif /* DASD_FLOW_CONTROL */
+
+#if DASD_FLOW_CONTROL > 3
+#define LOOP_CONTROL(x...) INTERNAL_FLOW( x );
+#else
+#define LOOP_CONTROL(x...)
+#endif /* DASD_FLOW_CONTROL */
+
+#define DASD_DO_IO_SLEEP 0x01
+#define DASD_DO_IO_NOLOCK 0x02
+#define DASD_DO_IO_NODEC 0x04
+
+#define DASD_NOT_FORMATTED 0x01
+
+extern wait_queue_head_t dasd_waitq;
+
+#undef DEBUG_DASD_MALLOC
+#ifdef DEBUG_DASD_MALLOC
+void *b;
+#define kmalloc(x...) (PRINT_INFO(" kmalloc %p\n",b=kmalloc(x)),b)
+#define kfree(x) PRINT_INFO(" kfree %p\n",x);kfree(x)
+#define get_free_page(x...) (PRINT_INFO(" gfp %p\n",b=get_free_page(x)),b)
+#define __get_free_pages(x...) (PRINT_INFO(" gfps %p\n",b=__get_free_pages(x)),b)
+#endif /* DEBUG_DASD_MALLOC */
+
+#endif /* __KERNEL__ */
+#endif /* DASD_H */
+
+/*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+ * adjust the settings for this buffer only. This must remain at the end
+ * of the file.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-indent-level: 4
+ * c-brace-imaginary-offset: 0
+ * c-brace-offset: -4
+ * c-argdecl-indent: 4
+ * c-label-offset: -4
+ * c-continued-statement-offset: 4
+ * c-continued-brace-offset: 0
+ * indent-tabs-mode: nil
+ * tab-width: 8
+ * End:
+ */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index c7df47297..f2bc40f4d 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -82,6 +82,9 @@
#define FB_ACCEL_CT_6555x 30 /* C&T 6555x */
#define FB_ACCEL_3DFX_BANSHEE 31 /* 3Dfx Banshee */
#define FB_ACCEL_ATI_RAGE128 32 /* ATI Rage128 family */
+#define FB_ACCEL_IGS_CYBER2000 33 /* CyberPro 2000 */
+#define FB_ACCEL_IGS_CYBER2010 34 /* CyberPro 2010 */
+#define FB_ACCEL_IGS_CYBER5000 35 /* CyberPro 5000 */
struct fb_fix_screeninfo {
char id[16]; /* identification string eg "TT Builtin" */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e7bf84240..c07a473d1 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -11,6 +11,7 @@
#include <linux/config.h>
#include <linux/types.h>
+#include <linux/major.h>
/* These three have identical behaviour; use the second one if DOS fdisk gets
confused about extended/logical partitions starting past cylinder 1023. */
@@ -233,6 +234,35 @@ extern void devfs_register_partitions (struct gendisk *dev, int minor,
int get_hardsect_size(kdev_t dev);
+/*
+ * FIXME: this should use genhd->minor_shift, but that is slow to look up.
+ */
+static inline unsigned int disk_index (kdev_t dev)
+{
+ int major = MAJOR(dev);
+ int minor = MINOR(dev);
+ unsigned int index;
+
+ switch (major) {
+ case DAC960_MAJOR+0:
+ index = (minor & 0x00f8) >> 3;
+ break;
+ case SCSI_DISK0_MAJOR:
+ index = (minor & 0x00f0) >> 4;
+ break;
+ case IDE0_MAJOR: /* same as HD_MAJOR */
+ case XT_DISK_MAJOR:
+ index = (minor & 0x0040) >> 6;
+ break;
+ case IDE1_MAJOR:
+ index = ((minor & 0x0040) >> 6) + 2;
+ break;
+ default:
+ return 0;
+ }
+ return index;
+}
+
#endif
#endif
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 2491372a9..c9f194be4 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -12,18 +12,19 @@
* used by rstatd/perfmeter
*/
-#define DK_NDRIVE 4
+#define DK_MAX_MAJOR 16
+#define DK_MAX_DISK 16
struct kernel_stat {
unsigned int cpu_user, cpu_nice, cpu_system;
unsigned int per_cpu_user[NR_CPUS],
per_cpu_nice[NR_CPUS],
per_cpu_system[NR_CPUS];
- unsigned int dk_drive[DK_NDRIVE];
- unsigned int dk_drive_rio[DK_NDRIVE];
- unsigned int dk_drive_wio[DK_NDRIVE];
- unsigned int dk_drive_rblk[DK_NDRIVE];
- unsigned int dk_drive_wblk[DK_NDRIVE];
+ unsigned int dk_drive[DK_MAX_MAJOR][DK_MAX_DISK];
+ unsigned int dk_drive_rio[DK_MAX_MAJOR][DK_MAX_DISK];
+ unsigned int dk_drive_wio[DK_MAX_MAJOR][DK_MAX_DISK];
+ unsigned int dk_drive_rblk[DK_MAX_MAJOR][DK_MAX_DISK];
+ unsigned int dk_drive_wblk[DK_MAX_MAJOR][DK_MAX_DISK];
unsigned int pgpgin, pgpgout;
unsigned int pswpin, pswpout;
#if !defined(CONFIG_ARCH_S390)
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index a2431cd72..c1d6ff312 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -24,7 +24,7 @@
#endif
#include <linux/netfilter_ipv4.h>
-#define IPT_FUNCTION_MAXNAMELEN 32
+#define IPT_FUNCTION_MAXNAMELEN 30
#define IPT_TABLE_MAXNAMELEN 32
/* Yes, Virginia, you have to zero the padding. */
@@ -47,13 +47,22 @@ struct ipt_ip {
struct ipt_entry_match
{
- /* Total length */
- u_int16_t match_size;
union {
- /* Used by userspace */
- char name[IPT_FUNCTION_MAXNAMELEN];
- /* Used inside the kernel */
- struct ipt_match *match;
+ struct {
+ u_int16_t match_size;
+
+ /* Used by userspace */
+ char name[IPT_FUNCTION_MAXNAMELEN];
+ } user;
+ struct {
+ u_int16_t match_size;
+
+ /* Used inside the kernel */
+ struct ipt_match *match;
+ } kernel;
+
+ /* Total length */
+ u_int16_t match_size;
} u;
unsigned char data[0];
@@ -61,13 +70,22 @@ struct ipt_entry_match
struct ipt_entry_target
{
- /* Total length */
- u_int16_t target_size;
union {
- /* Used by userspace */
- char name[IPT_FUNCTION_MAXNAMELEN];
- /* Used inside the kernel */
- struct ipt_target *target;
+ struct {
+ u_int16_t target_size;
+
+ /* Used by userspace */
+ char name[IPT_FUNCTION_MAXNAMELEN];
+ } user;
+ struct {
+ u_int16_t target_size;
+
+ /* Used inside the kernel */
+ struct ipt_target *target;
+ } kernel;
+
+ /* Total length */
+ u_int16_t target_size;
} u;
unsigned char data[0];
@@ -286,7 +304,7 @@ ipt_get_target(struct ipt_entry *e)
\
for (__i = sizeof(struct ipt_entry); \
__i < (e)->target_offset; \
- __i += __m->match_size) { \
+ __i += __m->u.match_size) { \
__m = (void *)(e) + __i; \
\
__ret = fn(__m , ## args); \
@@ -421,6 +439,6 @@ extern unsigned int ipt_do_table(struct sk_buff **pskb,
struct ipt_table *table,
void *userdata);
-#define IPT_ALIGN(s) (((s) + (__alignof__(struct ipt_match)-1)) & ~(__alignof__(struct ipt_match)-1))
+#define IPT_ALIGN(s) (((s) + (__alignof__(struct ipt_entry)-1)) & ~(__alignof__(struct ipt_entry)-1))
#endif /*__KERNEL__*/
#endif /* _IPTABLES_H */
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index a88cbc9b8..a1176b978 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -28,6 +28,7 @@
#define PAGE_CACHE_MASK PAGE_MASK
#define PAGE_CACHE_ALIGN(addr) (((addr)+PAGE_CACHE_SIZE-1)&PAGE_CACHE_MASK)
+#define page_cache_get(x) get_page(x)
#define page_cache_alloc() alloc_pages(GFP_HIGHUSER, 0)
#define page_cache_free(x) __free_page(x)
#define page_cache_release(x) __free_page(x)
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index cabc0a8be..c2cabe19b 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -36,6 +36,7 @@
#include <net/checksum.h>
#include <linux/random.h>
#include <linux/locks.h>
+#include <linux/kernel_stat.h>
#include <asm/io.h>
#include <linux/raid/md_compatible.h>
@@ -74,6 +75,7 @@ extern void md_wakeup_thread(mdk_thread_t *thread);
extern void md_interrupt_thread (mdk_thread_t *thread);
extern int md_update_sb (mddev_t *mddev);
extern int md_do_sync(mddev_t *mddev, mdp_disk_t *spare);
+extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
extern void md_recover_arrays (void);
extern int md_check_ordering (mddev_t *mddev);
extern void autodetect_raid(void);
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index e0fdda3fa..b62d63750 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -162,7 +162,7 @@ struct mdk_rdev_s
kdev_t dev; /* Device number */
kdev_t old_dev; /* "" when it was last imported */
- int size; /* Device size (in blocks) */
+ unsigned long size; /* Device size (in blocks) */
mddev_t *mddev; /* RAID array if running */
unsigned long last_events; /* IO event timestamp */
@@ -170,7 +170,7 @@ struct mdk_rdev_s
struct file filp; /* Lock file */
mdp_super_t *sb;
- int sb_offset;
+ unsigned long sb_offset;
int faulty; /* if faulty do not issue IO requests */
int desc_nr; /* descriptor index in the superblock */
@@ -199,13 +199,17 @@ struct mddev_s
int sb_dirty;
mdu_param_t param;
int ro;
- unsigned int curr_resync;
+ unsigned long curr_resync;
unsigned long resync_start;
char *name;
int recovery_running;
struct semaphore reconfig_sem;
struct semaphore recovery_sem;
struct semaphore resync_sem;
+
+ atomic_t recovery_active;
+ md_wait_queue_head_t recovery_wait;
+
struct md_list_head all_mddevs;
request_queue_t queue;
};
@@ -213,15 +217,11 @@ struct mddev_s
struct mdk_personality_s
{
char *name;
- int (*map)(mddev_t *mddev, kdev_t dev, kdev_t *rdev,
- unsigned long *rsector, unsigned long size);
int (*make_request)(request_queue_t *q, mddev_t *mddev, int rw, struct buffer_head * bh);
void (*end_request)(struct buffer_head * bh, int uptodate);
int (*run)(mddev_t *mddev);
int (*stop)(mddev_t *mddev);
int (*status)(char *page, mddev_t *mddev);
- int (*ioctl)(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg);
int max_invalid_dev;
int (*error_handler)(mddev_t *mddev, kdev_t dev);
@@ -239,6 +239,7 @@ struct mdk_personality_s
int (*stop_resync)(mddev_t *mddev);
int (*restart_resync)(mddev_t *mddev);
+ int (*sync_request)(mddev_t *mddev, unsigned long block_nr);
};
@@ -339,5 +340,31 @@ typedef struct dev_name_s {
char name [MAX_DISKNAME_LEN];
} dev_name_t;
+
+#define __wait_event_lock_irq(wq, condition, lock) \
+do { \
+ wait_queue_t __wait; \
+ init_waitqueue_entry(&__wait, current); \
+ \
+ add_wait_queue(&wq, &__wait); \
+ for (;;) { \
+ set_current_state(TASK_UNINTERRUPTIBLE); \
+ if (condition) \
+ break; \
+ spin_unlock_irq(&lock); \
+ schedule(); \
+ spin_lock_irq(&lock); \
+ } \
+ current->state = TASK_RUNNING; \
+ remove_wait_queue(&wq, &__wait); \
+} while (0)
+
+#define wait_event_lock_irq(wq, condition, lock) \
+do { \
+ if (condition) \
+ break; \
+ __wait_event_lock_irq(wq, condition, lock); \
+} while (0)
+
#endif _MD_K_H
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
new file mode 100644
index 000000000..1016bdaa4
--- /dev/null
+++ b/include/linux/raid/raid1.h
@@ -0,0 +1,79 @@
+#ifndef _RAID1_H
+#define _RAID1_H
+
+#include <linux/raid/md.h>
+
+struct mirror_info {
+ int number;
+ int raid_disk;
+ kdev_t dev;
+ int next;
+ int sect_limit;
+
+ /*
+ * State bits:
+ */
+ int operational;
+ int write_only;
+ int spare;
+
+ int used_slot;
+};
+
+struct raid1_private_data {
+ mddev_t *mddev;
+ struct mirror_info mirrors[MD_SB_DISKS];
+ int nr_disks;
+ int raid_disks;
+ int working_disks;
+ int last_used;
+ unsigned long next_sect;
+ int sect_count;
+ mdk_thread_t *thread, *resync_thread;
+ int resync_mirrors;
+ struct mirror_info *spare;
+ md_spinlock_t device_lock;
+
+ /* for use when syncing mirrors: */
+ int 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 raid1_private_data raid1_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) ((raid1_conf_t *) mddev->private)
+
+/*
+ * this is our 'private' 'collective' RAID1 buffer head.
+ * it contains information about what kind of IO operations were started
+ * for this RAID1 operation, and about their status:
+ */
+
+struct raid1_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 *mirror_bh [MD_SB_DISKS];
+ struct buffer_head bh_req;
+ struct buffer_head *next_retry;
+};
+/* bits for raid1_bh.state */
+#define R1BH_Uptodate 1
+#define R1BH_SyncPhase 2
+
+#endif
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
new file mode 100644
index 000000000..ab839ea02
--- /dev/null
+++ b/include/linux/raid/raid5.h
@@ -0,0 +1,118 @@
+#ifndef _RAID5_H
+#define _RAID5_H
+
+#include <linux/raid/md.h>
+#include <linux/raid/xor.h>
+
+struct disk_info {
+ kdev_t dev;
+ int operational;
+ int number;
+ int raid_disk;
+ int write_only;
+ int spare;
+ int used_slot;
+};
+
+struct stripe_head {
+ md_spinlock_t stripe_lock;
+ struct stripe_head *hash_next, **hash_pprev; /* hash pointers */
+ struct stripe_head *free_next; /* pool of free sh's */
+ struct buffer_head *buffer_pool; /* pool of free buffers */
+ struct buffer_head *bh_pool; /* pool of free bh's */
+ struct raid5_private_data *raid_conf;
+ struct buffer_head *bh_old[MD_SB_DISKS]; /* disk image */
+ struct buffer_head *bh_new[MD_SB_DISKS]; /* buffers of the MD device (present in buffer cache) */
+ struct buffer_head *bh_copy[MD_SB_DISKS]; /* copy on write of bh_new (bh_new can change from under us) */
+ struct buffer_head *bh_req[MD_SB_DISKS]; /* copy of bh_new (only the buffer heads), queued to the lower levels */
+ int cmd_new[MD_SB_DISKS]; /* READ/WRITE for new */
+ int new[MD_SB_DISKS]; /* buffer added since the last handle_stripe() */
+ unsigned long sector; /* sector of this row */
+ int size; /* buffers size */
+ int pd_idx; /* parity disk index */
+ atomic_t nr_pending; /* nr of pending cmds */
+ unsigned long state; /* state flags */
+ int cmd; /* stripe cmd */
+ atomic_t count; /* nr of waiters */
+ int write_method; /* reconstruct-write / read-modify-write */
+ int phase; /* PHASE_BEGIN, ..., PHASE_COMPLETE */
+ md_wait_queue_head_t wait; /* processes waiting for this stripe */
+
+ int sync_redone;
+};
+
+/*
+ * Phase
+ */
+#define PHASE_BEGIN 0
+#define PHASE_READ_OLD 1
+#define PHASE_WRITE 2
+#define PHASE_READ 3
+#define PHASE_COMPLETE 4
+
+/*
+ * Write method
+ */
+#define METHOD_NONE 0
+#define RECONSTRUCT_WRITE 1
+#define READ_MODIFY_WRITE 2
+
+/*
+ * Stripe state
+ */
+#define STRIPE_LOCKED 0
+#define STRIPE_ERROR 1
+
+/*
+ * Stripe commands
+ */
+#define STRIPE_NONE 0
+#define STRIPE_WRITE 1
+#define STRIPE_READ 2
+#define STRIPE_SYNC 3
+
+struct raid5_private_data {
+ struct stripe_head **stripe_hashtbl;
+ mddev_t *mddev;
+ mdk_thread_t *thread, *resync_thread;
+ struct disk_info disks[MD_SB_DISKS];
+ struct disk_info *spare;
+ int buffer_size;
+ int chunk_size, level, algorithm;
+ int raid_disks, working_disks, failed_disks;
+ int sector_count;
+ unsigned long next_sector;
+ atomic_t nr_handle;
+ struct stripe_head *next_free_stripe;
+ atomic_t nr_stripes;
+ int resync_parity;
+ int max_nr_stripes;
+ int clock;
+ atomic_t nr_hashed_stripes;
+ atomic_t nr_locked_stripes;
+ atomic_t nr_pending_stripes;
+ atomic_t nr_cached_stripes;
+
+ /*
+ * Free stripes pool
+ */
+ atomic_t nr_free_sh;
+ struct stripe_head *free_sh_list;
+ md_wait_queue_head_t wait_for_stripe;
+
+ md_spinlock_t device_lock;
+};
+
+typedef struct raid5_private_data raid5_conf_t;
+
+#define mddev_to_conf(mddev) ((raid5_conf_t *) mddev->private)
+
+/*
+ * Our supported algorithms
+ */
+#define ALGORITHM_LEFT_ASYMMETRIC 0
+#define ALGORITHM_RIGHT_ASYMMETRIC 1
+#define ALGORITHM_LEFT_SYMMETRIC 2
+#define ALGORITHM_RIGHT_SYMMETRIC 3
+
+#endif
diff --git a/include/linux/raid/xor.h b/include/linux/raid/xor.h
new file mode 100644
index 000000000..c8034b759
--- /dev/null
+++ b/include/linux/raid/xor.h
@@ -0,0 +1,12 @@
+#ifndef _XOR_H
+#define _XOR_H
+
+#include <linux/raid/md.h>
+
+#define MAX_XOR_BLOCKS 4
+
+extern void calibrate_xor_block(void);
+extern void (*xor_block)(unsigned int count,
+ struct buffer_head **bh_ptr);
+
+#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 92e44456b..923a7a111 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -511,7 +511,8 @@ enum
enum {
DEV_CDROM=1,
DEV_HWMON=2,
- DEV_PARPORT=3
+ DEV_PARPORT=3,
+ DEV_RAID=4
};
/* /proc/sys/dev/cdrom */
@@ -529,6 +530,12 @@ enum {
DEV_PARPORT_DEFAULT=-3
};
+/* /proc/sys/dev/raid */
+enum {
+ DEV_RAID_SPEED_LIMIT_MIN=1,
+ DEV_RAID_SPEED_LIMIT_MAX=2
+};
+
/* /proc/sys/dev/parport/default */
enum {
DEV_PARPORT_DEFAULT_TIMESLICE=1,