aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/bitmap.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index a1862d9e6d83..7e015c9ea73e 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -739,7 +739,6 @@ static void bitmap_file_unmap(struct bitmap *bitmap)
739 int pages; 739 int pages;
740 struct bitmap_storage *store = &bitmap->storage; 740 struct bitmap_storage *store = &bitmap->storage;
741 741
742 spin_lock_irq(&bitmap->lock);
743 map = store->filemap; 742 map = store->filemap;
744 store->filemap = NULL; 743 store->filemap = NULL;
745 attr = store->filemap_attr; 744 attr = store->filemap_attr;
@@ -748,7 +747,6 @@ static void bitmap_file_unmap(struct bitmap *bitmap)
748 store->file_pages = 0; 747 store->file_pages = 0;
749 sb_page = store->sb_page; 748 sb_page = store->sb_page;
750 store->sb_page = NULL; 749 store->sb_page = NULL;
751 spin_unlock_irq(&bitmap->lock);
752 750
753 while (pages--) 751 while (pages--)
754 if (map[pages] != sb_page) /* 0 is sb_page, release it below */ 752 if (map[pages] != sb_page) /* 0 is sb_page, release it below */
@@ -764,10 +762,8 @@ static void bitmap_file_put(struct bitmap *bitmap)
764{ 762{
765 struct file *file; 763 struct file *file;
766 764
767 spin_lock_irq(&bitmap->lock);
768 file = bitmap->storage.file; 765 file = bitmap->storage.file;
769 bitmap->storage.file = NULL; 766 bitmap->storage.file = NULL;
770 spin_unlock_irq(&bitmap->lock);
771 767
772 if (file) 768 if (file)
773 wait_event(bitmap->write_wait, 769 wait_event(bitmap->write_wait,
@@ -809,10 +805,6 @@ static void bitmap_file_kick(struct bitmap *bitmap)
809 "%s: disabling internal bitmap due to errors\n", 805 "%s: disabling internal bitmap due to errors\n",
810 bmname(bitmap)); 806 bmname(bitmap));
811 } 807 }
812
813 bitmap_file_put(bitmap);
814
815 return;
816} 808}
817 809
818enum bitmap_page_attr { 810enum bitmap_page_attr {
@@ -903,7 +895,8 @@ void bitmap_unplug(struct bitmap *bitmap)
903 int dirty, need_write; 895 int dirty, need_write;
904 int wait = 0; 896 int wait = 0;
905 897
906 if (!bitmap || !bitmap->storage.filemap) 898 if (!bitmap || !bitmap->storage.filemap ||
899 test_bit(BITMAP_STALE, &bitmap->flags))
907 return; 900 return;
908 901
909 /* look at each page to see if there are any set bits that need to be 902 /* look at each page to see if there are any set bits that need to be
@@ -1222,7 +1215,10 @@ void bitmap_daemon_work(struct mddev *mddev)
1222 * the first blocking holds the superblock and it has been updated. 1215 * the first blocking holds the superblock and it has been updated.
1223 * We mustn't write any other blocks before the superblock. 1216 * We mustn't write any other blocks before the superblock.
1224 */ 1217 */
1225 for (j = 0; j < bitmap->storage.file_pages; j++) { 1218 for (j = 0;
1219 j < bitmap->storage.file_pages
1220 && !test_bit(BITMAP_STALE, &bitmap->flags);
1221 j++) {
1226 1222
1227 if (test_page_attr(bitmap, j, 1223 if (test_page_attr(bitmap, j,
1228 BITMAP_PAGE_DIRTY)) 1224 BITMAP_PAGE_DIRTY))
@@ -1235,8 +1231,6 @@ void bitmap_daemon_work(struct mddev *mddev)
1235 spin_unlock_irq(&bitmap->lock); 1231 spin_unlock_irq(&bitmap->lock);
1236 write_page(bitmap, bitmap->storage.filemap[j], 0); 1232 write_page(bitmap, bitmap->storage.filemap[j], 0);
1237 spin_lock_irq(&bitmap->lock); 1233 spin_lock_irq(&bitmap->lock);
1238 if (!bitmap->storage.filemap)
1239 break;
1240 } 1234 }
1241 } 1235 }
1242 spin_unlock_irq(&bitmap->lock); 1236 spin_unlock_irq(&bitmap->lock);