aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/raid1.h')
-rw-r--r--drivers/md/raid1.h85
1 files changed, 52 insertions, 33 deletions
diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h
index e0d676b48974..c732b6cce935 100644
--- a/drivers/md/raid1.h
+++ b/drivers/md/raid1.h
@@ -1,10 +1,8 @@
1#ifndef _RAID1_H 1#ifndef _RAID1_H
2#define _RAID1_H 2#define _RAID1_H
3 3
4typedef struct mirror_info mirror_info_t;
5
6struct mirror_info { 4struct mirror_info {
7 mdk_rdev_t *rdev; 5 struct md_rdev *rdev;
8 sector_t head_position; 6 sector_t head_position;
9}; 7};
10 8
@@ -17,61 +15,82 @@ struct mirror_info {
17 */ 15 */
18 16
19struct pool_info { 17struct pool_info {
20 mddev_t *mddev; 18 struct mddev *mddev;
21 int raid_disks; 19 int raid_disks;
22}; 20};
23 21
24 22struct r1conf {
25typedef struct r1bio_s r1bio_t; 23 struct mddev *mddev;
26 24 struct mirror_info *mirrors;
27struct r1_private_data_s {
28 mddev_t *mddev;
29 mirror_info_t *mirrors;
30 int raid_disks; 25 int raid_disks;
26
27 /* When choose the best device for a read (read_balance())
28 * we try to keep sequential reads one the same device
29 * using 'last_used' and 'next_seq_sect'
30 */
31 int last_used; 31 int last_used;
32 sector_t next_seq_sect; 32 sector_t next_seq_sect;
33 /* During resync, read_balancing is only allowed on the part
34 * of the array that has been resynced. 'next_resync' tells us
35 * where that is.
36 */
37 sector_t next_resync;
38
33 spinlock_t device_lock; 39 spinlock_t device_lock;
34 40
41 /* list of 'struct r1bio' that need to be processed by raid1d,
42 * whether to retry a read, writeout a resync or recovery
43 * block, or anything else.
44 */
35 struct list_head retry_list; 45 struct list_head retry_list;
36 /* queue pending writes and submit them on unplug */
37 struct bio_list pending_bio_list;
38 46
39 /* for use when syncing mirrors: */ 47 /* queue pending writes to be submitted on unplug */
48 struct bio_list pending_bio_list;
49 int pending_count;
40 50
51 /* for use when syncing mirrors:
52 * We don't allow both normal IO and resync/recovery IO at
53 * the same time - resync/recovery can only happen when there
54 * is no other IO. So when either is active, the other has to wait.
55 * See more details description in raid1.c near raise_barrier().
56 */
57 wait_queue_head_t wait_barrier;
41 spinlock_t resync_lock; 58 spinlock_t resync_lock;
42 int nr_pending; 59 int nr_pending;
43 int nr_waiting; 60 int nr_waiting;
44 int nr_queued; 61 int nr_queued;
45 int barrier; 62 int barrier;
46 sector_t next_resync;
47 int fullsync; /* set to 1 if a full sync is needed,
48 * (fresh device added).
49 * Cleared when a sync completes.
50 */
51 int recovery_disabled; /* when the same as
52 * mddev->recovery_disabled
53 * we don't allow recovery
54 * to be attempted as we
55 * expect a read error
56 */
57 63
58 wait_queue_head_t wait_barrier; 64 /* Set to 1 if a full sync is needed, (fresh device added).
65 * Cleared when a sync completes.
66 */
67 int fullsync;
59 68
69 /* When the same as mddev->recovery_disabled we don't allow
70 * recovery to be attempted as we expect a read error.
71 */
72 int recovery_disabled;
73
74
75 /* poolinfo contains information about the content of the
76 * mempools - it changes when the array grows or shrinks
77 */
60 struct pool_info *poolinfo; 78 struct pool_info *poolinfo;
79 mempool_t *r1bio_pool;
80 mempool_t *r1buf_pool;
61 81
82 /* temporary buffer to synchronous IO when attempting to repair
83 * a read error.
84 */
62 struct page *tmppage; 85 struct page *tmppage;
63 86
64 mempool_t *r1bio_pool;
65 mempool_t *r1buf_pool;
66 87
67 /* When taking over an array from a different personality, we store 88 /* When taking over an array from a different personality, we store
68 * the new thread here until we fully activate the array. 89 * the new thread here until we fully activate the array.
69 */ 90 */
70 struct mdk_thread_s *thread; 91 struct md_thread *thread;
71}; 92};
72 93
73typedef struct r1_private_data_s conf_t;
74
75/* 94/*
76 * this is our 'private' RAID1 bio. 95 * this is our 'private' RAID1 bio.
77 * 96 *
@@ -79,7 +98,7 @@ typedef struct r1_private_data_s conf_t;
79 * for this RAID1 operation, and about their status: 98 * for this RAID1 operation, and about their status:
80 */ 99 */
81 100
82struct r1bio_s { 101struct r1bio {
83 atomic_t remaining; /* 'have we finished' count, 102 atomic_t remaining; /* 'have we finished' count,
84 * used from IRQ handlers 103 * used from IRQ handlers
85 */ 104 */
@@ -89,7 +108,7 @@ struct r1bio_s {
89 sector_t sector; 108 sector_t sector;
90 int sectors; 109 int sectors;
91 unsigned long state; 110 unsigned long state;
92 mddev_t *mddev; 111 struct mddev *mddev;
93 /* 112 /*
94 * original bio going to /dev/mdx 113 * original bio going to /dev/mdx
95 */ 114 */
@@ -148,6 +167,6 @@ struct r1bio_s {
148#define R1BIO_MadeGood 7 167#define R1BIO_MadeGood 7
149#define R1BIO_WriteError 8 168#define R1BIO_WriteError 8
150 169
151extern int md_raid1_congested(mddev_t *mddev, int bits); 170extern int md_raid1_congested(struct mddev *mddev, int bits);
152 171
153#endif 172#endif