Commit 2766fd78 authored by Joe Thornber's avatar Joe Thornber Committed by Linus Torvalds

[PATCH] dm: avoid unnecessary locking

dec_pending(): only bother spin locking if io->error is going to be
updated. [Kevin Corry]
parent a387dbb5
...@@ -238,10 +238,11 @@ static inline void dec_pending(struct dm_io *io, int error) ...@@ -238,10 +238,11 @@ static inline void dec_pending(struct dm_io *io, int error)
static spinlock_t _uptodate_lock = SPIN_LOCK_UNLOCKED; static spinlock_t _uptodate_lock = SPIN_LOCK_UNLOCKED;
unsigned long flags; unsigned long flags;
if (error) {
spin_lock_irqsave(&_uptodate_lock, flags); spin_lock_irqsave(&_uptodate_lock, flags);
if (error)
io->error = error; io->error = error;
spin_unlock_irqrestore(&_uptodate_lock, flags); spin_unlock_irqrestore(&_uptodate_lock, flags);
}
if (atomic_dec_and_test(&io->io_count)) { if (atomic_dec_and_test(&io->io_count)) {
if (atomic_dec_and_test(&io->md->pending)) if (atomic_dec_and_test(&io->md->pending))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment