aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index adf960d8a7c9..8175a2a222da 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1028,7 +1028,6 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev)
1028 mddev->size = le64_to_cpu(sb->size)/2; 1028 mddev->size = le64_to_cpu(sb->size)/2;
1029 mddev->events = le64_to_cpu(sb->events); 1029 mddev->events = le64_to_cpu(sb->events);
1030 mddev->bitmap_offset = 0; 1030 mddev->bitmap_offset = 0;
1031 mddev->default_bitmap_offset = 0;
1032 mddev->default_bitmap_offset = 1024; 1031 mddev->default_bitmap_offset = 1024;
1033 1032
1034 mddev->recovery_cp = le64_to_cpu(sb->resync_offset); 1033 mddev->recovery_cp = le64_to_cpu(sb->resync_offset);
@@ -1730,7 +1729,7 @@ level_show(mddev_t *mddev, char *page)
1730 if (p == NULL && mddev->raid_disks == 0) 1729 if (p == NULL && mddev->raid_disks == 0)
1731 return 0; 1730 return 0;
1732 if (mddev->level >= 0) 1731 if (mddev->level >= 0)
1733 return sprintf(page, "RAID-%d\n", mddev->level); 1732 return sprintf(page, "raid%d\n", mddev->level);
1734 else 1733 else
1735 return sprintf(page, "%s\n", p->name); 1734 return sprintf(page, "%s\n", p->name);
1736} 1735}
@@ -2932,6 +2931,9 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info)
2932 2931
2933 mddev->sb_dirty = 1; 2932 mddev->sb_dirty = 1;
2934 2933
2934 mddev->default_bitmap_offset = MD_SB_BYTES >> 9;
2935 mddev->bitmap_offset = 0;
2936
2935 /* 2937 /*
2936 * Generate a 128 bit UUID 2938 * Generate a 128 bit UUID
2937 */ 2939 */
@@ -3156,7 +3158,7 @@ static int md_ioctl(struct inode *inode, struct file *file,
3156 if (cnt > 0 ) { 3158 if (cnt > 0 ) {
3157 printk(KERN_WARNING 3159 printk(KERN_WARNING
3158 "md: %s(pid %d) used deprecated START_ARRAY ioctl. " 3160 "md: %s(pid %d) used deprecated START_ARRAY ioctl. "
3159 "This will not be supported beyond 2.6\n", 3161 "This will not be supported beyond July 2006\n",
3160 current->comm, current->pid); 3162 current->comm, current->pid);
3161 cnt--; 3163 cnt--;
3162 } 3164 }
@@ -3437,10 +3439,19 @@ static int md_thread(void * arg)
3437 allow_signal(SIGKILL); 3439 allow_signal(SIGKILL);
3438 while (!kthread_should_stop()) { 3440 while (!kthread_should_stop()) {
3439 3441
3440 wait_event_timeout(thread->wqueue, 3442 /* We need to wait INTERRUPTIBLE so that
3441 test_bit(THREAD_WAKEUP, &thread->flags) 3443 * we don't add to the load-average.
3442 || kthread_should_stop(), 3444 * That means we need to be sure no signals are
3443 thread->timeout); 3445 * pending
3446 */
3447 if (signal_pending(current))
3448 flush_signals(current);
3449
3450 wait_event_interruptible_timeout
3451 (thread->wqueue,
3452 test_bit(THREAD_WAKEUP, &thread->flags)
3453 || kthread_should_stop(),
3454 thread->timeout);
3444 try_to_freeze(); 3455 try_to_freeze();
3445 3456
3446 clear_bit(THREAD_WAKEUP, &thread->flags); 3457 clear_bit(THREAD_WAKEUP, &thread->flags);
@@ -3837,11 +3848,20 @@ static int is_mddev_idle(mddev_t *mddev)
3837 curr_events = disk_stat_read(disk, sectors[0]) + 3848 curr_events = disk_stat_read(disk, sectors[0]) +
3838 disk_stat_read(disk, sectors[1]) - 3849 disk_stat_read(disk, sectors[1]) -
3839 atomic_read(&disk->sync_io); 3850 atomic_read(&disk->sync_io);
3840 /* Allow some slack between valud of curr_events and last_events, 3851 /* The difference between curr_events and last_events
3841 * as there are some uninteresting races. 3852 * will be affected by any new non-sync IO (making
3853 * curr_events bigger) and any difference in the amount of
3854 * in-flight syncio (making current_events bigger or smaller)
3855 * The amount in-flight is currently limited to
3856 * 32*64K in raid1/10 and 256*PAGE_SIZE in raid5/6
3857 * which is at most 4096 sectors.
3858 * These numbers are fairly fragile and should be made
3859 * more robust, probably by enforcing the
3860 * 'window size' that md_do_sync sort-of uses.
3861 *
3842 * Note: the following is an unsigned comparison. 3862 * Note: the following is an unsigned comparison.
3843 */ 3863 */
3844 if ((curr_events - rdev->last_events + 32) > 64) { 3864 if ((curr_events - rdev->last_events + 4096) > 8192) {
3845 rdev->last_events = curr_events; 3865 rdev->last_events = curr_events;
3846 idle = 0; 3866 idle = 0;
3847 } 3867 }
@@ -4100,7 +4120,7 @@ static void md_do_sync(mddev_t *mddev)
4100 if (currspeed > sysctl_speed_limit_min) { 4120 if (currspeed > sysctl_speed_limit_min) {
4101 if ((currspeed > sysctl_speed_limit_max) || 4121 if ((currspeed > sysctl_speed_limit_max) ||
4102 !is_mddev_idle(mddev)) { 4122 !is_mddev_idle(mddev)) {
4103 msleep(250); 4123 msleep(500);
4104 goto repeat; 4124 goto repeat;
4105 } 4125 }
4106 } 4126 }