Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2594403ybg; Thu, 24 Oct 2019 12:05:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWzXk1/YHgKw4gP1PrWDUgkV7pfBeTtml5JjUd+JpJuXPsrEwBed4z25GjmAGc4vY9bFNy X-Received: by 2002:a05:6402:1b1a:: with SMTP id by26mr8567852edb.178.1571943928452; Thu, 24 Oct 2019 12:05:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571943928; cv=none; d=google.com; s=arc-20160816; b=vqg+SnIaO8/IVRaq6pgyMw26iaOgWn6dKIkvlpqJq0U6oRod+p3OCESNEebtIqTwPF vcsHob72TT5IJQj6Ctji1hPV/Doea8fENRylYaImNJKTh0ouEa2TjYNYsD2oxeDCivEG db16RmxzUoDiONqX2SSpIeKYVsIKKIkVD7fKMOh3GrmJ88gxE0mP2bwY1fPSnDy4SMT6 BADOAcjIm8/q4YMlmRlhEPmv3wDzIkhnNwpg5uFOLtQf8eqrqEL55oKceiiqx8/rTK29 X0gVEPdV/jQbxgEVecFgZ90xaFjluL2qT+c+QE2u2lCtTZGoZQzaGwAZ3nuF5w7SODhp 7AmQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=x9yyQ2FOaYcmSfcpOJxtcwGG2Qu1XU68PHFcRqzXa3M=; b=nA48PrGjZrioI+CGoVfvpMMrUtvWCB6QI6DOBNp5c6ztjGQFshLRCrjbqKyA2dmlMa erlwZHux2HXt6FWDhnXefBhTZMFNIlJiYPCvXSR1Bcz5V+q6FN3SNmuLVXFVcNBLqDkW jBC/U8XffMrXBbOnujGW69BTvLp7FnE2gJ/DSDwEmAluzcSfHDg7LtJAQXgYfKOG83gX 96h1XCI5P0aI0EUpQyEm75FXelfixQzRONacsdz/0tBBEEUAVQcR4JWjiTWlHckwNFrC PYKhI10a9ZzAMF/wppyIUqE3kbHDWO3Zb4b8XZgDdcVyPW+oNmpcOdizMFUvDEdDP32S 4DqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=l5kJGcsH; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k23si9867377ejr.298.2019.10.24.12.05.04; Thu, 24 Oct 2019 12:05:28 -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; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=l5kJGcsH; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437126AbfJXDc4 (ORCPT + 99 others); Wed, 23 Oct 2019 23:32:56 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:35542 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392870AbfJXDcz (ORCPT ); Wed, 23 Oct 2019 23:32:55 -0400 Received: by mail-pg1-f195.google.com with SMTP id c8so8544526pgb.2 for ; Wed, 23 Oct 2019 20:32:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=x9yyQ2FOaYcmSfcpOJxtcwGG2Qu1XU68PHFcRqzXa3M=; b=l5kJGcsHDzkhBVaQTnz47UD9J1r2EmTtlolEqaO5EjuBlCtue3iG0RvKqmtBm2YwXR +8xepoTs24e/xk4M/s+f7E7+EwKKKZp/FE5YERFeXwtjz1auyqSYxDJUMg8UbLlaPFdB 3VffsRs0Ugwj+erGFiWCyDNCi9CJRFmgsh7fQHFjQ9wNJPwdh/k2PXzAOk0VFHWDHWu+ IajaTpK1/Gk7IONkVrWywQ/wiPOs4C5HohianltFhvm24sSeWfmeoRgxEk9olnOESANF O6TMAkmFj5lXneRX4r7OL4lDekc3wS/p1piBZzlQcYYcdTguBhAAsN5e4jrx1Bc5YZT1 OK6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=x9yyQ2FOaYcmSfcpOJxtcwGG2Qu1XU68PHFcRqzXa3M=; b=OdPP2J5ALBsneCRzmIsFkj5j0Nw4OLyIuwFY4ESjcLrgzNWtXX/DM8yfbMLzt3jYCm Lg17GsrmcZsKorYbqq6tvSJ6NuRROqWlzGVMODbn01biMweYkdJyL5ZaAXW4+JQ4MWUo AmiiOTQSGLvT6glTDTOzhx0bU7KLqA5DdbaHvzjpAVpgWJMI2o6KSiLmKb8SpfJlQlTc eWq72czsGJ9jB3PRMMQiUP9UiXd+gV6hzovSH9QxgLgN1TWsb1v4fd1PuujV7ymc2P// Q5dMQ4eUkqjSBDnINrfB+8zJ5Ft+r9dyssPXGtan+XYcfVlNRvh4CoQ8ZAF65Xhba9WS kAYA== X-Gm-Message-State: APjAAAUXrNP6a+XHNw9e+n1sYEy70jzrPEyfFMk5j9HnBwQt5y/9vRW1 2ppM6BZrVTYggqqUthQeaxFkKw== X-Received: by 2002:a63:c40e:: with SMTP id h14mr13966574pgd.254.1571887975017; Wed, 23 Oct 2019 20:32:55 -0700 (PDT) Received: from [192.168.1.188] ([66.219.217.79]) by smtp.gmail.com with ESMTPSA id n2sm25393079pgg.77.2019.10.23.20.32.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Oct 2019 20:32:54 -0700 (PDT) Subject: Re: [PATCH] blk-mq: remove needless goto from blk_mq_get_driver_tag To: Bart Van Assche , =?UTF-8?Q?Andr=c3=a9_Almeida?= , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel@collabora.com, krisman@collabora.com References: <20191022174108.15554-1-andrealmeid@collabora.com> <2a8a99a6-4b39-e459-988a-ba9502919044@acm.org> From: Jens Axboe Message-ID: Date: Wed, 23 Oct 2019 21:32:52 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <2a8a99a6-4b39-e459-988a-ba9502919044@acm.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/23/19 7:34 PM, Bart Van Assche wrote: > On 2019-10-22 10:41, André Almeida wrote: >> 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; >> } > > Do we really need code changes like the above? I'm not aware of any text > in the Documentation/ directory that forbids the use of goto statements. Agree, it looks fine as-is. It's also a fast path, so I'd never get rid of that without looking at the generated code. -- Jens Axboe