From patchwork Tue Jul 24 07:52:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10541511 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9E4C814BC for ; Tue, 24 Jul 2018 08:04:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 904A728762 for ; Tue, 24 Jul 2018 08:04:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8465E28776; Tue, 24 Jul 2018 08:04:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 33EE128762 for ; Tue, 24 Jul 2018 08:04:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 70EE1308212E; Tue, 24 Jul 2018 08:04:49 +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 4B19A5D9CB; Tue, 24 Jul 2018 08:04:49 +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 03C3D4A460; Tue, 24 Jul 2018 08:04:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6O84kt5001693 for ; Tue, 24 Jul 2018 04:04:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id C1B93CC9FD; Tue, 24 Jul 2018 08:04:46 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B9FBECC9EA for ; Tue, 24 Jul 2018 08:04:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F08513082A44 for ; Tue, 24 Jul 2018 08:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kvAoU+3f5uUkhlvnWFjKxikUml/hF3RxLKkRDl15SCA=; b=fX7XAQECNnZPC82cja57shJUJ oVYaAeecsoLBoqK3+wyXIGYcbAMzDYUK8qKH1w+6w9RH2ffKK5dLOzwpOJm3RaNYKzmF4sv5jJEGa hkIizMOtMqw0wvlX6Op2/PEpNbOfogdLiWPFX4ae/TgGua610KSqIslngt68LT5qWXLTgJzID93WL R3ei+7kb43TZ+lowxENBixdk1sJxbPsJxzjB+RYeh/WhOAk7tIS9jq2/L4KvdUAXoyLKn4vzuTHof YO4e4nKYoPWVE2lt1v+yWVAVCk1jY9mMG7as91GBUlFSnqYvC6aYiz0n/Eu7Zn8j78EED7VKId1k5 lfS2xifAA==; Received: from 089144194224.atnat0003.highway.a1.net ([89.144.194.224] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fhs7f-0000LH-Uu; Tue, 24 Jul 2018 07:52:44 +0000 From: Christoph Hellwig To: Jens Axboe Date: Tue, 24 Jul 2018 09:52:30 +0200 Message-Id: <20180724075234.26861-2-hch@lst.de> In-Reply-To: <20180724075234.26861-1-hch@lst.de> References: <20180724075234.26861-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Greylist: Delayed for 00:11:51 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 24 Jul 2018 08:04:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 24 Jul 2018 08:04:33 +0000 (UTC) for IP:'198.137.202.133' DOMAIN:'bombadil.infradead.org' HELO:'bombadil.infradead.org' FROM:'BATV+c9ebeb9e9cafa2a765ab+5448+infradead.org+hch@bombadil.srs.infradead.org' RCPT:'' X-RedHat-Spam-Score: 0.359 (DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, T_DKIM_INVALID) 198.137.202.133 bombadil.infradead.org 198.137.202.133 bombadil.infradead.org X-Scanned-By: MIMEDefang 2.84 on 10.5.110.45 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: dm-devel@redhat.com Cc: linux-block@vger.kernel.org, Boaz Harrosh , linux-bcache@vger.kernel.org, dm-devel@redhat.com Subject: [dm-devel] [PATCH 1/5] bcache: don't clone bio in bch_data_verify 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 24 Jul 2018 08:04:49 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP We immediately overwrite the biovec array, so instead just allocate a new bio and copy over the disk, setor and size. Signed-off-by: Christoph Hellwig Reviewed-by: Ming Lei Acked-by: Coly Li --- drivers/md/bcache/debug.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c index d030ce3025a6..04d146711950 100644 --- a/drivers/md/bcache/debug.c +++ b/drivers/md/bcache/debug.c @@ -110,11 +110,15 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio) struct bio_vec bv, cbv; struct bvec_iter iter, citer = { 0 }; - check = bio_clone_kmalloc(bio, GFP_NOIO); + check = bio_kmalloc(GFP_NOIO, bio_segments(bio)); if (!check) return; + check->bi_disk = bio->bi_disk; check->bi_opf = REQ_OP_READ; + check->bi_iter.bi_sector = bio->bi_iter.bi_sector; + check->bi_iter.bi_size = bio->bi_iter.bi_size; + bch_bio_map(check, NULL); if (bch_bio_alloc_pages(check, GFP_NOIO)) goto out_put; From patchwork Tue Jul 24 07:52:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10541505 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B3C4B14BC for ; Tue, 24 Jul 2018 08:04:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A45BB28762 for ; Tue, 24 Jul 2018 08:04:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 984EE2877F; Tue, 24 Jul 2018 08:04:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3161528762 for ; Tue, 24 Jul 2018 08:04:07 +0000 (UTC) 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 mx1.redhat.com (Postfix) with ESMTPS id EB4F012C1D; Tue, 24 Jul 2018 08:04:05 +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 7BFCA5C542; Tue, 24 Jul 2018 08:04:05 +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 3C3E04A460; Tue, 24 Jul 2018 08:04:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6O843Zu001615 for ; Tue, 24 Jul 2018 04:04:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9FE9910694F4; Tue, 24 Jul 2018 08:04:03 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9761710694F3 for ; Tue, 24 Jul 2018 08:04:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 75FCB308A96C for ; Tue, 24 Jul 2018 08:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=NqKKA0xw31+05P5PU0Cf22CfHmwcHqQSH79n9Ggt8M8=; b=a2Mgmy8Buo8EfvT0g3zAQS6d2 YXJBXRJuo5mCwpHLSIHKl/wFHKDHWjCBK2P3ApOi+nvXTstMhcrGm/6HMeDIZ0lcEGZrL6shykEwC AOKZItpYyCHviK95pxQdWZJrIzwTVKaqtZCQh9xkZ1eNxSu2+zc9O5OD/nCDynW/4Sht0V+mH9Uaz v1cecsumLAUUbheFI9vP0zZoSMsn4XW61O2/6ahF/NUr+DRi7mRPfljpCYJtJbKLb/pw3VAwdljW8 npoCo217rK9Y2qMwEnhueRsa0NGMXpkF+nciL8y8zHiGPw3cy0HhN0JWpN8KDjFfpewPBWEvU/r0u FSB7a/1zA==; Received: from 089144194224.atnat0003.highway.a1.net ([89.144.194.224] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fhs7j-0000Lk-MP; Tue, 24 Jul 2018 07:52:48 +0000 From: Christoph Hellwig To: Jens Axboe Date: Tue, 24 Jul 2018 09:52:31 +0200 Message-Id: <20180724075234.26861-3-hch@lst.de> In-Reply-To: <20180724075234.26861-1-hch@lst.de> References: <20180724075234.26861-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Greylist: Delayed for 00:11:08 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 24 Jul 2018 08:03:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 24 Jul 2018 08:03:50 +0000 (UTC) for IP:'198.137.202.133' DOMAIN:'bombadil.infradead.org' HELO:'bombadil.infradead.org' FROM:'BATV+c9ebeb9e9cafa2a765ab+5448+infradead.org+hch@bombadil.srs.infradead.org' RCPT:'' X-RedHat-Spam-Score: 0.359 (DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, T_DKIM_INVALID) 198.137.202.133 bombadil.infradead.org 198.137.202.133 bombadil.infradead.org X-Scanned-By: MIMEDefang 2.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: dm-devel@redhat.com Cc: linux-block@vger.kernel.org, Boaz Harrosh , linux-bcache@vger.kernel.org, dm-devel@redhat.com Subject: [dm-devel] [PATCH 2/5] exofs: use bio_clone_fast in _write_mirror 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 24 Jul 2018 08:04:06 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP The mirroring code never changes the bio data or biovecs. This means we can reuse the biovec allocation easily instead of duplicating it. Signed-off-by: Christoph Hellwig Acked-by Boaz Harrosh Reviewed-by: Ming Lei --- fs/exofs/ore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/exofs/ore.c b/fs/exofs/ore.c index 1b8b44637e70..5331a15a61f1 100644 --- a/fs/exofs/ore.c +++ b/fs/exofs/ore.c @@ -873,8 +873,8 @@ static int _write_mirror(struct ore_io_state *ios, int cur_comp) struct bio *bio; if (per_dev != master_dev) { - bio = bio_clone_kmalloc(master_dev->bio, - GFP_KERNEL); + bio = bio_clone_fast(master_dev->bio, + GFP_KERNEL, NULL); if (unlikely(!bio)) { ORE_DBGMSG( "Failed to allocate BIO size=%u\n", From patchwork Tue Jul 24 07:52:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10541507 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 760E714BC for ; Tue, 24 Jul 2018 08:04:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6845E28762 for ; Tue, 24 Jul 2018 08:04:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5ACC128776; Tue, 24 Jul 2018 08:04:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E503228762 for ; Tue, 24 Jul 2018 08:04:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DCA4E8CCA; Tue, 24 Jul 2018 08:04:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A7E521001903; Tue, 24 Jul 2018 08:04:17 +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 6ACEA18037EF; Tue, 24 Jul 2018 08:04:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6O84Gcx001636 for ; Tue, 24 Jul 2018 04:04:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 036F35C26E; Tue, 24 Jul 2018 08:04:16 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EE2135C23B for ; Tue, 24 Jul 2018 08:04:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A2493307D844 for ; Tue, 24 Jul 2018 08:04:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=X3/sElWeqIC7i5Qy9HcFWr6wNeUIQ6TqeJr1/5+K8m4=; b=Wl4QeeI/G17n1ZJUxS6BkXp2/ 0fpHkebpSt5nt017eBwK3DqLRyy1+JKuaxTQu/q+E+ryQMZsOkC1TXVjN5xfHanZXd/WCx452/U0L hAcxyH4ToVA9GCexKYrnStO3GHP7IUSVQrebybvmQMxwbJPNiiniTq8CtYl/KflNgVNarfUxr9G+4 yC8PV1lwPyh29uQCXz8T3CgMCtoDvM5zB4WfhY+GPH7ea602Z1s2ChdJAtNVbr+ip7XzzgQpIr4J2 rQ1VvKO+H4F5tOrZLWw6Zw6imgKer5pIrx6mJc016LPsVXg9pJUZNa6l4TP/oAK1aJWdgEFk3BUlN ZnzjbMqrQ==; Received: from 089144194224.atnat0003.highway.a1.net ([89.144.194.224] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fhs7m-0000Mc-Mf; Tue, 24 Jul 2018 07:52:51 +0000 From: Christoph Hellwig To: Jens Axboe Date: Tue, 24 Jul 2018 09:52:32 +0200 Message-Id: <20180724075234.26861-4-hch@lst.de> In-Reply-To: <20180724075234.26861-1-hch@lst.de> References: <20180724075234.26861-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Greylist: Delayed for 00:11:19 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 24 Jul 2018 08:04:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 24 Jul 2018 08:04:01 +0000 (UTC) for IP:'198.137.202.133' DOMAIN:'bombadil.infradead.org' HELO:'bombadil.infradead.org' FROM:'BATV+c9ebeb9e9cafa2a765ab+5448+infradead.org+hch@bombadil.srs.infradead.org' RCPT:'' X-RedHat-Spam-Score: 0.359 (DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, T_DKIM_INVALID) 198.137.202.133 bombadil.infradead.org 198.137.202.133 bombadil.infradead.org X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: dm-devel@redhat.com Cc: linux-block@vger.kernel.org, Boaz Harrosh , linux-bcache@vger.kernel.org, dm-devel@redhat.com Subject: [dm-devel] [PATCH 3/5] block: remove bio_clone_kmalloc 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 24 Jul 2018 08:04:18 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Unused now. Signed-off-by: Christoph Hellwig Reviewed-by: Ming Lei --- include/linux/bio.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index ab221c517f4e..b861baa59454 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -443,12 +443,6 @@ static inline struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs) return bio_alloc_bioset(gfp_mask, nr_iovecs, NULL); } -static inline struct bio *bio_clone_kmalloc(struct bio *bio, gfp_t gfp_mask) -{ - return bio_clone_bioset(bio, gfp_mask, NULL); - -} - extern blk_qc_t submit_bio(struct bio *); extern void bio_endio(struct bio *); From patchwork Tue Jul 24 07:52:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10541513 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A20DF1822 for ; Tue, 24 Jul 2018 08:05:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 943542875C for ; Tue, 24 Jul 2018 08:05:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87B8028776; Tue, 24 Jul 2018 08:05:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D7A5928762 for ; Tue, 24 Jul 2018 08:04:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 11198308213C; Tue, 24 Jul 2018 08:04:59 +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 D576116C08; Tue, 24 Jul 2018 08:04:58 +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 8114D4A464; Tue, 24 Jul 2018 08:04:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6O84vCb001710 for ; Tue, 24 Jul 2018 04:04:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9A6F116D38; Tue, 24 Jul 2018 08:04:57 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9050716C08 for ; Tue, 24 Jul 2018 08:04:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E28F630832C4 for ; Tue, 24 Jul 2018 08:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Gfz/quGAGXGdLPyRfqO5dgrgfC4qg63BZ/tLA81OCmQ=; b=LBwxHfVvXCcigZw4p+IFIAwML GVItFUEMFTB0rWTsTPPBB2xXwbbvbzgU8hIdzxVThIp6u4hbbreK4tWtQT1U3c+V/MpaPVrtDyvOO BoYrgFLu+M9jMU9Llgh5hnhhnsHbMY8jt39wbtgqCIC37hz5ISWitpaoP1gsaM2aW85/0hl4c7DSJ 53jiPxZmxr+6yW7UAh3BMWjb6Id4+RT5w4EY6arLHXF+XHeiDbwJYoc65EboZHaEcSwpT0Ri4cuCj /i6u4dTWqp1r2X1G6pGVPUU4wGKH7eOK62tKqxzwy3nnrKffNliwSi/avADwW9x9BttEdSP3mYGHS Ci3xmfu7Q==; Received: from 089144194224.atnat0003.highway.a1.net ([89.144.194.224] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fhs7p-0000NU-Vo; Tue, 24 Jul 2018 07:52:54 +0000 From: Christoph Hellwig To: Jens Axboe Date: Tue, 24 Jul 2018 09:52:33 +0200 Message-Id: <20180724075234.26861-5-hch@lst.de> In-Reply-To: <20180724075234.26861-1-hch@lst.de> References: <20180724075234.26861-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Greylist: Delayed for 00:12:01 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 24 Jul 2018 08:04:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 24 Jul 2018 08:04:44 +0000 (UTC) for IP:'198.137.202.133' DOMAIN:'bombadil.infradead.org' HELO:'bombadil.infradead.org' FROM:'BATV+c9ebeb9e9cafa2a765ab+5448+infradead.org+hch@bombadil.srs.infradead.org' RCPT:'' X-RedHat-Spam-Score: 0.359 (DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, T_DKIM_INVALID) 198.137.202.133 bombadil.infradead.org 198.137.202.133 bombadil.infradead.org X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: dm-devel@redhat.com Cc: linux-block@vger.kernel.org, Boaz Harrosh , linux-bcache@vger.kernel.org, dm-devel@redhat.com Subject: [dm-devel] [PATCH 4/5] md: remove a bogus comment 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 24 Jul 2018 08:04:59 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP The function name mentioned doesn't exist, and the code next to it doesn't match the description either. Signed-off-by: Christoph Hellwig Reviewed-by: Ming Lei --- drivers/md/md.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index f6e58dbca0d4..cb4eb5faa519 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -204,10 +204,6 @@ static int start_readonly; */ static bool create_on_open = true; -/* bio_clone_mddev - * like bio_clone_bioset, but with a local bio set - */ - struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, struct mddev *mddev) { From patchwork Tue Jul 24 07:52:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10541509 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED2D414BC for ; Tue, 24 Jul 2018 08:04:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D867128762 for ; Tue, 24 Jul 2018 08:04:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC93228776; Tue, 24 Jul 2018 08:04:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4AD7128762 for ; Tue, 24 Jul 2018 08:04:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0F5D111534; Tue, 24 Jul 2018 08:04:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D18C9100191D; Tue, 24 Jul 2018 08:04:28 +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 9321118037F0; Tue, 24 Jul 2018 08:04:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6O84RHQ001663 for ; Tue, 24 Jul 2018 04:04:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6E2D43001A51; Tue, 24 Jul 2018 08:04:27 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6832B309128B for ; Tue, 24 Jul 2018 08:04:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D8E41C00341F for ; Tue, 24 Jul 2018 08:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MZwBmtllhconx+JgS7XVfAf7i8q3/Ca/3Ot2aXazuqw=; b=cszicG+QiTVPb/7GJx4xtwZR8 ix+IkWpv0jza5GOJHF9gE+f9o93KBorfeIJhzJXOGokzDtPvrnU8QJzupA/NJTZMUuCP4K63TMi/I +5BuS9AzvpkVyA/POihifHk0SlzKWeK9CNvjWHRescd7SU+elJxDXE7rm8brGZWsAqj5+2O8sLiv6 I9L+YmhEfDoicbl4R66QqjghjM4b7PIQN++7Kiio96GO5UJDV9Wac+4zKAuTKabHIfo/qYauIdC5x jkEXXSe4PuCRZt6wfLQyCs24eXB6ef+WAfG0fMfvD+FdyrJJtoly251A3fMLKfxz7AOoQTmb+meYy CawWYqGAQ==; Received: from 089144194224.atnat0003.highway.a1.net ([89.144.194.224] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fhs7t-0000Nv-5Q; Tue, 24 Jul 2018 07:52:57 +0000 From: Christoph Hellwig To: Jens Axboe Date: Tue, 24 Jul 2018 09:52:34 +0200 Message-Id: <20180724075234.26861-6-hch@lst.de> In-Reply-To: <20180724075234.26861-1-hch@lst.de> References: <20180724075234.26861-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Greylist: Delayed for 00:11:30 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 24 Jul 2018 08:04:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 24 Jul 2018 08:04:12 +0000 (UTC) for IP:'198.137.202.133' DOMAIN:'bombadil.infradead.org' HELO:'bombadil.infradead.org' FROM:'BATV+c9ebeb9e9cafa2a765ab+5448+infradead.org+hch@bombadil.srs.infradead.org' RCPT:'' X-RedHat-Spam-Score: 0.359 (DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, T_DKIM_INVALID) 198.137.202.133 bombadil.infradead.org 198.137.202.133 bombadil.infradead.org X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: dm-devel@redhat.com Cc: linux-block@vger.kernel.org, Boaz Harrosh , linux-bcache@vger.kernel.org, dm-devel@redhat.com Subject: [dm-devel] [PATCH 5/5] block: unexport bio_clone_bioset 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 24 Jul 2018 08:04:29 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Now only used by the bounce code, so move it there and mark the function static. Signed-off-by: Christoph Hellwig Reviewed-by: Ming Lei --- block/bio.c | 77 --------------------------------------------- block/bounce.c | 69 +++++++++++++++++++++++++++++++++++++++- include/linux/bio.h | 1 - 3 files changed, 68 insertions(+), 79 deletions(-) diff --git a/block/bio.c b/block/bio.c index 8ecc95615941..d1313d73009d 100644 --- a/block/bio.c +++ b/block/bio.c @@ -646,83 +646,6 @@ struct bio *bio_clone_fast(struct bio *bio, gfp_t gfp_mask, struct bio_set *bs) } EXPORT_SYMBOL(bio_clone_fast); -/** - * bio_clone_bioset - clone a bio - * @bio_src: bio to clone - * @gfp_mask: allocation priority - * @bs: bio_set to allocate from - * - * Clone bio. Caller will own the returned bio, but not the actual data it - * points to. Reference count of returned bio will be one. - */ -struct bio *bio_clone_bioset(struct bio *bio_src, gfp_t gfp_mask, - struct bio_set *bs) -{ - struct bvec_iter iter; - struct bio_vec bv; - struct bio *bio; - - /* - * Pre immutable biovecs, __bio_clone() used to just do a memcpy from - * bio_src->bi_io_vec to bio->bi_io_vec. - * - * We can't do that anymore, because: - * - * - The point of cloning the biovec is to produce a bio with a biovec - * the caller can modify: bi_idx and bi_bvec_done should be 0. - * - * - The original bio could've had more than BIO_MAX_PAGES biovecs; if - * we tried to clone the whole thing bio_alloc_bioset() would fail. - * But the clone should succeed as long as the number of biovecs we - * actually need to allocate is fewer than BIO_MAX_PAGES. - * - * - Lastly, bi_vcnt should not be looked at or relied upon by code - * that does not own the bio - reason being drivers don't use it for - * iterating over the biovec anymore, so expecting it to be kept up - * to date (i.e. for clones that share the parent biovec) is just - * asking for trouble and would force extra work on - * __bio_clone_fast() anyways. - */ - - bio = bio_alloc_bioset(gfp_mask, bio_segments(bio_src), bs); - if (!bio) - return NULL; - bio->bi_disk = bio_src->bi_disk; - bio->bi_opf = bio_src->bi_opf; - bio->bi_write_hint = bio_src->bi_write_hint; - bio->bi_iter.bi_sector = bio_src->bi_iter.bi_sector; - bio->bi_iter.bi_size = bio_src->bi_iter.bi_size; - - switch (bio_op(bio)) { - case REQ_OP_DISCARD: - case REQ_OP_SECURE_ERASE: - case REQ_OP_WRITE_ZEROES: - break; - case REQ_OP_WRITE_SAME: - bio->bi_io_vec[bio->bi_vcnt++] = bio_src->bi_io_vec[0]; - break; - default: - bio_for_each_segment(bv, bio_src, iter) - bio->bi_io_vec[bio->bi_vcnt++] = bv; - break; - } - - if (bio_integrity(bio_src)) { - int ret; - - ret = bio_integrity_clone(bio, bio_src, gfp_mask); - if (ret < 0) { - bio_put(bio); - return NULL; - } - } - - bio_clone_blkcg_association(bio, bio_src); - - return bio; -} -EXPORT_SYMBOL(bio_clone_bioset); - /** * bio_add_pc_page - attempt to add page to bio * @q: the target queue diff --git a/block/bounce.c b/block/bounce.c index fd31347b7836..bc63b3a2d18c 100644 --- a/block/bounce.c +++ b/block/bounce.c @@ -195,6 +195,73 @@ static void bounce_end_io_read_isa(struct bio *bio) __bounce_end_io_read(bio, &isa_page_pool); } +static struct bio *bounce_clone_bio(struct bio *bio_src, gfp_t gfp_mask, + struct bio_set *bs) +{ + struct bvec_iter iter; + struct bio_vec bv; + struct bio *bio; + + /* + * Pre immutable biovecs, __bio_clone() used to just do a memcpy from + * bio_src->bi_io_vec to bio->bi_io_vec. + * + * We can't do that anymore, because: + * + * - The point of cloning the biovec is to produce a bio with a biovec + * the caller can modify: bi_idx and bi_bvec_done should be 0. + * + * - The original bio could've had more than BIO_MAX_PAGES biovecs; if + * we tried to clone the whole thing bio_alloc_bioset() would fail. + * But the clone should succeed as long as the number of biovecs we + * actually need to allocate is fewer than BIO_MAX_PAGES. + * + * - Lastly, bi_vcnt should not be looked at or relied upon by code + * that does not own the bio - reason being drivers don't use it for + * iterating over the biovec anymore, so expecting it to be kept up + * to date (i.e. for clones that share the parent biovec) is just + * asking for trouble and would force extra work on + * __bio_clone_fast() anyways. + */ + + bio = bio_alloc_bioset(gfp_mask, bio_segments(bio_src), bs); + if (!bio) + return NULL; + bio->bi_disk = bio_src->bi_disk; + bio->bi_opf = bio_src->bi_opf; + bio->bi_write_hint = bio_src->bi_write_hint; + bio->bi_iter.bi_sector = bio_src->bi_iter.bi_sector; + bio->bi_iter.bi_size = bio_src->bi_iter.bi_size; + + switch (bio_op(bio)) { + case REQ_OP_DISCARD: + case REQ_OP_SECURE_ERASE: + case REQ_OP_WRITE_ZEROES: + break; + case REQ_OP_WRITE_SAME: + bio->bi_io_vec[bio->bi_vcnt++] = bio_src->bi_io_vec[0]; + break; + default: + bio_for_each_segment(bv, bio_src, iter) + bio->bi_io_vec[bio->bi_vcnt++] = bv; + break; + } + + if (bio_integrity(bio_src)) { + int ret; + + ret = bio_integrity_clone(bio, bio_src, gfp_mask); + if (ret < 0) { + bio_put(bio); + return NULL; + } + } + + bio_clone_blkcg_association(bio, bio_src); + + return bio; +} + static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig, mempool_t *pool) { @@ -222,7 +289,7 @@ static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig, generic_make_request(*bio_orig); *bio_orig = bio; } - bio = bio_clone_bioset(*bio_orig, GFP_NOIO, passthrough ? NULL : + bio = bounce_clone_bio(*bio_orig, GFP_NOIO, passthrough ? NULL : &bounce_bio_set); bio_for_each_segment_all(to, bio, i) { diff --git a/include/linux/bio.h b/include/linux/bio.h index b861baa59454..51371740d2a8 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -429,7 +429,6 @@ extern void bio_put(struct bio *); extern void __bio_clone_fast(struct bio *, struct bio *); extern struct bio *bio_clone_fast(struct bio *, gfp_t, struct bio_set *); -extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs); extern struct bio_set fs_bio_set;