Skip to content

Commit 5518049

Browse files
ZhiqiangLiu26liu-song-6
authored andcommitted
md-bitmap: small cleanups
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>
1 parent 8e42d23 commit 5518049

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎drivers/md/md-bitmap.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,8 +1019,6 @@ void md_bitmap_unplug(struct bitmap *bitmap)
10191019
/* look at each page to see if there are any set bits that need to be
10201020
* flushed out to disk */
10211021
for (i = 0; i < bitmap->storage.file_pages; i++) {
1022-
if (!bitmap->storage.filemap)
1023-
return;
10241022
dirty = test_and_clear_page_attr(bitmap, i, BITMAP_PAGE_DIRTY);
10251023
need_write = test_and_clear_page_attr(bitmap, i,
10261024
BITMAP_PAGE_NEEDWRITE);
@@ -1338,7 +1336,8 @@ void md_bitmap_daemon_work(struct mddev *mddev)
13381336
BITMAP_PAGE_DIRTY))
13391337
/* bitmap_unplug will handle the rest */
13401338
break;
1341-
if (test_and_clear_page_attr(bitmap, j,
1339+
if (bitmap->storage.filemap &&
1340+
test_and_clear_page_attr(bitmap, j,
13421341
BITMAP_PAGE_NEEDWRITE)) {
13431342
write_page(bitmap, bitmap->storage.filemap[j], 0);
13441343
}

0 commit comments

Comments
 (0)