diff options
author | NeilBrown <neilb@suse.de> | 2012-05-21 23:55:23 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-05-21 23:55:23 -0400 |
commit | 63c68268b2fc63f7f612dfebecb5c9cbbd3ebeaf (patch) | |
tree | 731ea4f181b2ffc19905dd4419668334479e6715 /drivers | |
parent | bdfd1140731a67c74fd74814f222c8078171adcd (diff) |
md/bitmap: make bitmap bitops atomic.
This allows us to remove spinlock protection which is
more heavy-weight than simple atomics.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/bitmap.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 2e2f53cd5b21..7c3c1c58ff1b 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -844,7 +844,7 @@ static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block) | |||
844 | if (test_bit(BITMAP_HOSTENDIAN, &bitmap->flags)) | 844 | if (test_bit(BITMAP_HOSTENDIAN, &bitmap->flags)) |
845 | set_bit(bit, kaddr); | 845 | set_bit(bit, kaddr); |
846 | else | 846 | else |
847 | __set_bit_le(bit, kaddr); | 847 | test_and_set_bit_le(bit, kaddr); |
848 | kunmap_atomic(kaddr); | 848 | kunmap_atomic(kaddr); |
849 | pr_debug("set file bit %lu page %lu\n", bit, page->index); | 849 | pr_debug("set file bit %lu page %lu\n", bit, page->index); |
850 | /* record page number so it gets flushed to disk when unplug occurs */ | 850 | /* record page number so it gets flushed to disk when unplug occurs */ |
@@ -866,7 +866,7 @@ static void bitmap_file_clear_bit(struct bitmap *bitmap, sector_t block) | |||
866 | if (test_bit(BITMAP_HOSTENDIAN, &bitmap->flags)) | 866 | if (test_bit(BITMAP_HOSTENDIAN, &bitmap->flags)) |
867 | clear_bit(bit, paddr); | 867 | clear_bit(bit, paddr); |
868 | else | 868 | else |
869 | __clear_bit_le(bit, paddr); | 869 | test_and_clear_bit_le(bit, paddr); |
870 | kunmap_atomic(paddr); | 870 | kunmap_atomic(paddr); |
871 | if (!test_page_attr(bitmap, page->index, BITMAP_PAGE_NEEDWRITE)) { | 871 | if (!test_page_attr(bitmap, page->index, BITMAP_PAGE_NEEDWRITE)) { |
872 | set_page_attr(bitmap, page->index, BITMAP_PAGE_PENDING); | 872 | set_page_attr(bitmap, page->index, BITMAP_PAGE_PENDING); |
@@ -1536,9 +1536,7 @@ void bitmap_dirty_bits(struct bitmap *bitmap, unsigned long s, unsigned long e) | |||
1536 | for (chunk = s; chunk <= e; chunk++) { | 1536 | for (chunk = s; chunk <= e; chunk++) { |
1537 | sector_t sec = (sector_t)chunk << bitmap->chunkshift; | 1537 | sector_t sec = (sector_t)chunk << bitmap->chunkshift; |
1538 | bitmap_set_memory_bits(bitmap, sec, 1); | 1538 | bitmap_set_memory_bits(bitmap, sec, 1); |
1539 | spin_lock_irq(&bitmap->lock); | ||
1540 | bitmap_file_set_bit(bitmap, sec); | 1539 | bitmap_file_set_bit(bitmap, sec); |
1541 | spin_unlock_irq(&bitmap->lock); | ||
1542 | if (sec < bitmap->mddev->recovery_cp) | 1540 | if (sec < bitmap->mddev->recovery_cp) |
1543 | /* We are asserting that the array is dirty, | 1541 | /* We are asserting that the array is dirty, |
1544 | * so move the recovery_cp address back so | 1542 | * so move the recovery_cp address back so |