Commit 2e61ebbc authored by NeilBrown's avatar NeilBrown

md/bitmap: daemon_work cleanup.

We have a variable 'mddev' in this function, but repeatedly get the
same value by dereferencing bitmap->mddev.
There is room for simplification here...
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 506c9e44
...@@ -1149,12 +1149,12 @@ void bitmap_daemon_work(struct mddev *mddev) ...@@ -1149,12 +1149,12 @@ void bitmap_daemon_work(struct mddev *mddev)
return; return;
} }
if (time_before(jiffies, bitmap->daemon_lastrun if (time_before(jiffies, bitmap->daemon_lastrun
+ bitmap->mddev->bitmap_info.daemon_sleep)) + mddev->bitmap_info.daemon_sleep))
goto done; goto done;
bitmap->daemon_lastrun = jiffies; bitmap->daemon_lastrun = jiffies;
if (bitmap->allclean) { if (bitmap->allclean) {
bitmap->mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT; mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
goto done; goto done;
} }
bitmap->allclean = 1; bitmap->allclean = 1;
...@@ -1206,7 +1206,7 @@ void bitmap_daemon_work(struct mddev *mddev) ...@@ -1206,7 +1206,7 @@ void bitmap_daemon_work(struct mddev *mddev)
* sure that events_cleared is up-to-date. * sure that events_cleared is up-to-date.
*/ */
if (bitmap->need_sync && if (bitmap->need_sync &&
bitmap->mddev->bitmap_info.external == 0) { mddev->bitmap_info.external == 0) {
bitmap_super_t *sb; bitmap_super_t *sb;
bitmap->need_sync = 0; bitmap->need_sync = 0;
sb = kmap_atomic(bitmap->sb_page, KM_USER0); sb = kmap_atomic(bitmap->sb_page, KM_USER0);
...@@ -1270,8 +1270,8 @@ void bitmap_daemon_work(struct mddev *mddev) ...@@ -1270,8 +1270,8 @@ void bitmap_daemon_work(struct mddev *mddev)
done: done:
if (bitmap->allclean == 0) if (bitmap->allclean == 0)
bitmap->mddev->thread->timeout = mddev->thread->timeout =
bitmap->mddev->bitmap_info.daemon_sleep; mddev->bitmap_info.daemon_sleep;
mutex_unlock(&mddev->bitmap_info.mutex); mutex_unlock(&mddev->bitmap_info.mutex);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment