Blame view
drivers/md/raid10.h
5.05 KB
b24413180 License cleanup: ... |
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4c Linux-2.6.12-rc2 |
2 3 |
#ifndef _RAID10_H #define _RAID10_H |
f2785b527 md: document life... |
4 5 6 7 8 9 10 11 12 13 14 15 |
/* Note: raid10_info.rdev can be set to NULL asynchronously by * raid10_remove_disk. * There are three safe ways to access raid10_info.rdev. * 1/ when holding mddev->reconfig_mutex * 2/ when resync/recovery/reshape is known to be happening - i.e. in code * that is called as part of performing resync/recovery/reshape. * 3/ while holding rcu_read_lock(), use rcu_dereference to get the pointer * and if it is non-NULL, increment rdev->nr_pending before dropping the * RCU lock. * When .rdev is set to NULL, the nr_pending count checked again and if it has * been incremented, the pointer is put back in .rdev. */ |
dc280d987 MD RAID10: rename... |
16 |
struct raid10_info { |
69335ef3b md/raid10: prepar... |
17 |
struct md_rdev *rdev, *replacement; |
1da177e4c Linux-2.6.12-rc2 |
18 |
sector_t head_position; |
2bb77736a md/raid10: Make u... |
19 20 21 22 23 |
int recovery_disabled; /* matches * mddev->recovery_disabled * when we shouldn't try * recovering this device. */ |
1da177e4c Linux-2.6.12-rc2 |
24 |
}; |
e879a8793 md/raid10: typede... |
25 |
struct r10conf { |
fd01b88c7 md: remove typede... |
26 |
struct mddev *mddev; |
dc280d987 MD RAID10: rename... |
27 28 |
struct raid10_info *mirrors; struct raid10_info *mirrors_new, *mirrors_old; |
1da177e4c Linux-2.6.12-rc2 |
29 30 31 |
spinlock_t device_lock; /* geometry */ |
5cf00fcd3 md/raid10: collec... |
32 33 34 |
struct geom { int raid_disks; int near_copies; /* number of copies laid out |
69335ef3b md/raid10: prepar... |
35 |
* raid0 style */ |
5cf00fcd3 md/raid10: collec... |
36 |
int far_copies; /* number of copies laid out |
1da177e4c Linux-2.6.12-rc2 |
37 38 |
* at large strides across drives */ |
5cf00fcd3 md/raid10: collec... |
39 |
int far_offset; /* far_copies are offset by 1 |
69335ef3b md/raid10: prepar... |
40 |
* stripe instead of many |
c93983bf5 [PATCH] md: suppo... |
41 |
*/ |
5cf00fcd3 md/raid10: collec... |
42 |
sector_t stride; /* distance between far copies. |
c93983bf5 [PATCH] md: suppo... |
43 44 45 |
* This is size / far_copies unless * far_offset, in which case it is * 1 stripe. |
1da177e4c Linux-2.6.12-rc2 |
46 |
*/ |
475901aff MD RAID10: Improv... |
47 48 49 50 51 |
int far_set_size; /* The number of devices in a set, * where a 'set' are devices that * contain far/offset copies of * each other. */ |
5cf00fcd3 md/raid10: collec... |
52 53 |
int chunk_shift; /* shift from chunks to sectors */ sector_t chunk_mask; |
f8c9e74ff md/raid10: Introd... |
54 |
} prev, geo; |
5cf00fcd3 md/raid10: collec... |
55 56 57 |
int copies; /* near_copies * far_copies. * must be <= raid_disks */ |
1da177e4c Linux-2.6.12-rc2 |
58 |
|
69335ef3b md/raid10: prepar... |
59 60 |
sector_t dev_sectors; /* temp copy of * mddev->dev_sectors */ |
f8c9e74ff md/raid10: Introd... |
61 |
sector_t reshape_progress; |
3ea7daa5d md/raid10: add re... |
62 63 64 |
sector_t reshape_safe; unsigned long reshape_checkpoint; sector_t offset_diff; |
dab8b2924 md: Add support f... |
65 |
|
1da177e4c Linux-2.6.12-rc2 |
66 |
struct list_head retry_list; |
95af587e9 md/raid10: ensure... |
67 68 69 70 71 |
/* A separate list of r1bio which just need raid_end_bio_io called. * This mustn't happen for writes which had any errors if the superblock * needs to be written. */ struct list_head bio_end_io_list; |
6cce3b23f [PATCH] md: write... |
72 73 |
/* queue pending writes and submit them on unplug */ struct bio_list pending_bio_list; |
34db0cd60 md: add proper wr... |
74 |
int pending_count; |
1da177e4c Linux-2.6.12-rc2 |
75 76 |
spinlock_t resync_lock; |
0e5313e2d raid10: improve r... |
77 |
atomic_t nr_pending; |
69335ef3b md/raid10: prepar... |
78 79 80 |
int nr_waiting; int nr_queued; int barrier; |
0e5313e2d raid10: improve r... |
81 |
int array_freeze_pending; |
1da177e4c Linux-2.6.12-rc2 |
82 |
sector_t next_resync; |
6cce3b23f [PATCH] md: write... |
83 84 85 86 |
int fullsync; /* set to 1 if a full sync is needed, * (fresh device added). * Cleared when a sync completes. */ |
69335ef3b md/raid10: prepar... |
87 88 89 |
int have_replacement; /* There is at least one * replacement device. */ |
0a27ec96b [PATCH] md: impro... |
90 |
wait_queue_head_t wait_barrier; |
1da177e4c Linux-2.6.12-rc2 |
91 |
|
afeee514c md: convert to bi... |
92 93 |
mempool_t r10bio_pool; mempool_t r10buf_pool; |
4443ae10c [PATCH] md: auto-... |
94 |
struct page *tmppage; |
afeee514c md: convert to bi... |
95 |
struct bio_set bio_split; |
dab8b2924 md: Add support f... |
96 97 98 99 |
/* When taking over an array from a different personality, we store * the new thread here until we fully activate the array. */ |
2b8bf3451 md: remove typede... |
100 |
struct md_thread *thread; |
8db87912c md-cluster: Use a... |
101 102 103 104 105 106 |
/* * Keep track of cluster resync window to send to other nodes. */ sector_t cluster_sync_low; sector_t cluster_sync_high; |
1da177e4c Linux-2.6.12-rc2 |
107 |
}; |
1da177e4c Linux-2.6.12-rc2 |
108 |
/* |
1da177e4c Linux-2.6.12-rc2 |
109 110 111 112 113 |
* this is our 'private' RAID10 bio. * * it contains information about what kind of IO operations were started * for this RAID10 operation, and about their status: */ |
9f2c9d12b md: remove typede... |
114 |
struct r10bio { |
1da177e4c Linux-2.6.12-rc2 |
115 116 117 118 119 120 |
atomic_t remaining; /* 'have we finished' count, * used from IRQ handlers */ sector_t sector; /* virtual sector number */ int sectors; unsigned long state; |
fd01b88c7 md: remove typede... |
121 |
struct mddev *mddev; |
1da177e4c Linux-2.6.12-rc2 |
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
/* * original bio going to /dev/mdx */ struct bio *master_bio; /* * if the IO is in READ direction, then this is where we read */ int read_slot; struct list_head retry_list; /* * if the IO is in WRITE direction, then multiple bios are used, * one for each copy. * When resyncing we also use one for each copy. * When reconstructing, we use 2 bios, one for read, one for write. * We choose the number when they are allocated. |
69335ef3b md/raid10: prepar... |
138 |
* We sometimes need an extra bio to write to the replacement. |
1da177e4c Linux-2.6.12-rc2 |
139 |
*/ |
e0ee77852 md/raid10: fix pr... |
140 |
struct r10dev { |
69335ef3b md/raid10: prepar... |
141 142 143 144 145 146 147 148 149 |
struct bio *bio; union { struct bio *repl_bio; /* used for resync and * writes */ struct md_rdev *rdev; /* used for reads * (read_slot >= 0) */ }; sector_t addr; int devnum; |
358369f03 md/raid1: Replace... |
150 |
} devs[]; |
1da177e4c Linux-2.6.12-rc2 |
151 152 153 |
}; /* bits for r10bio.state */ |
69335ef3b md/raid10: prepar... |
154 155 156 157 |
enum r10bio_state { R10BIO_Uptodate, R10BIO_IsSync, R10BIO_IsRecover, |
3ea7daa5d md/raid10: add re... |
158 |
R10BIO_IsReshape, |
69335ef3b md/raid10: prepar... |
159 |
R10BIO_Degraded, |
856e08e23 md/raid10: avoid ... |
160 161 162 |
/* Set ReadError on bios that experience a read error * so that raid10d knows what to do with them. */ |
69335ef3b md/raid10: prepar... |
163 |
R10BIO_ReadError, |
749c55e94 md/raid10: clear ... |
164 165 166 |
/* If a write for this request means we can clear some * known-bad-block records, we set this flag. */ |
69335ef3b md/raid10: prepar... |
167 168 |
R10BIO_MadeGood, R10BIO_WriteError, |
f8c9e74ff md/raid10: Introd... |
169 170 171 172 173 |
/* During a reshape we might be performing IO on the * 'previous' part of the array, in which case this * flag is set */ R10BIO_Previous, |
8d3ca83dc md/raid10: add fa... |
174 175 |
/* failfast devices did receive failfast requests. */ R10BIO_FailFast, |
69335ef3b md/raid10: prepar... |
176 |
}; |
1da177e4c Linux-2.6.12-rc2 |
177 |
#endif |