summaryrefslogtreecommitdiffstats
path: root/block/blk-sysfs.c
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@wdc.com>2018-03-07 20:10:04 -0500
committerJens Axboe <axboe@kernel.dk>2018-03-08 16:13:48 -0500
commit8814ce8a0f680599a837af18aefdec774e5c7b97 (patch)
tree1f825afafde21e04bd53a20c23e0fb83eeb84347 /block/blk-sysfs.c
parentf78bac2c8e69144781e271d9771bae8dbb4e7098 (diff)
block: Introduce blk_queue_flag_{set,clear,test_and_{set,clear}}()
Introduce functions that modify the queue flags and that protect these modifications with the request queue lock. Except for moving one wake_up_all() call from inside to outside a critical section, this patch does not change any functionality. Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.de> Cc: Ming Lei <ming.lei@redhat.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-sysfs.c')
-rw-r--r--block/blk-sysfs.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index fd71a00c9462..d00d1b0ec109 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -276,12 +276,10 @@ queue_store_##name(struct request_queue *q, const char *page, size_t count) \
276 if (neg) \ 276 if (neg) \
277 val = !val; \ 277 val = !val; \
278 \ 278 \
279 spin_lock_irq(q->queue_lock); \
280 if (val) \ 279 if (val) \
281 queue_flag_set(QUEUE_FLAG_##flag, q); \ 280 blk_queue_flag_set(QUEUE_FLAG_##flag, q); \
282 else \ 281 else \
283 queue_flag_clear(QUEUE_FLAG_##flag, q); \ 282 blk_queue_flag_clear(QUEUE_FLAG_##flag, q); \
284 spin_unlock_irq(q->queue_lock); \
285 return ret; \ 283 return ret; \
286} 284}
287 285
@@ -414,12 +412,10 @@ static ssize_t queue_poll_store(struct request_queue *q, const char *page,
414 if (ret < 0) 412 if (ret < 0)
415 return ret; 413 return ret;
416 414
417 spin_lock_irq(q->queue_lock);
418 if (poll_on) 415 if (poll_on)
419 queue_flag_set(QUEUE_FLAG_POLL, q); 416 blk_queue_flag_set(QUEUE_FLAG_POLL, q);
420 else 417 else
421 queue_flag_clear(QUEUE_FLAG_POLL, q); 418 blk_queue_flag_clear(QUEUE_FLAG_POLL, q);
422 spin_unlock_irq(q->queue_lock);
423 419
424 return ret; 420 return ret;
425} 421}
@@ -487,12 +483,10 @@ static ssize_t queue_wc_store(struct request_queue *q, const char *page,
487 if (set == -1) 483 if (set == -1)
488 return -EINVAL; 484 return -EINVAL;
489 485
490 spin_lock_irq(q->queue_lock);
491 if (set) 486 if (set)
492 queue_flag_set(QUEUE_FLAG_WC, q); 487 blk_queue_flag_set(QUEUE_FLAG_WC, q);
493 else 488 else
494 queue_flag_clear(QUEUE_FLAG_WC, q); 489 blk_queue_flag_clear(QUEUE_FLAG_WC, q);
495 spin_unlock_irq(q->queue_lock);
496 490
497 return count; 491 return count;
498} 492}
@@ -946,9 +940,7 @@ void blk_unregister_queue(struct gendisk *disk)
946 */ 940 */
947 mutex_lock(&q->sysfs_lock); 941 mutex_lock(&q->sysfs_lock);
948 942
949 spin_lock_irq(q->queue_lock); 943 blk_queue_flag_clear(QUEUE_FLAG_REGISTERED, q);
950 queue_flag_clear(QUEUE_FLAG_REGISTERED, q);
951 spin_unlock_irq(q->queue_lock);
952 944
953 /* 945 /*
954 * Remove the sysfs attributes before unregistering the queue data 946 * Remove the sysfs attributes before unregistering the queue data