4 typedef struct mirror_info mirror_info_t;
8 sector_t head_position;
9 int recovery_disabled; /* matches
10 * mddev->recovery_disabled
11 * when we shouldn't try
12 * recovering this device.
16 struct r10_private_data_s {
18 mirror_info_t *mirrors;
20 spinlock_t device_lock;
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
27 int far_offset; /* far_copies are offset by 1 stripe
30 int copies; /* near_copies * far_copies.
31 * must be <= raid_disks
33 sector_t stride; /* distance between far copies.
34 * This is size / far_copies unless
35 * far_offset, in which case it is
39 sector_t dev_sectors; /* temp copy of mddev->dev_sectors */
41 int chunk_shift; /* shift from chunks to sectors */
44 struct list_head retry_list;
45 /* queue pending writes and submit them on unplug */
46 struct bio_list pending_bio_list;
49 spinlock_t resync_lock;
55 int fullsync; /* set to 1 if a full sync is needed,
56 * (fresh device added).
57 * Cleared when a sync completes.
60 wait_queue_head_t wait_barrier;
62 mempool_t *r10bio_pool;
63 mempool_t *r10buf_pool;
66 /* When taking over an array from a different personality, we store
67 * the new thread here until we fully activate the array.
69 struct md_thread *thread;
72 typedef struct r10_private_data_s conf_t;
75 * this is our 'private' RAID10 bio.
77 * it contains information about what kind of IO operations were started
78 * for this RAID10 operation, and about their status:
82 atomic_t remaining; /* 'have we finished' count,
83 * used from IRQ handlers
85 sector_t sector; /* virtual sector number */
90 * original bio going to /dev/mdx
92 struct bio *master_bio;
94 * if the IO is in READ direction, then this is where we read
98 struct list_head retry_list;
100 * if the IO is in WRITE direction, then multiple bios are used,
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.
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
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
123 #define IO_MADE_GOOD ((struct bio *)2)
125 #define BIO_SPECIAL(bio) ((unsigned long)bio <= 2)
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.
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.
139 #define R10BIO_MadeGood 5
140 #define R10BIO_WriteError 6