diff options
| -rw-r--r-- | include/linux/blkdev.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index c09696a90d6a..95864b3ff298 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -410,6 +410,12 @@ struct request_queue | |||
| 410 | #define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */ | 410 | #define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */ |
| 411 | #define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */ | 411 | #define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */ |
| 412 | 412 | ||
| 413 | static inline int queue_is_locked(struct request_queue *q) | ||
| 414 | { | ||
| 415 | spinlock_t *lock = q->queue_lock; | ||
| 416 | return lock && spin_is_locked(lock); | ||
| 417 | } | ||
| 418 | |||
| 413 | static inline void queue_flag_set_unlocked(unsigned int flag, | 419 | static inline void queue_flag_set_unlocked(unsigned int flag, |
| 414 | struct request_queue *q) | 420 | struct request_queue *q) |
| 415 | { | 421 | { |
| @@ -418,7 +424,7 @@ static inline void queue_flag_set_unlocked(unsigned int flag, | |||
| 418 | 424 | ||
| 419 | static inline void queue_flag_set(unsigned int flag, struct request_queue *q) | 425 | static inline void queue_flag_set(unsigned int flag, struct request_queue *q) |
| 420 | { | 426 | { |
| 421 | WARN_ON_ONCE(!spin_is_locked(q->queue_lock)); | 427 | WARN_ON_ONCE(!queue_is_locked(q)); |
| 422 | __set_bit(flag, &q->queue_flags); | 428 | __set_bit(flag, &q->queue_flags); |
| 423 | } | 429 | } |
| 424 | 430 | ||
| @@ -430,7 +436,7 @@ static inline void queue_flag_clear_unlocked(unsigned int flag, | |||
| 430 | 436 | ||
| 431 | static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) | 437 | static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) |
| 432 | { | 438 | { |
| 433 | WARN_ON_ONCE(!spin_is_locked(q->queue_lock)); | 439 | WARN_ON_ONCE(!queue_is_locked(q)); |
| 434 | __clear_bit(flag, &q->queue_flags); | 440 | __clear_bit(flag, &q->queue_flags); |
| 435 | } | 441 | } |
| 436 | 442 | ||
