aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/bitmap.c')
-rw-r--r--drivers/md/bitmap.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 7878712721bf..6d03774b176e 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1106,10 +1106,12 @@ void bitmap_write_all(struct bitmap *bitmap)
1106 */ 1106 */
1107 int i; 1107 int i;
1108 1108
1109 spin_lock_irq(&bitmap->lock);
1109 for (i = 0; i < bitmap->file_pages; i++) 1110 for (i = 0; i < bitmap->file_pages; i++)
1110 set_page_attr(bitmap, bitmap->filemap[i], 1111 set_page_attr(bitmap, bitmap->filemap[i],
1111 BITMAP_PAGE_NEEDWRITE); 1112 BITMAP_PAGE_NEEDWRITE);
1112 bitmap->allclean = 0; 1113 bitmap->allclean = 0;
1114 spin_unlock_irq(&bitmap->lock);
1113} 1115}
1114 1116
1115static void bitmap_count_page(struct bitmap *bitmap, sector_t offset, int inc) 1117static void bitmap_count_page(struct bitmap *bitmap, sector_t offset, int inc)
@@ -1391,9 +1393,6 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto
1391 atomic_read(&bitmap->behind_writes), 1393 atomic_read(&bitmap->behind_writes),
1392 bitmap->mddev->bitmap_info.max_write_behind); 1394 bitmap->mddev->bitmap_info.max_write_behind);
1393 } 1395 }
1394 if (bitmap->mddev->degraded)
1395 /* Never clear bits or update events_cleared when degraded */
1396 success = 0;
1397 1396
1398 while (sectors) { 1397 while (sectors) {
1399 sector_t blocks; 1398 sector_t blocks;
@@ -1407,7 +1406,7 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto
1407 return; 1406 return;
1408 } 1407 }
1409 1408
1410 if (success && 1409 if (success && !bitmap->mddev->degraded &&
1411 bitmap->events_cleared < bitmap->mddev->events) { 1410 bitmap->events_cleared < bitmap->mddev->events) {
1412 bitmap->events_cleared = bitmap->mddev->events; 1411 bitmap->events_cleared = bitmap->mddev->events;
1413 bitmap->need_sync = 1; 1412 bitmap->need_sync = 1;
@@ -1605,7 +1604,9 @@ void bitmap_dirty_bits(struct bitmap *bitmap, unsigned long s, unsigned long e)
1605 for (chunk = s; chunk <= e; chunk++) { 1604 for (chunk = s; chunk <= e; chunk++) {
1606 sector_t sec = (sector_t)chunk << CHUNK_BLOCK_SHIFT(bitmap); 1605 sector_t sec = (sector_t)chunk << CHUNK_BLOCK_SHIFT(bitmap);
1607 bitmap_set_memory_bits(bitmap, sec, 1); 1606 bitmap_set_memory_bits(bitmap, sec, 1);
1607 spin_lock_irq(&bitmap->lock);
1608 bitmap_file_set_bit(bitmap, sec); 1608 bitmap_file_set_bit(bitmap, sec);
1609 spin_unlock_irq(&bitmap->lock);
1609 if (sec < bitmap->mddev->recovery_cp) 1610 if (sec < bitmap->mddev->recovery_cp)
1610 /* We are asserting that the array is dirty, 1611 /* We are asserting that the array is dirty,
1611 * so move the recovery_cp address back so 1612 * so move the recovery_cp address back so