From patchwork Wed Jun 10 17:29:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 187762 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp688388ilo; Wed, 10 Jun 2020 10:33:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNF4fzB6AZCI9DywmoDngXklogymjSbi3DzkBnBqvUyzmCLtzrZKg+DFaYt4MzJqavkX9w X-Received: by 2002:a17:906:838a:: with SMTP id p10mr4372019ejx.243.1591810418209; Wed, 10 Jun 2020 10:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591810418; cv=none; d=google.com; s=arc-20160816; b=mSt5U+e1eoeVSuXa9j7jxqQb2n87mPPpAvsut/5oN2wZ9x2ZYuQw/ABgfsf8TD5/lk zuAbpyTpttvMCahD+cPlzOhn56sYxE2pNA6PSTfHrUV9Prxt+q5KXwN9Uok9U3EIfRlS MqkcX8LosJVB95VfhJokgP+MkJH9vjTuxxw5i+MHOpRoL1AR0SOCowxC6QDLKYNYYvaL TkDgnphQLI0jFHsqNslcnua7K83/mel1MLWUG+HSqW4SLYp0VDEVC/NC1CpVpJcThrqk ZZhu4UcwJ8q0ALCptTKFkk2CJU0+lg2a3lJPPos/7Mait/6PAfTlESvUhTaCI0VUJga+ DhMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=niKVpU8CSg+X6XFK2vQrFMgEoGmN0jOj2QuVJKsoFGc=; b=a6i7o8i0+8T+F58oDJay2v6pAhVmxk/yhC7lEhDjgy91QdpamH7etseNhvqalyj/Pm Ew7jIDdNe/Dz4vFXpYm2UEBSG1YLQLxKRyWhJE6dcw7d1/1wVQPiPuwIci4wbdZULW2s dDVOGl2yAAYDYMlr2KetGXchKh9IJaQXFtjylhu4onFn0B7Zd75Xv37CEKzYYGrm5gWq fAuEHB2qgdgUEpy1VovPq/fHp3weE/klu7d3+6+fLX7ZHAzYC0aBmJdrik5AX2LomwUq farfA4r0m3yQtDGrMUMu0P+qZgJRNm9pF1YFkeUOg03ZSSypxn7Qc8h9VdSsrHSn1r10 GzxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oz26si430501ejb.252.2020.06.10.10.33.38 for ; Wed, 10 Jun 2020 10:33:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727004AbgFJRdh (ORCPT ); Wed, 10 Jun 2020 13:33:37 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5813 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726524AbgFJRdf (ORCPT ); Wed, 10 Jun 2020 13:33:35 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 3A5C1CE5B94ED033FB87; Thu, 11 Jun 2020 01:33:27 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Thu, 11 Jun 2020 01:33:18 +0800 From: John Garry To: , , , , , , , , , , CC: , , , , , Hannes Reinecke , John Garry Subject: [PATCH RFC v7 02/12] blk-mq: rename blk_mq_update_tag_set_depth() Date: Thu, 11 Jun 2020 01:29:09 +0800 Message-ID: <1591810159-240929-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1591810159-240929-1-git-send-email-john.garry@huawei.com> References: <1591810159-240929-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Hannes Reinecke The function does not set the depth, but rather transitions from shared to non-shared queues and vice versa. So rename it to blk_mq_update_tag_set_shared() to better reflect its purpose. Signed-off-by: Hannes Reinecke Signed-off-by: John Garry --- block/blk-mq-tag.c | 18 ++++++++++-------- block/blk-mq.c | 8 ++++---- 2 files changed, 14 insertions(+), 12 deletions(-) -- 2.26.2 Signed-off-by: Hannes Reinecke Signed-off-by: John Garry Signed-off-by: Hannes Reinecke diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index 85aa1690cbcf..bedddf168253 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -454,24 +454,22 @@ static int bt_alloc(struct sbitmap_queue *bt, unsigned int depth, node); } -static struct blk_mq_tags *blk_mq_init_bitmap_tags(struct blk_mq_tags *tags, - int node, int alloc_policy) +static int blk_mq_init_bitmap_tags(struct blk_mq_tags *tags, + int node, int alloc_policy) { unsigned int depth = tags->nr_tags - tags->nr_reserved_tags; bool round_robin = alloc_policy == BLK_TAG_ALLOC_RR; if (bt_alloc(&tags->bitmap_tags, depth, round_robin, node)) - goto free_tags; + return -ENOMEM; if (bt_alloc(&tags->breserved_tags, tags->nr_reserved_tags, round_robin, node)) goto free_bitmap_tags; - return tags; + return 0; free_bitmap_tags: sbitmap_queue_free(&tags->bitmap_tags); -free_tags: - kfree(tags); - return NULL; + return -ENOMEM; } struct blk_mq_tags *blk_mq_init_tags(unsigned int total_tags, @@ -492,7 +490,11 @@ struct blk_mq_tags *blk_mq_init_tags(unsigned int total_tags, tags->nr_tags = total_tags; tags->nr_reserved_tags = reserved_tags; - return blk_mq_init_bitmap_tags(tags, node, alloc_policy); + if (blk_mq_init_bitmap_tags(tags, node, alloc_policy) < 0) { + kfree(tags); + tags = NULL; + } + return tags; } void blk_mq_free_tags(struct blk_mq_tags *tags) diff --git a/block/blk-mq.c b/block/blk-mq.c index d255c485ca5f..c20d75c851f2 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2802,8 +2802,8 @@ static void queue_set_hctx_shared(struct request_queue *q, bool shared) } } -static void blk_mq_update_tag_set_depth(struct blk_mq_tag_set *set, - bool shared) +static void blk_mq_update_tag_set_shared(struct blk_mq_tag_set *set, + bool shared) { struct request_queue *q; @@ -2826,7 +2826,7 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q) /* just transitioned to unshared */ set->flags &= ~BLK_MQ_F_TAG_QUEUE_SHARED; /* update existing queue */ - blk_mq_update_tag_set_depth(set, false); + blk_mq_update_tag_set_shared(set, false); } mutex_unlock(&set->tag_list_lock); INIT_LIST_HEAD(&q->tag_set_list); @@ -2844,7 +2844,7 @@ static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set, !(set->flags & BLK_MQ_F_TAG_QUEUE_SHARED)) { set->flags |= BLK_MQ_F_TAG_QUEUE_SHARED; /* update existing queue */ - blk_mq_update_tag_set_depth(set, true); + blk_mq_update_tag_set_shared(set, true); } if (set->flags & BLK_MQ_F_TAG_QUEUE_SHARED) queue_set_hctx_shared(q, true);