Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1033643pxb; Wed, 6 Apr 2022 07:10:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1/WNWegHUABIEa157+pe6VK6VShiTXGD57NU8CtuBTCtQZLNxuBEBR2P7lmQVqlsnkXTC X-Received: by 2002:a05:6808:1643:b0:2ef:b06:c2f7 with SMTP id az3-20020a056808164300b002ef0b06c2f7mr3754455oib.104.1649254237542; Wed, 06 Apr 2022 07:10:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649254237; cv=none; d=google.com; s=arc-20160816; b=iE6HsE5tsq2uRQY2HTqYVZtW2NsGpLD+9dlMiYMl+/ky5SF737FGfPeI9TS42+NiCr rc5lltvFMWn3oCinjXlPNlsJxaUW4bcEwZwKt+kt2UTUmoIFZba5JAXwVyQO0ayHPbq/ rj+WjfwTQVhT4bgA0AbGK6vWMl4f/g66CfTZHdNsWV/M6Ny/EQPXpUAD5QV+Lr1tIm+e e5RYymEl8npUXlsv5mqRcc3/ELGe4Pul0NRBYivPYSIUK/POmJhUOvi+LKQjGJAtJXug zHyfZzWiA4LqXSacv56z3EuunSebysfp18pOb6nPoMc95p15bdKkZefaFLYNx7Lw7DkU gIMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KJplMlY6FbMHXb00APduirYkXbPmkHGLgNPqITMnbRw=; b=q4+eX85ZG00UjY0oUPMaOy7+chpd+dvG6hL5yPnVWpz7yOmDMGelaUbv81ZoNSLIc4 bbfUjklej34+jWuE88W/MYAkfGDUxDNVlJfb4MGsSawm6YMXMrfcQeRS3CHgTfdg8vup dFcXpJcLoYHfT6Q+Kspf5mezLk0kdI7Lf2q0FkBBQDPt8fe1K9chAwFz4ajMG8FkOS8r VT5SJa0xMIA0BBJWGAieBDIV+9XTCWfYiAew6Wr8+8i2J9wUe54nUMkS7ahmNeOY+HJZ Vo2i0nOMHiUa+3HUW8B997FxVOCD5sZoe0UjL+/PS7NxJURpFPrZemQLMY7PFMRDs8ri Sd8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=FzmvEI8v; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id fo11-20020a0568709a0b00b000e2148764e7si4644695oab.108.2022.04.06.07.10.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 07:10:37 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=FzmvEI8v; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 511EF62ADBD; Wed, 6 Apr 2022 04:58:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391575AbiDFJd7 (ORCPT + 99 others); Wed, 6 Apr 2022 05:33:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1580078AbiDFJUu (ORCPT ); Wed, 6 Apr 2022 05:20:50 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B31EF493CFC; Tue, 5 Apr 2022 23:12:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=KJplMlY6FbMHXb00APduirYkXbPmkHGLgNPqITMnbRw=; b=FzmvEI8vSyn/6nQja0s8YlHSY0 VDIJQLy1X4LI11OTVAkB6p326avuiTOtvq2tK01CFEmRmJZniiUIlrJg/db2cSTeDn3BnK8UtHfjF Hd1hHxoqa6l/bKmvn3BzIE6FjfaXuaMc9OhFqzcPs+adC89RRP4OMsXsbWyNUW2cBrtl5M/scW3ZS Lj8VFF3S7A0P+Y7SFdYmalWsj7RB2JqjV08XsKmJ3qf+aOpT+udOnE8mWIW2gFbPgyfgNH4Aa9T+U aVTywWUtPfgoEjBt9A1bREnQu97JQ8co8hwjDhGO3IKqdOsRHdta/aN9o7O5SYaY592Y3lH6IO3v3 O45eCcag==; Received: from 213-225-3-188.nat.highway.a1.net ([213.225.3.188] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbyuI-003zMC-Aw; Wed, 06 Apr 2022 06:12:42 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Coly Li , Mike Snitzer , Song Liu , "Martin K. Petersen" , Josef Bacik , David Sterba , Phillip Lougher , linux-block@vger.kernel.org, dm-devel@redhat.com, linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [PATCH 3/5] target/pscsi: remove pscsi_get_bio Date: Wed, 6 Apr 2022 08:12:26 +0200 Message-Id: <20220406061228.410163-4-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220406061228.410163-1-hch@lst.de> References: <20220406061228.410163-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Remove pscsi_get_bio and simplify the code flow in the only caller. Signed-off-by: Christoph Hellwig Acked-by: Martin K. Petersen --- drivers/target/target_core_pscsi.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index ff292b75e23f9..77bd3af4b2bf8 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -821,23 +821,6 @@ static void pscsi_bi_endio(struct bio *bio) bio_put(bio); } -static inline struct bio *pscsi_get_bio(int nr_vecs) -{ - struct bio *bio; - /* - * Use bio_malloc() following the comment in for bio -> struct request - * in block/blk-core.c:blk_make_request() - */ - bio = bio_kmalloc(GFP_KERNEL, nr_vecs); - if (!bio) { - pr_err("PSCSI: bio_kmalloc() failed\n"); - return NULL; - } - bio->bi_end_io = pscsi_bi_endio; - - return bio; -} - static sense_reason_t pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, struct request *req) @@ -878,12 +861,10 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, if (!bio) { new_bio: nr_vecs = bio_max_segs(nr_pages); - /* - * Calls bio_kmalloc() and sets bio->bi_end_io() - */ - bio = pscsi_get_bio(nr_vecs); + bio = bio_kmalloc(GFP_KERNEL, nr_vecs); if (!bio) goto fail; + bio->bi_end_io = pscsi_bi_endio; if (rw) bio_set_op_attrs(bio, REQ_OP_WRITE, 0); @@ -912,11 +893,6 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, goto fail; } - /* - * Clear the pointer so that another bio will - * be allocated with pscsi_get_bio() above. - */ - bio = NULL; goto new_bio; } -- 2.30.2