md: remove typedefs: r10bio_t -> struct r10bio and r1bio_t -> struct r1bio
[pandora-kernel.git] / drivers / md / raid10.h
1 #ifndef _RAID10_H
2 #define _RAID10_H
3
4 typedef struct mirror_info mirror_info_t;
5
6 struct mirror_info {
7         struct md_rdev  *rdev;
8         sector_t        head_position;
9         int             recovery_disabled;      /* matches
10                                                  * mddev->recovery_disabled
11                                                  * when we shouldn't try
12                                                  * recovering this device.
13                                                  */
14 };
15
16 struct r10_private_data_s {
17         struct mddev            *mddev;
18         mirror_info_t           *mirrors;
19         int                     raid_disks;
20         spinlock_t              device_lock;
21
22         /* geometry */
23         int                     near_copies;  /* number of copies laid out raid0 style */
24         int                     far_copies;   /* number of copies laid out
25                                                * at large strides across drives
26                                                */
27         int                     far_offset;   /* far_copies are offset by 1 stripe
28                                                * instead of many
29                                                */
30         int                     copies;       /* near_copies * far_copies.
31                                                * must be <= raid_disks
32                                                */
33         sector_t                stride;       /* distance between far copies.
34                                                * This is size / far_copies unless
35                                                * far_offset, in which case it is
36                                                * 1 stripe.
37                                                */
38
39         sector_t                dev_sectors;  /* temp copy of mddev->dev_sectors */
40
41         int chunk_shift; /* shift from chunks to sectors */
42         sector_t chunk_mask;
43
44         struct list_head        retry_list;
45         /* queue pending writes and submit them on unplug */
46         struct bio_list         pending_bio_list;
47
48
49         spinlock_t              resync_lock;
50         int nr_pending;
51         int nr_waiting;
52         int nr_queued;
53         int barrier;
54         sector_t                next_resync;
55         int                     fullsync;  /* set to 1 if a full sync is needed,
56                                             * (fresh device added).
57                                             * Cleared when a sync completes.
58                                             */
59
60         wait_queue_head_t       wait_barrier;
61
62         mempool_t *r10bio_pool;
63         mempool_t *r10buf_pool;
64         struct page             *tmppage;
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          */
69         struct md_thread        *thread;
70 };
71
72 typedef struct r10_private_data_s conf_t;
73
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
81 struct r10bio {
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;
88         struct mddev            *mddev;
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
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)
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)
126
127 /* bits for r10bio.state */
128 #define R10BIO_Uptodate 0
129 #define R10BIO_IsSync   1
130 #define R10BIO_IsRecover 2
131 #define R10BIO_Degraded 3
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
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
140 #define R10BIO_WriteError 6
141 #endif