aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-01-06 03:20:16 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:34:03 -0500
commitb15c2e57f0f5bf596a19e9c5571e5b07cdfc7363 (patch)
treeda68e3ed72e59212936daf7dd4c86f1f9a7ab386 /drivers/md
parent6ff8d8ec06690f4011a6c3ad9e0759b9094f0601 (diff)
[PATCH] md: move bitmap_create to after md array has been initialised
This is important because bitmap_create uses mddev->resync_max_sectors and that doesn't have a valid value until after the array has been initialised (with pers->run()). [It doesn't make a difference for current personalities that support bitmaps, but will make a difference for raid10] This has the added advantage of meaning with can move the thread->timeout manipulation inside the bitmap.c code instead of sprinkling identical code throughout all personalities. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/bitmap.c4
-rw-r--r--drivers/md/md.c16
-rw-r--r--drivers/md/raid1.c8
-rw-r--r--drivers/md/raid5.c11
-rw-r--r--drivers/md/raid6main.c11
5 files changed, 15 insertions, 35 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 252d55df9642..b65c36d9e240 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1530,6 +1530,8 @@ void bitmap_destroy(mddev_t *mddev)
1530 return; 1530 return;
1531 1531
1532 mddev->bitmap = NULL; /* disconnect from the md device */ 1532 mddev->bitmap = NULL; /* disconnect from the md device */
1533 if (mddev->thread)
1534 mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
1533 1535
1534 bitmap_free(bitmap); 1536 bitmap_free(bitmap);
1535} 1537}
@@ -1636,6 +1638,8 @@ int bitmap_create(mddev_t *mddev)
1636 1638
1637 if (IS_ERR(bitmap->writeback_daemon)) 1639 if (IS_ERR(bitmap->writeback_daemon))
1638 return PTR_ERR(bitmap->writeback_daemon); 1640 return PTR_ERR(bitmap->writeback_daemon);
1641 mddev->thread->timeout = bitmap->daemon_sleep * HZ;
1642
1639 return bitmap_update_sb(bitmap); 1643 return bitmap_update_sb(bitmap);
1640 1644
1641 error: 1645 error:
diff --git a/drivers/md/md.c b/drivers/md/md.c
index b4fb7247b3ed..ee199d462520 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2054,13 +2054,15 @@ static int do_md_run(mddev_t * mddev)
2054 if (start_readonly) 2054 if (start_readonly)
2055 mddev->ro = 2; /* read-only, but switch on first write */ 2055 mddev->ro = 2; /* read-only, but switch on first write */
2056 2056
2057 /* before we start the array running, initialise the bitmap */ 2057 err = mddev->pers->run(mddev);
2058 err = bitmap_create(mddev); 2058 if (!err && mddev->pers->sync_request) {
2059 if (err) 2059 err = bitmap_create(mddev);
2060 printk(KERN_ERR "%s: failed to create bitmap (%d)\n", 2060 if (err) {
2061 mdname(mddev), err); 2061 printk(KERN_ERR "%s: failed to create bitmap (%d)\n",
2062 else 2062 mdname(mddev), err);
2063 err = mddev->pers->run(mddev); 2063 mddev->pers->stop(mddev);
2064 }
2065 }
2064 if (err) { 2066 if (err) {
2065 printk(KERN_ERR "md: pers->run() failed ...\n"); 2067 printk(KERN_ERR "md: pers->run() failed ...\n");
2066 module_put(mddev->pers->owner); 2068 module_put(mddev->pers->owner);
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index f5204149ab65..c618015f07f6 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1611,7 +1611,6 @@ static int run(mddev_t *mddev)
1611 mdname(mddev)); 1611 mdname(mddev));
1612 goto out_free_conf; 1612 goto out_free_conf;
1613 } 1613 }
1614 if (mddev->bitmap) mddev->thread->timeout = mddev->bitmap->daemon_sleep * HZ;
1615 1614
1616 printk(KERN_INFO 1615 printk(KERN_INFO
1617 "raid1: raid set %s active with %d out of %d mirrors\n", 1616 "raid1: raid set %s active with %d out of %d mirrors\n",
@@ -1783,13 +1782,6 @@ static void raid1_quiesce(mddev_t *mddev, int state)
1783 lower_barrier(conf); 1782 lower_barrier(conf);
1784 break; 1783 break;
1785 } 1784 }
1786 if (mddev->thread) {
1787 if (mddev->bitmap)
1788 mddev->thread->timeout = mddev->bitmap->daemon_sleep * HZ;
1789 else
1790 mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
1791 md_wakeup_thread(mddev->thread);
1792 }
1793} 1785}
1794 1786
1795 1787
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 53a0f2ce76c8..0d016a844ec6 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -1964,9 +1964,6 @@ static int run(mddev_t *mddev)
1964 /* Ok, everything is just fine now */ 1964 /* Ok, everything is just fine now */
1965 sysfs_create_group(&mddev->kobj, &raid5_attrs_group); 1965 sysfs_create_group(&mddev->kobj, &raid5_attrs_group);
1966 1966
1967 if (mddev->bitmap)
1968 mddev->thread->timeout = mddev->bitmap->daemon_sleep * HZ;
1969
1970 mddev->queue->unplug_fn = raid5_unplug_device; 1967 mddev->queue->unplug_fn = raid5_unplug_device;
1971 mddev->queue->issue_flush_fn = raid5_issue_flush; 1968 mddev->queue->issue_flush_fn = raid5_issue_flush;
1972 1969
@@ -2200,14 +2197,8 @@ static void raid5_quiesce(mddev_t *mddev, int state)
2200 spin_unlock_irq(&conf->device_lock); 2197 spin_unlock_irq(&conf->device_lock);
2201 break; 2198 break;
2202 } 2199 }
2203 if (mddev->thread) {
2204 if (mddev->bitmap)
2205 mddev->thread->timeout = mddev->bitmap->daemon_sleep * HZ;
2206 else
2207 mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
2208 md_wakeup_thread(mddev->thread);
2209 }
2210} 2200}
2201
2211static mdk_personality_t raid5_personality= 2202static mdk_personality_t raid5_personality=
2212{ 2203{
2213 .name = "raid5", 2204 .name = "raid5",
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c
index 9ac6dcd55127..304455d236f9 100644
--- a/drivers/md/raid6main.c
+++ b/drivers/md/raid6main.c
@@ -1990,9 +1990,6 @@ static int run(mddev_t *mddev)
1990 /* Ok, everything is just fine now */ 1990 /* Ok, everything is just fine now */
1991 mddev->array_size = mddev->size * (mddev->raid_disks - 2); 1991 mddev->array_size = mddev->size * (mddev->raid_disks - 2);
1992 1992
1993 if (mddev->bitmap)
1994 mddev->thread->timeout = mddev->bitmap->daemon_sleep * HZ;
1995
1996 mddev->queue->unplug_fn = raid6_unplug_device; 1993 mddev->queue->unplug_fn = raid6_unplug_device;
1997 mddev->queue->issue_flush_fn = raid6_issue_flush; 1994 mddev->queue->issue_flush_fn = raid6_issue_flush;
1998 return 0; 1995 return 0;
@@ -2228,14 +2225,8 @@ static void raid6_quiesce(mddev_t *mddev, int state)
2228 spin_unlock_irq(&conf->device_lock); 2225 spin_unlock_irq(&conf->device_lock);
2229 break; 2226 break;
2230 } 2227 }
2231 if (mddev->thread) {
2232 if (mddev->bitmap)
2233 mddev->thread->timeout = mddev->bitmap->daemon_sleep * HZ;
2234 else
2235 mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
2236 md_wakeup_thread(mddev->thread);
2237 }
2238} 2228}
2229
2239static mdk_personality_t raid6_personality= 2230static mdk_personality_t raid6_personality=
2240{ 2231{
2241 .name = "raid6", 2232 .name = "raid6",