From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FF13C4321E for ; Tue, 1 Mar 2022 08:46:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233543AbiCAIrD (ORCPT ); Tue, 1 Mar 2022 03:47:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233484AbiCAIqz (ORCPT ); Tue, 1 Mar 2022 03:46:55 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94B7588B18; Tue, 1 Mar 2022 00:46:15 -0800 (PST) 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=vZ96Fkp20C3ntwTtfrTvq6UxLwgV6UvOAhdkzhw4eFw=; b=iZxRV++Um42T1f3xr7O9OS1f2N I/rj9q1ZOb5kkPL6DHV3XtFjx2Hq8+TryxCn9Q3wWYXxseyLDXOZyKzhIKm8sHLkABo4lb70WeeFo /8toxQr8f3RpdhLCZLDiKBACefcwh9J1NddYyy1z2t5+8K6nxpptCac6Kc0Vsc3DAXJxFnwC1LtWm DWncsZ5bWcSf3//LqUCZFbxWx6kafxn3rZuucE1Xt7WQmoglFwxXdYGcV/hBBf7aD3FCWCeBPPrWX rTcxevWp4rOnLBVnUau3zC47pECBdRGwZ8cEmlUVw5zIXVqxPBvK/3OQFFnyvBwscpBOf28738vcw CXVls3pw==; Received: from [2.53.44.23] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOy91-00FfQZ-Ah; Tue, 01 Mar 2022 08:46:08 +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: Tue, 1 Mar 2022 10:45:50 +0200 Message-Id: <20220301084552.880256-4-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220301084552.880256-1-hch@lst.de> References: <20220301084552.880256-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 Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org Remove pscsi_get_bio and simplify the code flow in the only caller. Signed-off-by: Christoph Hellwig --- 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 0fae71ac5cc8a..bd8ae07273f14 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -823,23 +823,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) @@ -880,12 +863,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); @@ -914,11 +895,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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2FB17C433F5 for ; Tue, 1 Mar 2022 08:46:28 +0000 (UTC) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-97-vU_q5Nz7Pfa06H5N0SLUag-1; Tue, 01 Mar 2022 03:46:23 -0500 X-MC-Unique: vU_q5Nz7Pfa06H5N0SLUag-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 73F121006AA5; Tue, 1 Mar 2022 08:46:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D6947AB78; Tue, 1 Mar 2022 08:46:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 05CBE4ED28; Tue, 1 Mar 2022 08:46:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 2218kG6I028987 for ; Tue, 1 Mar 2022 03:46:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id C9EC52026D6B; Tue, 1 Mar 2022 08:46:16 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C566C2026D69 for ; Tue, 1 Mar 2022 08:46:13 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BE81B811E76 for ; Tue, 1 Mar 2022 08:46:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-178-FBfMaeVONvytHaoGOSRNNA-1; Tue, 01 Mar 2022 03:46:10 -0500 X-MC-Unique: FBfMaeVONvytHaoGOSRNNA-1 Received: from [2.53.44.23] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOy91-00FfQZ-Ah; Tue, 01 Mar 2022 08:46:08 +0000 From: Christoph Hellwig To: Jens Axboe Date: Tue, 1 Mar 2022 10:45:50 +0200 Message-Id: <20220301084552.880256-4-hch@lst.de> In-Reply-To: <20220301084552.880256-1-hch@lst.de> References: <20220301084552.880256-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: dm-devel@redhat.com Cc: linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, Mike Snitzer , "Martin K. Petersen" , linux-kernel@vger.kernel.org, Josef Bacik , Coly Li , linux-block@vger.kernel.org, Song Liu , dm-devel@redhat.com, target-devel@vger.kernel.org, David Sterba , Phillip Lougher , linux-btrfs@vger.kernel.org Subject: [dm-devel] [PATCH 3/5] target/pscsi: remove pscsi_get_bio X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Remove pscsi_get_bio and simplify the code flow in the only caller. Signed-off-by: Christoph Hellwig --- 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 0fae71ac5cc8a..bd8ae07273f14 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -823,23 +823,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) @@ -880,12 +863,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); @@ -914,11 +895,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 -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel