md: remove typedefs: r10bio_t -> struct r10bio and r1bio_t -> struct r1bio
[deliverable/linux.git] / drivers / md / raid10.h
CommitLineData
1da177e4
LT
1#ifndef _RAID10_H
2#define _RAID10_H
3
1da177e4
LT
4typedef struct mirror_info mirror_info_t;
5
6struct mirror_info {
3cb03002 7 struct md_rdev *rdev;
1da177e4 8 sector_t head_position;
2bb77736
N
9 int recovery_disabled; /* matches
10 * mddev->recovery_disabled
11 * when we shouldn't try
12 * recovering this device.
13 */
1da177e4
LT
14};
15
1da177e4 16struct r10_private_data_s {
fd01b88c 17 struct mddev *mddev;
1da177e4
LT
18 mirror_info_t *mirrors;
19 int raid_disks;
1da177e4
LT
20 spinlock_t device_lock;
21
22 /* geometry */
25985edc
LDM
23 int near_copies; /* number of copies laid out raid0 style */
24 int far_copies; /* number of copies laid out
1da177e4
LT
25 * at large strides across drives
26 */
c93983bf
N
27 int far_offset; /* far_copies are offset by 1 stripe
28 * instead of many
29 */
1da177e4
LT
30 int copies; /* near_copies * far_copies.
31 * must be <= raid_disks
32 */
33 sector_t stride; /* distance between far copies.
c93983bf
N
34 * This is size / far_copies unless
35 * far_offset, in which case it is
36 * 1 stripe.
1da177e4
LT
37 */
38
dab8b292
TM
39 sector_t dev_sectors; /* temp copy of mddev->dev_sectors */
40
1da177e4
LT
41 int chunk_shift; /* shift from chunks to sectors */
42 sector_t chunk_mask;
43
44 struct list_head retry_list;
6cce3b23
N
45 /* queue pending writes and submit them on unplug */
46 struct bio_list pending_bio_list;
47
1da177e4
LT
48
49 spinlock_t resync_lock;
50 int nr_pending;
0a27ec96 51 int nr_waiting;
4443ae10 52 int nr_queued;
1da177e4
LT
53 int barrier;
54 sector_t next_resync;
6cce3b23
N
55 int fullsync; /* set to 1 if a full sync is needed,
56 * (fresh device added).
57 * Cleared when a sync completes.
58 */
1da177e4 59
0a27ec96 60 wait_queue_head_t wait_barrier;
1da177e4
LT
61
62 mempool_t *r10bio_pool;
63 mempool_t *r10buf_pool;
4443ae10 64 struct page *tmppage;
dab8b292
TM
65
66 /* When taking over an array from a different personality, we store
67 * the new thread here until we fully activate the array.
68 */
2b8bf345 69 struct md_thread *thread;
1da177e4
LT
70};
71
72typedef struct r10_private_data_s conf_t;
73
1da177e4
LT
74/*
75 * this is our 'private' RAID10 bio.
76 *
77 * it contains information about what kind of IO operations were started
78 * for this RAID10 operation, and about their status:
79 */
80
9f2c9d12 81struct r10bio {
1da177e4
LT
82 atomic_t remaining; /* 'have we finished' count,
83 * used from IRQ handlers
84 */
85 sector_t sector; /* virtual sector number */
86 int sectors;
87 unsigned long state;
fd01b88c 88 struct mddev *mddev;
1da177e4
LT
89 /*
90 * original bio going to /dev/mdx
91 */
92 struct bio *master_bio;
93 /*
94 * if the IO is in READ direction, then this is where we read
95 */
96 int read_slot;
97
98 struct list_head retry_list;
99 /*
100 * if the IO is in WRITE direction, then multiple bios are used,
101 * one for each copy.
102 * When resyncing we also use one for each copy.
103 * When reconstructing, we use 2 bios, one for read, one for write.
104 * We choose the number when they are allocated.
105 */
106 struct {
107 struct bio *bio;
108 sector_t addr;
109 int devnum;
110 } devs[0];
111};
112
0eb3ff12
N
113/* when we get a read error on a read-only array, we redirect to another
114 * device without failing the first device, or trying to over-write to
115 * correct the read error. To keep track of bad blocks on a per-bio
116 * level, we store IO_BLOCKED in the appropriate 'bios' pointer
117 */
118#define IO_BLOCKED ((struct bio*)1)
749c55e9
N
119/* When we successfully write to a known bad-block, we need to remove the
120 * bad-block marking which must be done from process context. So we record
121 * the success by setting devs[n].bio to IO_MADE_GOOD
122 */
123#define IO_MADE_GOOD ((struct bio *)2)
124
125#define BIO_SPECIAL(bio) ((unsigned long)bio <= 2)
0eb3ff12 126
1da177e4
LT
127/* bits for r10bio.state */
128#define R10BIO_Uptodate 0
129#define R10BIO_IsSync 1
130#define R10BIO_IsRecover 2
6cce3b23 131#define R10BIO_Degraded 3
856e08e2
N
132/* Set ReadError on bios that experience a read error
133 * so that raid10d knows what to do with them.
134 */
135#define R10BIO_ReadError 4
749c55e9
N
136/* If a write for this request means we can clear some
137 * known-bad-block records, we set this flag.
138 */
139#define R10BIO_MadeGood 5
bd870a16 140#define R10BIO_WriteError 6
1da177e4 141#endif
This page took 1.609853 seconds and 5 git commands to generate.