Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2721549rwi; Tue, 1 Nov 2022 10:55:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ebGlzq6wcq6/HXLklmW1Bdq8jNjX6+Fc+20xckoBRvBBGKs3WcGlPx55oehhqaVMXgsz9 X-Received: by 2002:a17:907:7633:b0:7ad:df69:8abc with SMTP id jy19-20020a170907763300b007addf698abcmr9310299ejc.189.1667325342585; Tue, 01 Nov 2022 10:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667325342; cv=none; d=google.com; s=arc-20160816; b=FRCDKDMWOceCUw2dox8HJasw54buiF6ghRLokrzrdHEyAYQlloUPBuJRV47qxB31EN Nquvwz3Upp+REILgR+v8t9zQyZaJ5m2mw7ThB0bRumxkTAo4ZDd4gAltcGwM3J/mm9qr By0EJucWJLcHHC0LQh8fgSLmMb/oKyLwHoP/M4LbhAXp3ZNk+Rw+SkrFV9VT8mGuomah WpPLF+BBQI/BYqM+FYMmY6btZlPdAY/I90T+umLZb4lXqsWEt7rDeyLpzCxbs01F5EyB Ti1ZjaPn7tncMTqbNVwDEXF2BIrzI740XiovrsyHqh9HgmEeCSCGWVUohU2vVrMQf3kM JOjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=B038MpLhpVKmDYVOj1tl8mNAM2hVkMBCprVohFkCC8o=; b=BtPImEovwV2FCBA2TQ7stOxFayLR1NmBuZ9zuBLZ2ztKz+fr3KUO1I/S8EWJPPugIk 8eVV4lMYUoYIhsc5nkt6Dj7uOC7WAdhSXBsl0sUI4H74AarA+KkZ265NtxtJf7DcFIhN +m9kAmB6T+DGkvF87Mr5KSdKOOwGR0a/ztdq3dEuNN08HQdbEEQ0vKFURFwf1iVI9ewz YQAci+sQpoMOpVaHA8cPb5WqZxVGLg+9YLRppozjNM9ZYMIkJXHAAwMTWv26DnDC8q9n e7fDAntZb8K8knBQB05ClxVywosSSmwAWzioH94SCIwD/vhTBEkmmqLUlLt7+3cWMEEP GXNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb36-20020a1709071ca400b00782539a0286si15146584ejc.142.2022.11.01.10.55.18; Tue, 01 Nov 2022 10:55:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231126AbiKARhd (ORCPT + 96 others); Tue, 1 Nov 2022 13:37:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230438AbiKARhc (ORCPT ); Tue, 1 Nov 2022 13:37:32 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8609B0A; Tue, 1 Nov 2022 10:37:31 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 73B6368B05; Tue, 1 Nov 2022 18:37:28 +0100 (CET) Date: Tue, 1 Nov 2022 18:37:27 +0100 From: Christoph Hellwig To: Jinlong Chen Cc: axboe@kernel.dk, hch@lst.de, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] blk-mq: improve readability of blk_mq_alloc_request() Message-ID: <20221101173727.GC20690@lst.de> References: <81fcbc046c9ea96cdfd8e20d1edc8e64c4d08153.1667314759.git.nickyc975@zju.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <81fcbc046c9ea96cdfd8e20d1edc8e64c4d08153.1667314759.git.nickyc975@zju.edu.cn> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 01, 2022 at 11:11:37PM +0800, Jinlong Chen wrote: > Add a helper blk_mq_alloc_request_nocache() to alloc request without > cache. This makes blk_mq_alloc_request() more readable. > > Signed-off-by: Jinlong Chen > --- > block/blk-mq.c | 47 +++++++++++++++++++++++++++++------------------ > 1 file changed, 29 insertions(+), 18 deletions(-) > > diff --git a/block/blk-mq.c b/block/blk-mq.c > index 87a6348a0d0a..2fae111a42c8 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -572,36 +572,47 @@ static struct request *blk_mq_alloc_cached_request(struct request_queue *q, > return rq; > } > > +static struct request *blk_mq_alloc_request_nocache(struct request_queue *q, > + blk_opf_t opf, blk_mq_req_flags_t flags) The name is a bit odd, but I can't think off a better one. > + struct blk_mq_alloc_data data = { > .q = q, > .flags = flags, > .cmd_flags = opf, > .nr_tags = 1, > }; And this now has superflous indenation. Overall, while the separate helper looks marginally nicer, I'm not really sure it is worth the churn.