diff options
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index f7f19088f3be..8cbf9c9df1c3 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 | ||
977 | static unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb) | 977 | static __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); |
@@ -2002,6 +2003,7 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_mi | |||
2002 | kobject_init(&rdev->kobj); | 2003 | kobject_init(&rdev->kobj); |
2003 | 2004 | ||
2004 | rdev->desc_nr = -1; | 2005 | rdev->desc_nr = -1; |
2006 | rdev->saved_raid_disk = -1; | ||
2005 | rdev->flags = 0; | 2007 | rdev->flags = 0; |
2006 | rdev->data_offset = 0; | 2008 | rdev->data_offset = 0; |
2007 | rdev->sb_events = 0; | 2009 | rdev->sb_events = 0; |
@@ -3198,6 +3200,7 @@ static int do_md_run(mddev_t * mddev) | |||
3198 | 3200 | ||
3199 | mddev->changed = 1; | 3201 | mddev->changed = 1; |
3200 | md_new_event(mddev); | 3202 | md_new_event(mddev); |
3203 | kobject_uevent(&mddev->gendisk->kobj, KOBJ_CHANGE); | ||
3201 | return 0; | 3204 | return 0; |
3202 | } | 3205 | } |
3203 | 3206 | ||
@@ -4043,11 +4046,8 @@ static int update_size(mddev_t *mddev, unsigned long size) | |||
4043 | return -EBUSY; | 4046 | return -EBUSY; |
4044 | ITERATE_RDEV(mddev,rdev,tmp) { | 4047 | ITERATE_RDEV(mddev,rdev,tmp) { |
4045 | sector_t avail; | 4048 | sector_t avail; |
4046 | if (rdev->sb_offset > rdev->data_offset) | 4049 | avail = rdev->size * 2; |
4047 | avail = (rdev->sb_offset*2) - rdev->data_offset; | 4050 | |
4048 | else | ||
4049 | avail = get_capacity(rdev->bdev->bd_disk) | ||
4050 | - rdev->data_offset; | ||
4051 | if (fit && (size == 0 || size > avail/2)) | 4051 | if (fit && (size == 0 || size > avail/2)) |
4052 | size = avail/2; | 4052 | size = avail/2; |
4053 | if (avail < ((sector_t)size << 1)) | 4053 | if (avail < ((sector_t)size << 1)) |
@@ -4486,6 +4486,7 @@ static int md_thread(void * arg) | |||
4486 | * many dirty RAID5 blocks. | 4486 | * many dirty RAID5 blocks. |
4487 | */ | 4487 | */ |
4488 | 4488 | ||
4489 | current->flags |= PF_NOFREEZE; | ||
4489 | allow_signal(SIGKILL); | 4490 | allow_signal(SIGKILL); |
4490 | while (!kthread_should_stop()) { | 4491 | while (!kthread_should_stop()) { |
4491 | 4492 | ||
@@ -4502,7 +4503,6 @@ static int md_thread(void * arg) | |||
4502 | test_bit(THREAD_WAKEUP, &thread->flags) | 4503 | test_bit(THREAD_WAKEUP, &thread->flags) |
4503 | || kthread_should_stop(), | 4504 | || kthread_should_stop(), |
4504 | thread->timeout); | 4505 | thread->timeout); |
4505 | try_to_freeze(); | ||
4506 | 4506 | ||
4507 | clear_bit(THREAD_WAKEUP, &thread->flags); | 4507 | clear_bit(THREAD_WAKEUP, &thread->flags); |
4508 | 4508 | ||