On 09/03/2014 02:33 PM, Alexander Gordeev wrote:
> Signed-off-by: Alexander Gordeev <agord...@redhat.com>
> Cc: Jens Axboe <ax...@kernel.dk>
> ---
>  block/blk-mq-tag.c |  4 +---
>  block/blk-mq-tag.h | 17 ++++++++---------
>  2 files changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
> index c1b9242..4953b64 100644
> --- a/block/blk-mq-tag.c
> +++ b/block/blk-mq-tag.c
> @@ -58,13 +58,11 @@ static inline void bt_index_atomic_inc(atomic_t *index)
>  /*
>   * If a previously inactive queue goes active, bump the active user count.
>   */
> -bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
> +void __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
>  {
>       if (!test_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state) &&
>           !test_and_set_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state))
>               atomic_inc(&hctx->tags->active_queues);
> -
> -     return true;
>  }

This is obviously a good idea.

> diff --git a/block/blk-mq-tag.h b/block/blk-mq-tag.h
> index 6206ed1..795ec3f 100644
> --- a/block/blk-mq-tag.h
> +++ b/block/blk-mq-tag.h
> @@ -66,23 +66,22 @@ enum {
>       BLK_MQ_TAG_MAX          = BLK_MQ_TAG_FAIL - 1,
>  };
>  
> -extern bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *);
> +extern void __blk_mq_tag_busy(struct blk_mq_hw_ctx *);
>  extern void __blk_mq_tag_idle(struct blk_mq_hw_ctx *);
>  
>  static inline bool blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
>  {
> -     if (!(hctx->flags & BLK_MQ_F_TAG_SHARED))
> -             return false;
> -
> -     return __blk_mq_tag_busy(hctx);
> +     if (hctx->flags & BLK_MQ_F_TAG_SHARED) {
> +             __blk_mq_tag_busy(hctx);
> +             return true;
> +     }
> +     return false;
>  }

The normal/fast path here is the flag NOT being set, which is why it was
coded that way to put the fast path inline.

>  
>  static inline void blk_mq_tag_idle(struct blk_mq_hw_ctx *hctx)
>  {
> -     if (!(hctx->flags & BLK_MQ_F_TAG_SHARED))
> -             return;
> -
> -     __blk_mq_tag_idle(hctx);
> +     if (hctx->flags & BLK_MQ_F_TAG_SHARED)
> +             __blk_mq_tag_idle(hctx);
>  }

Ditto


-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to