Improve queue_is_locked()
authorJens Axboe <jens.axboe@oracle.com>
Tue, 29 Apr 2008 19:31:27 +0000 (21:31 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Apr 2008 19:36:54 +0000 (12:36 -0700)
spin_is_locked() doesn't work on UP without spinlock debugging. Make it
safer and just return 1 on UP, so we don't get false positives. The plan
is to kill this debug function during the -rc cycle.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/blkdev.h

index 95864b3ff298997aae7e78510417fa4f3d2bf148..d2a1b71e93c3eee9570e86513bdb2786d260699c 100644 (file)
@@ -412,8 +412,12 @@ struct request_queue
 
 static inline int queue_is_locked(struct request_queue *q)
 {
+#ifdef CONFIG_SMP
        spinlock_t *lock = q->queue_lock;
        return lock && spin_is_locked(lock);
+#else
+       return 1;
+#endif
 }
 
 static inline void queue_flag_set_unlocked(unsigned int flag,