diff options
author | NeilBrown <neilb@suse.de> | 2012-03-19 02:46:40 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-03-19 02:46:40 +0100 |
commit | 5a6c824ebb7c9f8dbbc92ffd3528e6366cad1a54 (patch) | |
tree | e78d8527ae9e7be05001ed12f1cad01f8719bde0 /drivers/md/bitmap.c | |
parent | md/bitmap: change a 'goto' to a normal 'if' construct. (diff) | |
download | linux-5a6c824ebb7c9f8dbbc92ffd3528e6366cad1a54.tar.xz linux-5a6c824ebb7c9f8dbbc92ffd3528e6366cad1a54.zip |
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/bitmap.c')
-rw-r--r-- | drivers/md/bitmap.c | 14 |
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: void bitmap_update_sb(struct bitmap *bitmap) { bitmap_super_t *sb; - unsigned long flags; if (!bitmap || !bitmap->mddev) /* no bitmap for this array */ return; if (bitmap->mddev->bitmap_info.external) return; - spin_lock_irqsave(&bitmap->lock, flags); - if (!bitmap->sb_page) { /* no superblock */ - spin_unlock_irqrestore(&bitmap->lock, flags); + if (!bitmap->sb_page) /* no superblock */ return; - } - spin_unlock_irqrestore(&bitmap->lock, flags); sb = kmap_atomic(bitmap->sb_page, KM_USER0); sb->events = cpu_to_le64(bitmap->mddev->events); if (bitmap->mddev->events < bitmap->events_cleared) @@ -683,15 +678,10 @@ static int bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits, enum bitmap_mask_op op) { bitmap_super_t *sb; - unsigned long flags; int old; - spin_lock_irqsave(&bitmap->lock, flags); - if (!bitmap->sb_page) { /* can't set the state */ - spin_unlock_irqrestore(&bitmap->lock, flags); + if (!bitmap->sb_page) /* can't set the state */ return 0; - } - spin_unlock_irqrestore(&bitmap->lock, flags); sb = kmap_atomic(bitmap->sb_page, KM_USER0); old = le32_to_cpu(sb->state) & bits; switch (op) { |