aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/md.c13
-rw-r--r--include/linux/raid/md_p.h56
2 files changed, 35 insertions, 34 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index f7f19088f3be..7daa7b1e145f 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -974,12 +974,13 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev)
974 * version 1 superblock 974 * version 1 superblock
975 */ 975 */
976 976
977static unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb) 977static __le32 calc_sb_1_csum(struct mdp_superblock_1 * sb)
978{ 978{
979 unsigned int disk_csum, csum; 979 __le32 disk_csum;
980 u32 csum;
980 unsigned long long newcsum; 981 unsigned long long newcsum;
981 int size = 256 + le32_to_cpu(sb->max_dev)*2; 982 int size = 256 + le32_to_cpu(sb->max_dev)*2;
982 unsigned int *isuper = (unsigned int*)sb; 983 __le32 *isuper = (__le32*)sb;
983 int i; 984 int i;
984 985
985 disk_csum = sb->sb_csum; 986 disk_csum = sb->sb_csum;
@@ -989,7 +990,7 @@ static unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb)
989 newcsum += le32_to_cpu(*isuper++); 990 newcsum += le32_to_cpu(*isuper++);
990 991
991 if (size == 2) 992 if (size == 2)
992 newcsum += le16_to_cpu(*(unsigned short*) isuper); 993 newcsum += le16_to_cpu(*(__le16*) isuper);
993 994
994 csum = (newcsum & 0xffffffff) + (newcsum >> 32); 995 csum = (newcsum & 0xffffffff) + (newcsum >> 32);
995 sb->sb_csum = disk_csum; 996 sb->sb_csum = disk_csum;
@@ -1106,7 +1107,7 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version)
1106 if (le32_to_cpu(sb->chunksize)) 1107 if (le32_to_cpu(sb->chunksize))
1107 rdev->size &= ~((sector_t)le32_to_cpu(sb->chunksize)/2 - 1); 1108 rdev->size &= ~((sector_t)le32_to_cpu(sb->chunksize)/2 - 1);
1108 1109
1109 if (le32_to_cpu(sb->size) > rdev->size*2) 1110 if (le64_to_cpu(sb->size) > rdev->size*2)
1110 return -EINVAL; 1111 return -EINVAL;
1111 return ret; 1112 return ret;
1112} 1113}
@@ -1228,7 +1229,7 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
1228 else 1229 else
1229 sb->resync_offset = cpu_to_le64(0); 1230 sb->resync_offset = cpu_to_le64(0);
1230 1231
1231 sb->cnt_corrected_read = atomic_read(&rdev->corrected_errors); 1232 sb->cnt_corrected_read = cpu_to_le32(atomic_read(&rdev->corrected_errors));
1232 1233
1233 sb->raid_disks = cpu_to_le32(mddev->raid_disks); 1234 sb->raid_disks = cpu_to_le32(mddev->raid_disks);
1234 sb->size = cpu_to_le64(mddev->size<<1); 1235 sb->size = cpu_to_le64(mddev->size<<1);
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index b6ebc69bae54..3f2cd98c508b 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -206,52 +206,52 @@ static inline __u64 md_event(mdp_super_t *sb) {
206 */ 206 */
207struct mdp_superblock_1 { 207struct mdp_superblock_1 {
208 /* constant array information - 128 bytes */ 208 /* constant array information - 128 bytes */
209 __u32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */ 209 __le32 magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */
210 __u32 major_version; /* 1 */ 210 __le32 major_version; /* 1 */
211 __u32 feature_map; /* bit 0 set if 'bitmap_offset' is meaningful */ 211 __le32 feature_map; /* bit 0 set if 'bitmap_offset' is meaningful */
212 __u32 pad0; /* always set to 0 when writing */ 212 __le32 pad0; /* always set to 0 when writing */
213 213
214 __u8 set_uuid[16]; /* user-space generated. */ 214 __u8 set_uuid[16]; /* user-space generated. */
215 char set_name[32]; /* set and interpreted by user-space */ 215 char set_name[32]; /* set and interpreted by user-space */
216 216
217 __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ 217 __le64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/
218 __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ 218 __le32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */
219 __u32 layout; /* only for raid5 and raid10 currently */ 219 __le32 layout; /* only for raid5 and raid10 currently */
220 __u64 size; /* used size of component devices, in 512byte sectors */ 220 __le64 size; /* used size of component devices, in 512byte sectors */
221 221
222 __u32 chunksize; /* in 512byte sectors */ 222 __le32 chunksize; /* in 512byte sectors */
223 __u32 raid_disks; 223 __le32 raid_disks;
224 __u32 bitmap_offset; /* sectors after start of superblock that bitmap starts 224 __le32 bitmap_offset; /* sectors after start of superblock that bitmap starts
225 * NOTE: signed, so bitmap can be before superblock 225 * NOTE: signed, so bitmap can be before superblock
226 * only meaningful of feature_map[0] is set. 226 * only meaningful of feature_map[0] is set.
227 */ 227 */
228 228
229 /* These are only valid with feature bit '4' */ 229 /* These are only valid with feature bit '4' */
230 __u32 new_level; /* new level we are reshaping to */ 230 __le32 new_level; /* new level we are reshaping to */
231 __u64 reshape_position; /* next address in array-space for reshape */ 231 __le64 reshape_position; /* next address in array-space for reshape */
232 __u32 delta_disks; /* change in number of raid_disks */ 232 __le32 delta_disks; /* change in number of raid_disks */
233 __u32 new_layout; /* new layout */ 233 __le32 new_layout; /* new layout */
234 __u32 new_chunk; /* new chunk size (bytes) */ 234 __le32 new_chunk; /* new chunk size (bytes) */
235 __u8 pad1[128-124]; /* set to 0 when written */ 235 __u8 pad1[128-124]; /* set to 0 when written */
236 236
237 /* constant this-device information - 64 bytes */ 237 /* constant this-device information - 64 bytes */
238 __u64 data_offset; /* sector start of data, often 0 */ 238 __le64 data_offset; /* sector start of data, often 0 */
239 __u64 data_size; /* sectors in this device that can be used for data */ 239 __le64 data_size; /* sectors in this device that can be used for data */
240 __u64 super_offset; /* sector start of this superblock */ 240 __le64 super_offset; /* sector start of this superblock */
241 __u64 recovery_offset;/* sectors before this offset (from data_offset) have been recovered */ 241 __le64 recovery_offset;/* sectors before this offset (from data_offset) have been recovered */
242 __u32 dev_number; /* permanent identifier of this device - not role in raid */ 242 __le32 dev_number; /* permanent identifier of this device - not role in raid */
243 __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ 243 __le32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */
244 __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ 244 __u8 device_uuid[16]; /* user-space setable, ignored by kernel */
245 __u8 devflags; /* per-device flags. Only one defined...*/ 245 __u8 devflags; /* per-device flags. Only one defined...*/
246#define WriteMostly1 1 /* mask for writemostly flag in above */ 246#define WriteMostly1 1 /* mask for writemostly flag in above */
247 __u8 pad2[64-57]; /* set to 0 when writing */ 247 __u8 pad2[64-57]; /* set to 0 when writing */
248 248
249 /* array state information - 64 bytes */ 249 /* array state information - 64 bytes */
250 __u64 utime; /* 40 bits second, 24 btes microseconds */ 250 __le64 utime; /* 40 bits second, 24 btes microseconds */
251 __u64 events; /* incremented when superblock updated */ 251 __le64 events; /* incremented when superblock updated */
252 __u64 resync_offset; /* data before this offset (from data_offset) known to be in sync */ 252 __le64 resync_offset; /* data before this offset (from data_offset) known to be in sync */
253 __u32 sb_csum; /* checksum upto devs[max_dev] */ 253 __le32 sb_csum; /* checksum upto devs[max_dev] */
254 __u32 max_dev; /* size of devs[] array to consider */ 254 __le32 max_dev; /* size of devs[] array to consider */
255 __u8 pad3[64-32]; /* set to 0 when writing */ 255 __u8 pad3[64-32]; /* set to 0 when writing */
256 256
257 /* device state information. Indexed by dev_number. 257 /* device state information. Indexed by dev_number.
@@ -260,7 +260,7 @@ struct mdp_superblock_1 {
260 * into the 'roles' value. If a device is spare or faulty, then it doesn't 260 * into the 'roles' value. If a device is spare or faulty, then it doesn't
261 * have a meaningful role. 261 * have a meaningful role.
262 */ 262 */
263 __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ 263 __le16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */
264}; 264};
265 265
266/* feature_map bits */ 266/* feature_map bits */