diff options
Diffstat (limited to 'include/linux/raid/md_k.h')
-rw-r--r-- | include/linux/raid/md_k.h | 81 |
1 files changed, 17 insertions, 64 deletions
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index 8c14ba565a45..ebce949b1443 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h | |||
@@ -86,70 +86,6 @@ typedef struct mdk_rdev_s mdk_rdev_t; | |||
86 | #define MAX_CHUNK_SIZE (4096*1024) | 86 | #define MAX_CHUNK_SIZE (4096*1024) |
87 | 87 | ||
88 | /* | 88 | /* |
89 | * default readahead | ||
90 | */ | ||
91 | |||
92 | static inline int disk_faulty(mdp_disk_t * d) | ||
93 | { | ||
94 | return d->state & (1 << MD_DISK_FAULTY); | ||
95 | } | ||
96 | |||
97 | static inline int disk_active(mdp_disk_t * d) | ||
98 | { | ||
99 | return d->state & (1 << MD_DISK_ACTIVE); | ||
100 | } | ||
101 | |||
102 | static inline int disk_sync(mdp_disk_t * d) | ||
103 | { | ||
104 | return d->state & (1 << MD_DISK_SYNC); | ||
105 | } | ||
106 | |||
107 | static inline int disk_spare(mdp_disk_t * d) | ||
108 | { | ||
109 | return !disk_sync(d) && !disk_active(d) && !disk_faulty(d); | ||
110 | } | ||
111 | |||
112 | static inline int disk_removed(mdp_disk_t * d) | ||
113 | { | ||
114 | return d->state & (1 << MD_DISK_REMOVED); | ||
115 | } | ||
116 | |||
117 | static inline void mark_disk_faulty(mdp_disk_t * d) | ||
118 | { | ||
119 | d->state |= (1 << MD_DISK_FAULTY); | ||
120 | } | ||
121 | |||
122 | static inline void mark_disk_active(mdp_disk_t * d) | ||
123 | { | ||
124 | d->state |= (1 << MD_DISK_ACTIVE); | ||
125 | } | ||
126 | |||
127 | static inline void mark_disk_sync(mdp_disk_t * d) | ||
128 | { | ||
129 | d->state |= (1 << MD_DISK_SYNC); | ||
130 | } | ||
131 | |||
132 | static inline void mark_disk_spare(mdp_disk_t * d) | ||
133 | { | ||
134 | d->state = 0; | ||
135 | } | ||
136 | |||
137 | static inline void mark_disk_removed(mdp_disk_t * d) | ||
138 | { | ||
139 | d->state = (1 << MD_DISK_FAULTY) | (1 << MD_DISK_REMOVED); | ||
140 | } | ||
141 | |||
142 | static inline void mark_disk_inactive(mdp_disk_t * d) | ||
143 | { | ||
144 | d->state &= ~(1 << MD_DISK_ACTIVE); | ||
145 | } | ||
146 | |||
147 | static inline void mark_disk_nonsync(mdp_disk_t * d) | ||
148 | { | ||
149 | d->state &= ~(1 << MD_DISK_SYNC); | ||
150 | } | ||
151 | |||
152 | /* | ||
153 | * MD's 'extended' device | 89 | * MD's 'extended' device |
154 | */ | 90 | */ |
155 | struct mdk_rdev_s | 91 | struct mdk_rdev_s |
@@ -166,6 +102,7 @@ struct mdk_rdev_s | |||
166 | int sb_loaded; | 102 | int sb_loaded; |
167 | sector_t data_offset; /* start of data in array */ | 103 | sector_t data_offset; /* start of data in array */ |
168 | sector_t sb_offset; | 104 | sector_t sb_offset; |
105 | int sb_size; /* bytes in the superblock */ | ||
169 | int preferred_minor; /* autorun support */ | 106 | int preferred_minor; /* autorun support */ |
170 | 107 | ||
171 | /* A device can be in one of three states based on two flags: | 108 | /* A device can be in one of three states based on two flags: |
@@ -181,6 +118,9 @@ struct mdk_rdev_s | |||
181 | int faulty; /* if faulty do not issue IO requests */ | 118 | int faulty; /* if faulty do not issue IO requests */ |
182 | int in_sync; /* device is a full member of the array */ | 119 | int in_sync; /* device is a full member of the array */ |
183 | 120 | ||
121 | unsigned long flags; /* Should include faulty and in_sync here. */ | ||
122 | #define WriteMostly 4 /* Avoid reading if at all possible */ | ||
123 | |||
184 | int desc_nr; /* descriptor index in the superblock */ | 124 | int desc_nr; /* descriptor index in the superblock */ |
185 | int raid_disk; /* role of device in array */ | 125 | int raid_disk; /* role of device in array */ |
186 | int saved_raid_disk; /* role that device used to have in the | 126 | int saved_raid_disk; /* role that device used to have in the |
@@ -272,12 +212,19 @@ struct mddev_s | |||
272 | atomic_t writes_pending; | 212 | atomic_t writes_pending; |
273 | request_queue_t *queue; /* for plugging ... */ | 213 | request_queue_t *queue; /* for plugging ... */ |
274 | 214 | ||
215 | atomic_t write_behind; /* outstanding async IO */ | ||
216 | unsigned int max_write_behind; /* 0 = sync */ | ||
217 | |||
275 | struct bitmap *bitmap; /* the bitmap for the device */ | 218 | struct bitmap *bitmap; /* the bitmap for the device */ |
276 | struct file *bitmap_file; /* the bitmap file */ | 219 | struct file *bitmap_file; /* the bitmap file */ |
277 | long bitmap_offset; /* offset from superblock of | 220 | long bitmap_offset; /* offset from superblock of |
278 | * start of bitmap. May be | 221 | * start of bitmap. May be |
279 | * negative, but not '0' | 222 | * negative, but not '0' |
280 | */ | 223 | */ |
224 | long default_bitmap_offset; /* this is the offset to use when | ||
225 | * hot-adding a bitmap. It should | ||
226 | * eventually be settable by sysfs. | ||
227 | */ | ||
281 | 228 | ||
282 | struct list_head all_mddevs; | 229 | struct list_head all_mddevs; |
283 | }; | 230 | }; |
@@ -314,6 +261,12 @@ struct mdk_personality_s | |||
314 | int (*resize) (mddev_t *mddev, sector_t sectors); | 261 | int (*resize) (mddev_t *mddev, sector_t sectors); |
315 | int (*reshape) (mddev_t *mddev, int raid_disks); | 262 | int (*reshape) (mddev_t *mddev, int raid_disks); |
316 | int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); | 263 | int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); |
264 | /* quiesce moves between quiescence states | ||
265 | * 0 - fully active | ||
266 | * 1 - no new requests allowed | ||
267 | * others - reserved | ||
268 | */ | ||
269 | void (*quiesce) (mddev_t *mddev, int state); | ||
317 | }; | 270 | }; |
318 | 271 | ||
319 | 272 | ||