Skip to content

Commit

Permalink
md: change daemon_sleep to be in 'jiffies' rather than 'seconds'.
Browse files Browse the repository at this point in the history
This removes a lot of multiplications by HZ.

Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
NeilBrown committed Dec 14, 2009
1 parent 42a04b5 commit 1b04be9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions drivers/md/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ static int bitmap_read_sb(struct bitmap *bitmap)
sb = (bitmap_super_t *)kmap_atomic(bitmap->sb_page, KM_USER0);

chunksize = le32_to_cpu(sb->chunksize);
daemon_sleep = le32_to_cpu(sb->daemon_sleep);
daemon_sleep = le32_to_cpu(sb->daemon_sleep) * HZ;
write_behind = le32_to_cpu(sb->write_behind);

/* verify that the bitmap-specific fields are valid */
Expand All @@ -578,7 +578,7 @@ static int bitmap_read_sb(struct bitmap *bitmap)
reason = "bitmap chunksize too small";
else if ((1 << ffz(~chunksize)) != chunksize)
reason = "bitmap chunksize not a power of 2";
else if (daemon_sleep < 1 || daemon_sleep > MAX_SCHEDULE_TIMEOUT / HZ)
else if (daemon_sleep < 1 || daemon_sleep > MAX_SCHEDULE_TIMEOUT)
reason = "daemon sleep period out of range";
else if (write_behind > COUNTER_MAX)
reason = "write-behind limit out of range (0 - 16383)";
Expand Down Expand Up @@ -1100,7 +1100,7 @@ void bitmap_daemon_work(mddev_t *mddev)
return;
}
if (time_before(jiffies, bitmap->daemon_lastrun
+ bitmap->mddev->bitmap_info.daemon_sleep*HZ))
+ bitmap->mddev->bitmap_info.daemon_sleep))
goto done;

bitmap->daemon_lastrun = jiffies;
Expand Down Expand Up @@ -1215,7 +1215,7 @@ void bitmap_daemon_work(mddev_t *mddev)
done:
if (bitmap->allclean == 0)
bitmap->mddev->thread->timeout =
bitmap->mddev->bitmap_info.daemon_sleep * HZ;
bitmap->mddev->bitmap_info.daemon_sleep;
mutex_unlock(&mddev->bitmap_info.mutex);
}

Expand Down Expand Up @@ -1484,7 +1484,7 @@ void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector)
return;
}
if (time_before(jiffies, (bitmap->last_end_sync
+ bitmap->mddev->bitmap_info.daemon_sleep * HZ)))
+ bitmap->mddev->bitmap_info.daemon_sleep)))
return;
wait_event(bitmap->mddev->recovery_wait,
atomic_read(&bitmap->mddev->recovery_active) == 0);
Expand Down Expand Up @@ -1553,7 +1553,7 @@ void bitmap_flush(mddev_t *mddev)
/* run the daemon_work three time to ensure everything is flushed
* that can be
*/
sleep = mddev->bitmap_info.daemon_sleep * HZ * 2;
sleep = mddev->bitmap_info.daemon_sleep * 2;
bitmap->daemon_lastrun -= sleep;
bitmap_daemon_work(mddev);
bitmap->daemon_lastrun -= sleep;
Expand Down Expand Up @@ -1694,7 +1694,7 @@ int bitmap_create(mddev_t *mddev)

mddev->bitmap = bitmap;

mddev->thread->timeout = mddev->bitmap_info.daemon_sleep * HZ;
mddev->thread->timeout = mddev->bitmap_info.daemon_sleep;

bitmap_update_sb(bitmap);

Expand Down
2 changes: 1 addition & 1 deletion drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -2277,7 +2277,7 @@ static void raid10_quiesce(mddev_t *mddev, int state)
}
if (mddev->thread) {
if (mddev->bitmap)
mddev->thread->timeout = mddev->bitmap_info.daemon_sleep * HZ;
mddev->thread->timeout = mddev->bitmap_info.daemon_sleep;
else
mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
md_wakeup_thread(mddev->thread);
Expand Down

0 comments on commit 1b04be9

Please sign in to comment.