]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
md-bitmap: small cleanups
authorZhiqiang Liu <liuzhiqiang26@huawei.com>
Sat, 7 Dec 2019 03:00:08 +0000 (11:00 +0800)
committerSong Liu <songliubraving@fb.com>
Mon, 13 Jan 2020 19:44:09 +0000 (11:44 -0800)
In md_bitmap_unplug, bitmap->storage.filemap is double checked.

In md_bitmap_daemon_work, bitmap->storage.filemap should be checked
before reference.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
drivers/md/md-bitmap.c

index 3ad18246fcb3c1aba6cd98b69a57b7d40bcf099e..9860062bdc1edde008a94069fe13d5cf03735ce4 100644 (file)
@@ -1019,8 +1019,6 @@ void md_bitmap_unplug(struct bitmap *bitmap)
        /* look at each page to see if there are any set bits that need to be
         * flushed out to disk */
        for (i = 0; i < bitmap->storage.file_pages; i++) {
-               if (!bitmap->storage.filemap)
-                       return;
                dirty = test_and_clear_page_attr(bitmap, i, BITMAP_PAGE_DIRTY);
                need_write = test_and_clear_page_attr(bitmap, i,
                                                      BITMAP_PAGE_NEEDWRITE);
@@ -1338,7 +1336,8 @@ void md_bitmap_daemon_work(struct mddev *mddev)
                                   BITMAP_PAGE_DIRTY))
                        /* bitmap_unplug will handle the rest */
                        break;
-               if (test_and_clear_page_attr(bitmap, j,
+               if (bitmap->storage.filemap &&
+                   test_and_clear_page_attr(bitmap, j,
                                             BITMAP_PAGE_NEEDWRITE)) {
                        write_page(bitmap, bitmap->storage.filemap[j], 0);
                }