diff options
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r-- | include/linux/blkdev.h | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 606cf339bb56..4d4ac24a263e 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -1,9 +1,10 @@ | |||
1 | #ifndef _LINUX_BLKDEV_H | 1 | #ifndef _LINUX_BLKDEV_H |
2 | #define _LINUX_BLKDEV_H | 2 | #define _LINUX_BLKDEV_H |
3 | 3 | ||
4 | #include <linux/sched.h> | ||
5 | |||
4 | #ifdef CONFIG_BLOCK | 6 | #ifdef CONFIG_BLOCK |
5 | 7 | ||
6 | #include <linux/sched.h> | ||
7 | #include <linux/major.h> | 8 | #include <linux/major.h> |
8 | #include <linux/genhd.h> | 9 | #include <linux/genhd.h> |
9 | #include <linux/list.h> | 10 | #include <linux/list.h> |
@@ -426,14 +427,10 @@ struct request_queue { | |||
426 | (1 << QUEUE_FLAG_SAME_COMP) | \ | 427 | (1 << QUEUE_FLAG_SAME_COMP) | \ |
427 | (1 << QUEUE_FLAG_ADD_RANDOM)) | 428 | (1 << QUEUE_FLAG_ADD_RANDOM)) |
428 | 429 | ||
429 | static inline int queue_is_locked(struct request_queue *q) | 430 | static inline void queue_lockdep_assert_held(struct request_queue *q) |
430 | { | 431 | { |
431 | #ifdef CONFIG_SMP | 432 | if (q->queue_lock) |
432 | spinlock_t *lock = q->queue_lock; | 433 | lockdep_assert_held(q->queue_lock); |
433 | return lock && spin_is_locked(lock); | ||
434 | #else | ||
435 | return 1; | ||
436 | #endif | ||
437 | } | 434 | } |
438 | 435 | ||
439 | static inline void queue_flag_set_unlocked(unsigned int flag, | 436 | static inline void queue_flag_set_unlocked(unsigned int flag, |
@@ -445,7 +442,7 @@ static inline void queue_flag_set_unlocked(unsigned int flag, | |||
445 | static inline int queue_flag_test_and_clear(unsigned int flag, | 442 | static inline int queue_flag_test_and_clear(unsigned int flag, |
446 | struct request_queue *q) | 443 | struct request_queue *q) |
447 | { | 444 | { |
448 | WARN_ON_ONCE(!queue_is_locked(q)); | 445 | queue_lockdep_assert_held(q); |
449 | 446 | ||
450 | if (test_bit(flag, &q->queue_flags)) { | 447 | if (test_bit(flag, &q->queue_flags)) { |
451 | __clear_bit(flag, &q->queue_flags); | 448 | __clear_bit(flag, &q->queue_flags); |
@@ -458,7 +455,7 @@ static inline int queue_flag_test_and_clear(unsigned int flag, | |||
458 | static inline int queue_flag_test_and_set(unsigned int flag, | 455 | static inline int queue_flag_test_and_set(unsigned int flag, |
459 | struct request_queue *q) | 456 | struct request_queue *q) |
460 | { | 457 | { |
461 | WARN_ON_ONCE(!queue_is_locked(q)); | 458 | queue_lockdep_assert_held(q); |
462 | 459 | ||
463 | if (!test_bit(flag, &q->queue_flags)) { | 460 | if (!test_bit(flag, &q->queue_flags)) { |
464 | __set_bit(flag, &q->queue_flags); | 461 | __set_bit(flag, &q->queue_flags); |
@@ -470,7 +467,7 @@ static inline int queue_flag_test_and_set(unsigned int flag, | |||
470 | 467 | ||
471 | static inline void queue_flag_set(unsigned int flag, struct request_queue *q) | 468 | static inline void queue_flag_set(unsigned int flag, struct request_queue *q) |
472 | { | 469 | { |
473 | WARN_ON_ONCE(!queue_is_locked(q)); | 470 | queue_lockdep_assert_held(q); |
474 | __set_bit(flag, &q->queue_flags); | 471 | __set_bit(flag, &q->queue_flags); |
475 | } | 472 | } |
476 | 473 | ||
@@ -487,7 +484,7 @@ static inline int queue_in_flight(struct request_queue *q) | |||
487 | 484 | ||
488 | static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) | 485 | static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) |
489 | { | 486 | { |
490 | WARN_ON_ONCE(!queue_is_locked(q)); | 487 | queue_lockdep_assert_held(q); |
491 | __clear_bit(flag, &q->queue_flags); | 488 | __clear_bit(flag, &q->queue_flags); |
492 | } | 489 | } |
493 | 490 | ||