diff options
author | NeilBrown <neilb@suse.de> | 2009-12-13 20:49:53 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-12-13 20:51:41 -0500 |
commit | 1b04be96f6910ee415287bf0d5309c7d4c94bd2b (patch) | |
tree | 9ea6dbd8e3d857c468b12d698c629786903da905 | |
parent | 42a04b5078ce73a32f85762551d5703c5bd646a1 (diff) |
md: change daemon_sleep to be in 'jiffies' rather than 'seconds'.
This removes a lot of multiplications by HZ.
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | drivers/md/bitmap.c | 14 | ||||
-rw-r--r-- | drivers/md/raid10.c | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 1a5ada084487..c1f28a87ea59 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -565,7 +565,7 @@ static int bitmap_read_sb(struct bitmap *bitmap) | |||
565 | sb = (bitmap_super_t *)kmap_atomic(bitmap->sb_page, KM_USER0); | 565 | sb = (bitmap_super_t *)kmap_atomic(bitmap->sb_page, KM_USER0); |
566 | 566 | ||
567 | chunksize = le32_to_cpu(sb->chunksize); | 567 | chunksize = le32_to_cpu(sb->chunksize); |
568 | daemon_sleep = le32_to_cpu(sb->daemon_sleep); | 568 | daemon_sleep = le32_to_cpu(sb->daemon_sleep) * HZ; |
569 | write_behind = le32_to_cpu(sb->write_behind); | 569 | write_behind = le32_to_cpu(sb->write_behind); |
570 | 570 | ||
571 | /* verify that the bitmap-specific fields are valid */ | 571 | /* verify that the bitmap-specific fields are valid */ |
@@ -578,7 +578,7 @@ static int bitmap_read_sb(struct bitmap *bitmap) | |||
578 | reason = "bitmap chunksize too small"; | 578 | reason = "bitmap chunksize too small"; |
579 | else if ((1 << ffz(~chunksize)) != chunksize) | 579 | else if ((1 << ffz(~chunksize)) != chunksize) |
580 | reason = "bitmap chunksize not a power of 2"; | 580 | reason = "bitmap chunksize not a power of 2"; |
581 | else if (daemon_sleep < 1 || daemon_sleep > MAX_SCHEDULE_TIMEOUT / HZ) | 581 | else if (daemon_sleep < 1 || daemon_sleep > MAX_SCHEDULE_TIMEOUT) |
582 | reason = "daemon sleep period out of range"; | 582 | reason = "daemon sleep period out of range"; |
583 | else if (write_behind > COUNTER_MAX) | 583 | else if (write_behind > COUNTER_MAX) |
584 | reason = "write-behind limit out of range (0 - 16383)"; | 584 | reason = "write-behind limit out of range (0 - 16383)"; |
@@ -1100,7 +1100,7 @@ void bitmap_daemon_work(mddev_t *mddev) | |||
1100 | return; | 1100 | return; |
1101 | } | 1101 | } |
1102 | if (time_before(jiffies, bitmap->daemon_lastrun | 1102 | if (time_before(jiffies, bitmap->daemon_lastrun |
1103 | + bitmap->mddev->bitmap_info.daemon_sleep*HZ)) | 1103 | + bitmap->mddev->bitmap_info.daemon_sleep)) |
1104 | goto done; | 1104 | goto done; |
1105 | 1105 | ||
1106 | bitmap->daemon_lastrun = jiffies; | 1106 | bitmap->daemon_lastrun = jiffies; |
@@ -1215,7 +1215,7 @@ void bitmap_daemon_work(mddev_t *mddev) | |||
1215 | done: | 1215 | done: |
1216 | if (bitmap->allclean == 0) | 1216 | if (bitmap->allclean == 0) |
1217 | bitmap->mddev->thread->timeout = | 1217 | bitmap->mddev->thread->timeout = |
1218 | bitmap->mddev->bitmap_info.daemon_sleep * HZ; | 1218 | bitmap->mddev->bitmap_info.daemon_sleep; |
1219 | mutex_unlock(&mddev->bitmap_info.mutex); | 1219 | mutex_unlock(&mddev->bitmap_info.mutex); |
1220 | } | 1220 | } |
1221 | 1221 | ||
@@ -1484,7 +1484,7 @@ void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector) | |||
1484 | return; | 1484 | return; |
1485 | } | 1485 | } |
1486 | if (time_before(jiffies, (bitmap->last_end_sync | 1486 | if (time_before(jiffies, (bitmap->last_end_sync |
1487 | + bitmap->mddev->bitmap_info.daemon_sleep * HZ))) | 1487 | + bitmap->mddev->bitmap_info.daemon_sleep))) |
1488 | return; | 1488 | return; |
1489 | wait_event(bitmap->mddev->recovery_wait, | 1489 | wait_event(bitmap->mddev->recovery_wait, |
1490 | atomic_read(&bitmap->mddev->recovery_active) == 0); | 1490 | atomic_read(&bitmap->mddev->recovery_active) == 0); |
@@ -1553,7 +1553,7 @@ void bitmap_flush(mddev_t *mddev) | |||
1553 | /* run the daemon_work three time to ensure everything is flushed | 1553 | /* run the daemon_work three time to ensure everything is flushed |
1554 | * that can be | 1554 | * that can be |
1555 | */ | 1555 | */ |
1556 | sleep = mddev->bitmap_info.daemon_sleep * HZ * 2; | 1556 | sleep = mddev->bitmap_info.daemon_sleep * 2; |
1557 | bitmap->daemon_lastrun -= sleep; | 1557 | bitmap->daemon_lastrun -= sleep; |
1558 | bitmap_daemon_work(mddev); | 1558 | bitmap_daemon_work(mddev); |
1559 | bitmap->daemon_lastrun -= sleep; | 1559 | bitmap->daemon_lastrun -= sleep; |
@@ -1694,7 +1694,7 @@ int bitmap_create(mddev_t *mddev) | |||
1694 | 1694 | ||
1695 | mddev->bitmap = bitmap; | 1695 | mddev->bitmap = bitmap; |
1696 | 1696 | ||
1697 | mddev->thread->timeout = mddev->bitmap_info.daemon_sleep * HZ; | 1697 | mddev->thread->timeout = mddev->bitmap_info.daemon_sleep; |
1698 | 1698 | ||
1699 | bitmap_update_sb(bitmap); | 1699 | bitmap_update_sb(bitmap); |
1700 | 1700 | ||
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 2255e33a3ecb..064c2bb5ee63 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -2277,7 +2277,7 @@ static void raid10_quiesce(mddev_t *mddev, int state) | |||
2277 | } | 2277 | } |
2278 | if (mddev->thread) { | 2278 | if (mddev->thread) { |
2279 | if (mddev->bitmap) | 2279 | if (mddev->bitmap) |
2280 | mddev->thread->timeout = mddev->bitmap_info.daemon_sleep * HZ; | 2280 | mddev->thread->timeout = mddev->bitmap_info.daemon_sleep; |
2281 | else | 2281 | else |
2282 | mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT; | 2282 | mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT; |
2283 | md_wakeup_thread(mddev->thread); | 2283 | md_wakeup_thread(mddev->thread); |