Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp5951818ybg; Tue, 22 Oct 2019 10:43:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjZ7qh2XSNPzlU2W/ac+VbnRJI4DzxYrWKLDfxDQfrUnS8pKe7ro06V4AYiU/+QAuX28WO X-Received: by 2002:a05:6402:2022:: with SMTP id ay2mr32539308edb.219.1571766234181; Tue, 22 Oct 2019 10:43:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571766234; cv=none; d=google.com; s=arc-20160816; b=MfOtn/cmiWgGyC767oTd9vL3Wo0RT5+6aymMDi0g8WgpYqqg4XShg4H9pp8dMkgQzX 2OKwJGRJAb/u7cKDksumGvfJg6RcECWxV+Wo6DvIEhgttdr8q4a/5otodchYD/k1Po7h ZlhgCRLCV3Oevv2QjTRfUUcmDERWlZjCXVV1WGa4/uqQ/7efbQkGXNGVMcEAdQlC/R8f 76NsesAKBgkpJ5nDeKeDPCWzPnS2zFai8CXnFRncezpjky+x7XQgMdBJI1cet2gA3MCl 3g0uhBn0u+1807R+VPVNVZEcWkbmlr7c60eg0uvudSLjiOS5zvN3CKDR29WQrLn9QS7Z 820A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=DAo/SXa7vCP5OjAax/aPxxdafAJ+t6SUAFNQoPR1Y7s=; b=pC9f90+J5qA0flVtAxw21zMF6TP7ID9CDwrEyI58GPMMvOgllFckwO2kPDbs/hfPpt Hq29BSjb6DxVH0k4jFZ8nUhHLJvQ3YPS+pwzTRAtGkR/cRqcGNAiyryt7kOSkRkZbQQe yzNJg2Ly9dZUVXoBTUwOlL4Pj0n2fF7nnCr/bmzxe3ubtAWikU7etIRWzFRBQOY5fsYa ybP6CHd7X6hNo6BdktkRM0h9oa/qsfkgjvYZpV79kGAntWdGQvU59IGTwsYDOq7YVCP+ Wvy7iqxc3ok9JvrxDiBdHyFSaOD8FMa/59heKOngIGAVgHC9cTKYfkQbYLi9NckAwSVL 8vLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2si11784427edw.29.2019.10.22.10.43.30; Tue, 22 Oct 2019 10:43:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731549AbfJVRmg (ORCPT + 99 others); Tue, 22 Oct 2019 13:42:36 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:52386 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727226AbfJVRmf (ORCPT ); Tue, 22 Oct 2019 13:42:35 -0400 Received: from turingmachine.home (unknown [IPv6:2804:431:c7f5:c26b:d711:794d:1c68:5ed3]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tonyk) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 3523128DB6C; Tue, 22 Oct 2019 18:42:31 +0100 (BST) From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: axboe@kernel.dk, kernel@collabora.com, krisman@collabora.com, =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [PATCH] blk-mq: remove needless goto from blk_mq_get_driver_tag Date: Tue, 22 Oct 2019 14:41:08 -0300 Message-Id: <20191022174108.15554-1-andrealmeid@collabora.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The only usage of the label "done" is when (rq->tag != -1) at the begging of the function. Rather than jumping to label, we can just remove this label and execute the code at the "if". Besides that, the code that would be executed after the label "done" is the return of the logical expression (rq->tag != -1) but since we are already inside the if, we now that this is true. Remove the label and replace the goto with the proper result of the label. Signed-off-by: André Almeida --- Hello, I've used `blktest` to check if this change add any regression. I have used `./check block` and I got the same results with and without this patch (a bunch of "passed" and three "not run" because of the virtual scsi capabilities). Please let me know if there would be a better way to test changes at block stack. This commit was rebase at linux-block/for-5.5/block. Thanks, André --- block/blk-mq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 8538dc415499..1e067b78ab97 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1036,7 +1036,7 @@ bool blk_mq_get_driver_tag(struct request *rq) bool shared; if (rq->tag != -1) - goto done; + return true; if (blk_mq_tag_is_reserved(data.hctx->sched_tags, rq->internal_tag)) data.flags |= BLK_MQ_REQ_RESERVED; @@ -1051,7 +1051,6 @@ bool blk_mq_get_driver_tag(struct request *rq) data.hctx->tags->rqs[rq->tag] = rq; } -done: return rq->tag != -1; } -- 2.23.0