Skip to content

Commit f78bac2

Browse files
KAGA-KOKOaxboe
authored andcommitted
block: Use the queue_flag_*() functions instead of open-coding these
Except for changing the atomic queue flag manipulations that are protected by the queue lock into non-atomic manipulations, 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>
1 parent 66f9132 commit f78bac2

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎block/blk-core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id,
994994
* registered by blk_register_queue().
995995
*/
996996
q->bypass_depth = 1;
997-
__set_bit(QUEUE_FLAG_BYPASS, &q->queue_flags);
997+
queue_flag_set_unlocked(QUEUE_FLAG_BYPASS, q);
998998

999999
init_waitqueue_head(&q->mq_freeze_wq);
10001000

‎block/blk-mq.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2678,7 +2678,7 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
26782678
q->queue_flags |= QUEUE_FLAG_MQ_DEFAULT;
26792679

26802680
if (!(set->flags & BLK_MQ_F_SG_MERGE))
2681-
q->queue_flags |= 1 << QUEUE_FLAG_NO_SG_MERGE;
2681+
queue_flag_set_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);
26822682

26832683
q->sg_reserved_size = INT_MAX;
26842684

‎block/blk-settings.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,9 @@ void blk_queue_flush_queueable(struct request_queue *q, bool queueable)
861861
{
862862
spin_lock_irq(q->queue_lock);
863863
if (queueable)
864-
clear_bit(QUEUE_FLAG_FLUSH_NQ, &q->queue_flags);
864+
queue_flag_clear(QUEUE_FLAG_FLUSH_NQ, q);
865865
else
866-
set_bit(QUEUE_FLAG_FLUSH_NQ, &q->queue_flags);
866+
queue_flag_set(QUEUE_FLAG_FLUSH_NQ, q);
867867
spin_unlock_irq(q->queue_lock);
868868
}
869869
EXPORT_SYMBOL_GPL(blk_queue_flush_queueable);

‎block/blk-stat.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void blk_stat_add_callback(struct request_queue *q,
152152

153153
spin_lock(&q->stats->lock);
154154
list_add_tail_rcu(&cb->list, &q->stats->callbacks);
155-
set_bit(QUEUE_FLAG_STATS, &q->queue_flags);
155+
queue_flag_set(QUEUE_FLAG_STATS, q);
156156
spin_unlock(&q->stats->lock);
157157
}
158158
EXPORT_SYMBOL_GPL(blk_stat_add_callback);
@@ -163,7 +163,7 @@ void blk_stat_remove_callback(struct request_queue *q,
163163
spin_lock(&q->stats->lock);
164164
list_del_rcu(&cb->list);
165165
if (list_empty(&q->stats->callbacks) && !q->stats->enable_accounting)
166-
clear_bit(QUEUE_FLAG_STATS, &q->queue_flags);
166+
queue_flag_clear(QUEUE_FLAG_STATS, q);
167167
spin_unlock(&q->stats->lock);
168168

169169
del_timer_sync(&cb->timer);
@@ -191,7 +191,7 @@ void blk_stat_enable_accounting(struct request_queue *q)
191191
{
192192
spin_lock(&q->stats->lock);
193193
q->stats->enable_accounting = true;
194-
set_bit(QUEUE_FLAG_STATS, &q->queue_flags);
194+
queue_flag_set(QUEUE_FLAG_STATS, q);
195195
spin_unlock(&q->stats->lock);
196196
}
197197

0 commit comments

Comments
 (0)