Hi Bart

On 08/10/2018 03:41 AM, Bart Van Assche wrote:
> +/*
> + * Whether or not blk_queue_enter() should proceed. RQF_PM requests are 
> always
> + * allowed. RQF_DV requests are allowed if the PM_ONLY queue flag has not 
> been
> + * set. Other requests are only allowed if neither PM_ONLY nor DV_ONLY has 
> been
> + * set.
> + */
> +static inline bool blk_enter_allowed(struct request_queue *q,
> +                                  blk_mq_req_flags_t flags)
> +{
> +     return flags & BLK_MQ_REQ_PM ||
> +             (!blk_queue_pm_only(q) &&
> +              (flags & BLK_MQ_REQ_DV || !blk_queue_dv_only(q)));
> +}

If a new state is indeed necessary, I think this kind of checking in hot path 
is inefficient.
How about introduce a new state into request_queue, such as 
request_queue->gate_state.
Set the PM_ONLY and DV_ONLY into this state, then we could just check 
request_queue->gate_state > 0
before do further checking.

Thanks
Jianchao

Reply via email to