summaryrefslogtreecommitdiff
path: root/include/linux/raid
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 23:59:01 -0800
committerLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 23:59:01 -0800
commitfe0976511d3b5cf2894da54bc451e561bd6b1482 (patch)
tree92bbccc5167568aa5b48d466891fb0dab40ba8bd /include/linux/raid
parent800446073f02f3035bffad7f1ced654ff6b474c9 (diff)
v2.5.0.10 -> v2.5.0.11
- Jeff Garzik: no longer support old cards in tulip driver (see separate driver for old tulip chips) - Pat Mochel: driverfs/device model documentation - Ballabio Dario: update eata driver to new IO locking - Ingo Molnar: raid resync with new bio structures (much more efficient) and mempool_resize() - Jens Axboe: bio queue locking
Diffstat (limited to 'include/linux/raid')
-rw-r--r--include/linux/raid/md.h6
-rw-r--r--include/linux/raid/md_compatible.h158
-rw-r--r--include/linux/raid/md_k.h26
-rw-r--r--include/linux/raid/raid1.h72
4 files changed, 56 insertions, 206 deletions
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index a7e18913ec09..233163eb2872 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -37,8 +37,12 @@
#include <linux/kernel_stat.h>
#include <asm/io.h>
#include <linux/completion.h>
+#include <linux/mempool.h>
+#include <linux/list.h>
+#include <linux/reboot.h>
+#include <linux/vmalloc.h>
+#include <linux/blkpg.h>
-#include <linux/raid/md_compatible.h>
/*
* 'md_p.h' holds the 'physical' layout of RAID devices
* 'md_u.h' holds the user <=> kernel API
diff --git a/include/linux/raid/md_compatible.h b/include/linux/raid/md_compatible.h
deleted file mode 100644
index 74dadd4bb663..000000000000
--- a/include/linux/raid/md_compatible.h
+++ /dev/null
@@ -1,158 +0,0 @@
-
-/*
- md.h : Multiple Devices driver compatibility layer for Linux 2.0/2.2
- Copyright (C) 1998 Ingo Molnar
-
- 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/version.h>
-
-#ifndef _MD_COMPATIBLE_H
-#define _MD_COMPATIBLE_H
-
-/** 2.3/2.4 stuff: **/
-
-#include <linux/reboot.h>
-#include <linux/vmalloc.h>
-#include <linux/blkpg.h>
-
-/* 000 */
-#define md__get_free_pages(x,y) __get_free_pages(x,y)
-
-#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 */
-#define md_clear_page(page) clear_page(page)
-
-/* 003 */
-#define MD_EXPORT_SYMBOL(x) EXPORT_SYMBOL(x)
-
-/* 004 */
-#define md_copy_to_user(x,y,z) copy_to_user(x,y,z)
-
-/* 005 */
-#define md_copy_from_user(x,y,z) copy_from_user(x,y,z)
-
-/* 006 */
-#define md_put_user put_user
-
-/* 007 */
-static inline int md_capable_admin(void)
-{
- return capable(CAP_SYS_ADMIN);
-}
-
-/* 008 */
-#define MD_FILE_TO_INODE(file) ((file)->f_dentry->d_inode)
-
-/* 009 */
-static inline void md_flush_signals (void)
-{
- spin_lock(&current->sigmask_lock);
- flush_signals(current);
- spin_unlock(&current->sigmask_lock);
-}
-
-/* 010 */
-static inline void md_init_signals (void)
-{
- current->exit_signal = SIGCHLD;
- siginitsetinv(&current->blocked, sigmask(SIGKILL));
-}
-
-/* 011 */
-#define md_signal_pending signal_pending
-
-/* 012 - md_set_global_readahead - nowhere used */
-
-/* 013 */
-#define md_mdelay(x) mdelay(x)
-
-/* 014 */
-#define MD_SYS_DOWN SYS_DOWN
-#define MD_SYS_HALT SYS_HALT
-#define MD_SYS_POWER_OFF SYS_POWER_OFF
-
-/* 015 */
-#define md_register_reboot_notifier register_reboot_notifier
-
-/* 016 */
-#define md_test_and_set_bit test_and_set_bit
-
-/* 017 */
-#define md_test_and_clear_bit test_and_clear_bit
-
-/* 018 */
-#define md_atomic_read atomic_read
-#define md_atomic_set atomic_set
-
-/* 019 */
-#define md_lock_kernel lock_kernel
-#define md_unlock_kernel unlock_kernel
-
-/* 020 */
-
-#include <linux/init.h>
-
-#define md__init __init
-#define md__initdata __initdata
-#define md__initfunc(__arginit) __initfunc(__arginit)
-
-/* 021 */
-
-
-/* 022 */
-
-#define md_list_head list_head
-#define MD_LIST_HEAD(name) LIST_HEAD(name)
-#define MD_INIT_LIST_HEAD(ptr) INIT_LIST_HEAD(ptr)
-#define md_list_add list_add
-#define md_list_del list_del
-#define md_list_empty list_empty
-
-#define md_list_entry(ptr, type, member) list_entry(ptr, type, member)
-
-/* 023 */
-
-#define md_schedule_timeout schedule_timeout
-
-/* 024 */
-#define md_need_resched(tsk) ((tsk)->need_resched)
-
-/* 025 */
-#define md_spinlock_t spinlock_t
-#define MD_SPIN_LOCK_UNLOCKED SPIN_LOCK_UNLOCKED
-
-#define md_spin_lock spin_lock
-#define md_spin_unlock spin_unlock
-#define md_spin_lock_irq spin_lock_irq
-#define md_spin_unlock_irq spin_unlock_irq
-#define md_spin_unlock_irqrestore spin_unlock_irqrestore
-#define md_spin_lock_irqsave spin_lock_irqsave
-
-/* 026 */
-typedef wait_queue_head_t md_wait_queue_head_t;
-#define MD_DECLARE_WAITQUEUE(w,t) DECLARE_WAITQUEUE((w),(t))
-#define MD_DECLARE_WAIT_QUEUE_HEAD(x) DECLARE_WAIT_QUEUE_HEAD(x)
-#define md_init_waitqueue_head init_waitqueue_head
-
-/* END */
-
-#endif
-
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 5382bc072c3d..6bf45496c507 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -158,9 +158,9 @@ static inline void mark_disk_nonsync(mdp_disk_t * d)
*/
struct mdk_rdev_s
{
- struct md_list_head same_set; /* RAID devices within the same set */
- struct md_list_head all; /* all RAID devices */
- struct md_list_head pending; /* undetected RAID devices */
+ struct list_head same_set; /* RAID devices within the same set */
+ struct list_head all; /* all RAID devices */
+ struct list_head pending; /* undetected RAID devices */
kdev_t dev; /* Device number */
kdev_t old_dev; /* "" when it was last imported */
@@ -197,7 +197,7 @@ struct mddev_s
int __minor;
mdp_super_t *sb;
int nb_dev;
- struct md_list_head disks;
+ struct list_head disks;
int sb_dirty;
mdu_param_t param;
int ro;
@@ -212,9 +212,9 @@ struct mddev_s
atomic_t active;
atomic_t recovery_active; /* blocks scheduled, but not written */
- md_wait_queue_head_t recovery_wait;
+ wait_queue_head_t recovery_wait;
- struct md_list_head all_mddevs;
+ struct list_head all_mddevs;
};
struct mdk_personality_s
@@ -240,7 +240,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);
+ int (*sync_request)(mddev_t *mddev, sector_t sector_nr);
};
@@ -269,9 +269,9 @@ extern mdp_disk_t *get_spare(mddev_t *mddev);
*/
#define ITERATE_RDEV_GENERIC(head,field,rdev,tmp) \
\
- for (tmp = head.next; \
- rdev = md_list_entry(tmp, mdk_rdev_t, field), \
- tmp = tmp->next, tmp->prev != &head \
+ for ((tmp) = (head).next; \
+ (rdev) = (list_entry((tmp), mdk_rdev_t, field)), \
+ (tmp) = (tmp)->next, (tmp)->prev != &(head) \
; )
/*
* iterates through the 'same array disks' ringlist
@@ -305,7 +305,7 @@ extern mdp_disk_t *get_spare(mddev_t *mddev);
#define ITERATE_MDDEV(mddev,tmp) \
\
for (tmp = all_mddevs.next; \
- mddev = md_list_entry(tmp, mddev_t, all_mddevs), \
+ mddev = list_entry(tmp, mddev_t, all_mddevs), \
tmp = tmp->next, tmp->prev != &all_mddevs \
; )
@@ -325,7 +325,7 @@ static inline void unlock_mddev (mddev_t * mddev)
typedef struct mdk_thread_s {
void (*run) (void *data);
void *data;
- md_wait_queue_head_t wqueue;
+ wait_queue_head_t wqueue;
unsigned long flags;
struct completion *event;
struct task_struct *tsk;
@@ -337,7 +337,7 @@ typedef struct mdk_thread_s {
#define MAX_DISKNAME_LEN 64
typedef struct dev_name_s {
- struct md_list_head list;
+ struct list_head list;
kdev_t dev;
char namebuf [MAX_DISKNAME_LEN];
char *name;
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
index 40675b40ca0f..c03eabf2e55c 100644
--- a/include/linux/raid/raid1.h
+++ b/include/linux/raid/raid1.h
@@ -3,6 +3,8 @@
#include <linux/raid/md.h>
+typedef struct mirror_info mirror_info_t;
+
struct mirror_info {
int number;
int raid_disk;
@@ -20,34 +22,21 @@ struct mirror_info {
int used_slot;
};
-struct raid1_private_data {
+typedef struct r1bio_s r1bio_t;
+
+struct r1_private_data_s {
mddev_t *mddev;
- struct mirror_info mirrors[MD_SB_DISKS];
+ mirror_info_t mirrors[MD_SB_DISKS];
int nr_disks;
int raid_disks;
int working_disks;
int last_used;
- unsigned long next_sect;
+ sector_t next_sect;
int sect_count;
mdk_thread_t *thread, *resync_thread;
int resync_mirrors;
- struct mirror_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
- * raid1_bh that are pre-allocated have R1BH_PreAlloc set.
- * All these variable are protected by device_lock
- */
- struct buffer_head *freebh;
- int freebh_cnt; /* how many are on the list */
- int freebh_blocked;
- struct raid1_bh *freer1;
- int freer1_blocked;
- int freer1_cnt;
- struct raid1_bh *freebuf; /* each bh_req has a page allocated */
- md_wait_queue_head_t wait_buffer;
+ mirror_info_t *spare;
+ spinlock_t device_lock;
/* for use when syncing mirrors: */
unsigned long start_active, start_ready,
@@ -56,18 +45,21 @@ struct raid1_private_data {
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;
+ wait_queue_head_t wait_done;
+ wait_queue_head_t wait_ready;
+ spinlock_t segment_lock;
+
+ mempool_t *r1bio_pool;
+ mempool_t *r1buf_pool;
};
-typedef struct raid1_private_data raid1_conf_t;
+typedef struct r1_private_data_s 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)
+#define mddev_to_conf(mddev) ((conf_t *) mddev->private)
/*
* this is our 'private' 'collective' RAID1 buffer head.
@@ -75,20 +67,32 @@ typedef struct raid1_private_data raid1_conf_t;
* for this RAID1 operation, and about their status:
*/
-struct raid1_bh {
+struct r1bio_s {
atomic_t remaining; /* 'have we finished' count,
* used from IRQ handlers
*/
int cmd;
+ sector_t sector;
unsigned long state;
mddev_t *mddev;
- struct buffer_head *master_bh;
- struct buffer_head *mirror_bh_list;
- struct buffer_head bh_req;
- struct raid1_bh *next_r1; /* next for retry or in free list */
+ /*
+ * original bio going to /dev/mdx
+ */
+ struct bio *master_bio;
+ /*
+ * if the IO is in READ direction, then this bio is used:
+ */
+ struct bio *read_bio;
+ /*
+ * if the IO is in WRITE direction, then multiple bios are used:
+ */
+ struct bio *write_bios[MD_SB_DISKS];
+
+ r1bio_t *next_r1; /* next for retry or in free list */
+ struct list_head retry_list;
};
-/* bits for raid1_bh.state */
-#define R1BH_Uptodate 1
-#define R1BH_SyncPhase 2
-#define R1BH_PreAlloc 3 /* this was pre-allocated, add to free list */
+
+/* bits for r1bio.state */
+#define R1BIO_Uptodate 1
+#define R1BIO_SyncPhase 2
#endif