diff options
author | NeilBrown <neilb@cse.unsw.edu.au> | 2005-09-09 19:23:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 19:39:10 -0400 |
commit | 8ddf9efe6708f3674f0ddfeb6425fd27bea109a2 (patch) | |
tree | 90862c8fa9f04cf98423b3da1b2c5d1f01a7310d /include/linux | |
parent | 36fa30636fb84b209210299684e1be66d9e58217 (diff) |
[PATCH] md: support write-mostly device in raid1
This allows a device in a raid1 to be marked as "write mostly". Read requests
will only be sent if there is no other option.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/raid/md_k.h | 3 | ||||
-rw-r--r-- | include/linux/raid/md_p.h | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index 817062bf7352..7ef78e15ce04 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h | |||
@@ -181,6 +181,9 @@ struct mdk_rdev_s | |||
181 | int faulty; /* if faulty do not issue IO requests */ | 181 | int faulty; /* if faulty do not issue IO requests */ |
182 | int in_sync; /* device is a full member of the array */ | 182 | int in_sync; /* device is a full member of the array */ |
183 | 183 | ||
184 | unsigned long flags; /* Should include faulty and in_sync here. */ | ||
185 | #define WriteMostly 4 /* Avoid reading if at all possible */ | ||
186 | |||
184 | int desc_nr; /* descriptor index in the superblock */ | 187 | int desc_nr; /* descriptor index in the superblock */ |
185 | int raid_disk; /* role of device in array */ | 188 | int raid_disk; /* role of device in array */ |
186 | int saved_raid_disk; /* role that device used to have in the | 189 | int saved_raid_disk; /* role that device used to have in the |
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h index dc65cd435494..4f047f84fb1f 100644 --- a/include/linux/raid/md_p.h +++ b/include/linux/raid/md_p.h | |||
@@ -79,6 +79,11 @@ | |||
79 | #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ | 79 | #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ |
80 | #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ | 80 | #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ |
81 | 81 | ||
82 | #define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config. | ||
83 | * read requests will only be sent here in | ||
84 | * dire need | ||
85 | */ | ||
86 | |||
82 | typedef struct mdp_device_descriptor_s { | 87 | typedef struct mdp_device_descriptor_s { |
83 | __u32 number; /* 0 Device number in the entire set */ | 88 | __u32 number; /* 0 Device number in the entire set */ |
84 | __u32 major; /* 1 Device major number */ | 89 | __u32 major; /* 1 Device major number */ |
@@ -193,7 +198,7 @@ struct mdp_superblock_1 { | |||
193 | 198 | ||
194 | __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ | 199 | __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ |
195 | __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ | 200 | __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ |
196 | __u32 layout; /* only for raid5 currently */ | 201 | __u32 layout; /* only for raid5 and raid10 currently */ |
197 | __u64 size; /* used size of component devices, in 512byte sectors */ | 202 | __u64 size; /* used size of component devices, in 512byte sectors */ |
198 | 203 | ||
199 | __u32 chunksize; /* in 512byte sectors */ | 204 | __u32 chunksize; /* in 512byte sectors */ |
@@ -212,7 +217,9 @@ struct mdp_superblock_1 { | |||
212 | __u32 dev_number; /* permanent identifier of this device - not role in raid */ | 217 | __u32 dev_number; /* permanent identifier of this device - not role in raid */ |
213 | __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ | 218 | __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ |
214 | __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ | 219 | __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ |
215 | __u8 pad2[64-56]; /* set to 0 when writing */ | 220 | __u8 devflags; /* per-device flags. Only one defined...*/ |
221 | #define WriteMostly1 1 /* mask for writemostly flag in above */ | ||
222 | __u8 pad2[64-57]; /* set to 0 when writing */ | ||
216 | 223 | ||
217 | /* array state information - 64 bytes */ | 224 | /* array state information - 64 bytes */ |
218 | __u64 utime; /* 40 bits second, 24 btes microseconds */ | 225 | __u64 utime; /* 40 bits second, 24 btes microseconds */ |