aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-03-18 21:46:40 -0400
committerNeilBrown <neilb@suse.de>2012-03-18 21:46:40 -0400
commit5a6c824ebb7c9f8dbbc92ffd3528e6366cad1a54 (patch)
treee78d8527ae9e7be05001ed12f1cad01f8719bde0 /drivers/md
parent278c1ca2f254d0695d2eba79793d20ce785323ea (diff)
md/bitmap: remove some pointless locking.
There is nothing gained by holding a lock while we check if a pointer is NULL or not. If there could be a race, then it could become NULL immediately after the unlock - but there is no race here. So just remove the locking. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/bitmap.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index fcf3c9465fd8..e12b515bd471 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -446,18 +446,13 @@ out:
446void bitmap_update_sb(struct bitmap *bitmap) 446void bitmap_update_sb(struct bitmap *bitmap)
447{ 447{
448 bitmap_super_t *sb; 448 bitmap_super_t *sb;
449 unsigned long flags;
450 449
451 if (!bitmap || !bitmap->mddev) /* no bitmap for this array */ 450 if (!bitmap || !bitmap->mddev) /* no bitmap for this array */
452 return; 451 return;
453 if (bitmap->mddev->bitmap_info.external) 452 if (bitmap->mddev->bitmap_info.external)
454 return; 453 return;
455 spin_lock_irqsave(&bitmap->lock, flags); 454 if (!bitmap->sb_page) /* no superblock */
456 if (!bitmap->sb_page) { /* no superblock */
457 spin_unlock_irqrestore(&bitmap->lock, flags);
458 return; 455 return;
459 }
460 spin_unlock_irqrestore(&bitmap->lock, flags);
461 sb = kmap_atomic(bitmap->sb_page, KM_USER0); 456 sb = kmap_atomic(bitmap->sb_page, KM_USER0);
462 sb->events = cpu_to_le64(bitmap->mddev->events); 457 sb->events = cpu_to_le64(bitmap->mddev->events);
463 if (bitmap->mddev->events < bitmap->events_cleared) 458 if (bitmap->mddev->events < bitmap->events_cleared)
@@ -683,15 +678,10 @@ static int bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits,
683 enum bitmap_mask_op op) 678 enum bitmap_mask_op op)
684{ 679{
685 bitmap_super_t *sb; 680 bitmap_super_t *sb;
686 unsigned long flags;
687 int old; 681 int old;
688 682
689 spin_lock_irqsave(&bitmap->lock, flags); 683 if (!bitmap->sb_page) /* can't set the state */
690 if (!bitmap->sb_page) { /* can't set the state */
691 spin_unlock_irqrestore(&bitmap->lock, flags);
692 return 0; 684 return 0;
693 }
694 spin_unlock_irqrestore(&bitmap->lock, flags);
695 sb = kmap_atomic(bitmap->sb_page, KM_USER0); 685 sb = kmap_atomic(bitmap->sb_page, KM_USER0);
696 old = le32_to_cpu(sb->state) & bits; 686 old = le32_to_cpu(sb->state) & bits;
697 switch (op) { 687 switch (op) {