md/bitmap: daemon_work cleanup.
authorNeilBrown <neilb@suse.de>
Thu, 22 Dec 2011 23:17:50 +0000 (10:17 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 22 Dec 2011 23:17:50 +0000 (10:17 +1100)
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: NeilBrown <neilb@suse.de>
drivers/md/bitmap.c

index 6d03774b176ec8236d9cfb72654bedf600f052d2..048eec75147466666eb7f8579466734b5f9a0556 100644 (file)
@@ -1149,12 +1149,12 @@ void bitmap_daemon_work(struct mddev *mddev)
                return;
        }
        if (time_before(jiffies, bitmap->daemon_lastrun
-                       + bitmap->mddev->bitmap_info.daemon_sleep))
+                       + mddev->bitmap_info.daemon_sleep))
                goto done;
 
        bitmap->daemon_lastrun = jiffies;
        if (bitmap->allclean) {
-               bitmap->mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
+               mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
                goto done;
        }
        bitmap->allclean = 1;
@@ -1206,7 +1206,7 @@ void bitmap_daemon_work(struct mddev *mddev)
                         * sure that events_cleared is up-to-date.
                         */
                        if (bitmap->need_sync &&
-                           bitmap->mddev->bitmap_info.external == 0) {
+                           mddev->bitmap_info.external == 0) {
                                bitmap_super_t *sb;
                                bitmap->need_sync = 0;
                                sb = kmap_atomic(bitmap->sb_page, KM_USER0);
@@ -1270,8 +1270,8 @@ void bitmap_daemon_work(struct mddev *mddev)
 
  done:
        if (bitmap->allclean == 0)
-               bitmap->mddev->thread->timeout =
-                       bitmap->mddev->bitmap_info.daemon_sleep;
+               mddev->thread->timeout =
+                       mddev->bitmap_info.daemon_sleep;
        mutex_unlock(&mddev->bitmap_info.mutex);
 }