mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
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>
This commit is contained in:
parent
8e42d239cb
commit
55180498df
1 changed files with 2 additions and 3 deletions
|
@ -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
|
/* look at each page to see if there are any set bits that need to be
|
||||||
* flushed out to disk */
|
* flushed out to disk */
|
||||||
for (i = 0; i < bitmap->storage.file_pages; i++) {
|
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);
|
dirty = test_and_clear_page_attr(bitmap, i, BITMAP_PAGE_DIRTY);
|
||||||
need_write = test_and_clear_page_attr(bitmap, i,
|
need_write = test_and_clear_page_attr(bitmap, i,
|
||||||
BITMAP_PAGE_NEEDWRITE);
|
BITMAP_PAGE_NEEDWRITE);
|
||||||
|
@ -1338,7 +1336,8 @@ void md_bitmap_daemon_work(struct mddev *mddev)
|
||||||
BITMAP_PAGE_DIRTY))
|
BITMAP_PAGE_DIRTY))
|
||||||
/* bitmap_unplug will handle the rest */
|
/* bitmap_unplug will handle the rest */
|
||||||
break;
|
break;
|
||||||
if (test_and_clear_page_attr(bitmap, j,
|
if (bitmap->storage.filemap &&
|
||||||
|
test_and_clear_page_attr(bitmap, j,
|
||||||
BITMAP_PAGE_NEEDWRITE)) {
|
BITMAP_PAGE_NEEDWRITE)) {
|
||||||
write_page(bitmap, bitmap->storage.filemap[j], 0);
|
write_page(bitmap, bitmap->storage.filemap[j], 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue