]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drivers/md/raid5: Use irqsave variant of atomic_dec_and_lock()
authorAnna-Maria Gleixner <anna-maria@linutronix.de>
Tue, 3 Jul 2018 20:01:36 +0000 (22:01 +0200)
committerShaohua Li <shli@fb.com>
Thu, 19 Jul 2018 02:45:02 +0000 (19:45 -0700)
The irqsave variant of atomic_dec_and_lock handles irqsave/restore when
taking/releasing the spin lock. With this variant the call of
local_irq_save is no longer required.

Cc: Shaohua Li <shli@kernel.org>
Cc: linux-raid@vger.kernel.org
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/raid5.c

index 2031506a0ecd766112330ca5c8e08a7b01f84dfe..e933bff9459e5ab05cad31dd2187be23717dec28 100644 (file)
@@ -409,16 +409,15 @@ void raid5_release_stripe(struct stripe_head *sh)
                md_wakeup_thread(conf->mddev->thread);
        return;
 slow_path:
-       local_irq_save(flags);
        /* we are ok here if STRIPE_ON_RELEASE_LIST is set or not */
-       if (atomic_dec_and_lock(&sh->count, &conf->device_lock)) {
+       if (atomic_dec_and_lock_irqsave(&sh->count, &conf->device_lock, flags)) {
                INIT_LIST_HEAD(&list);
                hash = sh->hash_lock_index;
                do_release_stripe(conf, sh, &list);
                spin_unlock(&conf->device_lock);
                release_inactive_stripe_list(conf, &list, hash);
+               local_irq_restore(flags);
        }
-       local_irq_restore(flags);
 }
 
 static inline void remove_hash(struct stripe_head *sh)