Commit aa3163f8 authored by NeilBrown's avatar NeilBrown Committed by Linus Torvalds

[PATCH] md: don't skip bitmap pages due to lack of bit that we just cleared.

When looking for pages that need cleaning we skip pages that don't have
BITMAP_PAGE_CLEAN set.  But if it is the 'current' page we will have cleared
that bit ourselves, so skipping it is wrong.  So: move the 'skip this page'
inside 'if page != lastpage'.

Also fold call of file_page_offset into the one place where the value (bit) is
used.
Signed-off-by: default avatarNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 77ad4bc7
...@@ -897,7 +897,7 @@ static bitmap_counter_t *bitmap_get_counter(struct bitmap *bitmap, ...@@ -897,7 +897,7 @@ static bitmap_counter_t *bitmap_get_counter(struct bitmap *bitmap,
int bitmap_daemon_work(struct bitmap *bitmap) int bitmap_daemon_work(struct bitmap *bitmap)
{ {
unsigned long bit, j; unsigned long j;
unsigned long flags; unsigned long flags;
struct page *page = NULL, *lastpage = NULL; struct page *page = NULL, *lastpage = NULL;
int err = 0; int err = 0;
...@@ -920,6 +920,8 @@ int bitmap_daemon_work(struct bitmap *bitmap) ...@@ -920,6 +920,8 @@ int bitmap_daemon_work(struct bitmap *bitmap)
} }
page = filemap_get_page(bitmap, j); page = filemap_get_page(bitmap, j);
if (page != lastpage) {
/* skip this page unless it's marked as needing cleaning */ /* skip this page unless it's marked as needing cleaning */
if (!((attr=get_page_attr(bitmap, page)) & BITMAP_PAGE_CLEAN)) { if (!((attr=get_page_attr(bitmap, page)) & BITMAP_PAGE_CLEAN)) {
if (attr & BITMAP_PAGE_NEEDWRITE) { if (attr & BITMAP_PAGE_NEEDWRITE) {
...@@ -935,9 +937,6 @@ int bitmap_daemon_work(struct bitmap *bitmap) ...@@ -935,9 +937,6 @@ int bitmap_daemon_work(struct bitmap *bitmap)
continue; continue;
} }
bit = file_page_offset(j);
if (page != lastpage) {
/* grab the new page, sync and release the old */ /* grab the new page, sync and release the old */
page_cache_get(page); page_cache_get(page);
if (lastpage != NULL) { if (lastpage != NULL) {
...@@ -979,7 +978,7 @@ int bitmap_daemon_work(struct bitmap *bitmap) ...@@ -979,7 +978,7 @@ int bitmap_daemon_work(struct bitmap *bitmap)
-1); -1);
/* clear the bit */ /* clear the bit */
clear_bit(bit, page_address(page)); clear_bit(file_page_offset(j), page_address(page));
} }
} }
spin_unlock_irqrestore(&bitmap->lock, flags); spin_unlock_irqrestore(&bitmap->lock, flags);
......
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