Skip to content

Commit 5a6c824

Browse files
committed
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 <[email protected]>
1 parent 278c1ca commit 5a6c824

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

drivers/md/bitmap.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -446,18 +446,13 @@ static struct page *read_page(struct file *file, unsigned long index,
446446
void bitmap_update_sb(struct bitmap *bitmap)
447447
{
448448
bitmap_super_t *sb;
449-
unsigned long flags;
450449

451450
if (!bitmap || !bitmap->mddev) /* no bitmap for this array */
452451
return;
453452
if (bitmap->mddev->bitmap_info.external)
454453
return;
455-
spin_lock_irqsave(&bitmap->lock, flags);
456-
if (!bitmap->sb_page) { /* no superblock */
457-
spin_unlock_irqrestore(&bitmap->lock, flags);
454+
if (!bitmap->sb_page) /* no superblock */
458455
return;
459-
}
460-
spin_unlock_irqrestore(&bitmap->lock, flags);
461456
sb = kmap_atomic(bitmap->sb_page, KM_USER0);
462457
sb->events = cpu_to_le64(bitmap->mddev->events);
463458
if (bitmap->mddev->events < bitmap->events_cleared)
@@ -683,15 +678,10 @@ static int bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits,
683678
enum bitmap_mask_op op)
684679
{
685680
bitmap_super_t *sb;
686-
unsigned long flags;
687681
int old;
688682

689-
spin_lock_irqsave(&bitmap->lock, flags);
690-
if (!bitmap->sb_page) { /* can't set the state */
691-
spin_unlock_irqrestore(&bitmap->lock, flags);
683+
if (!bitmap->sb_page) /* can't set the state */
692684
return 0;
693-
}
694-
spin_unlock_irqrestore(&bitmap->lock, flags);
695685
sb = kmap_atomic(bitmap->sb_page, KM_USER0);
696686
old = le32_to_cpu(sb->state) & bits;
697687
switch (op) {

0 commit comments

Comments
 (0)