From patchwork Wed Jun 13 13:51:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10462273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D4C4460234 for ; Wed, 13 Jun 2018 13:52:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5D6028914 for ; Wed, 13 Jun 2018 13:52:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA89A2892E; Wed, 13 Jun 2018 13:52:21 +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 vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CE6128914 for ; Wed, 13 Jun 2018 13:52:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935279AbeFMNwU (ORCPT ); Wed, 13 Jun 2018 09:52:20 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:38314 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934527AbeFMNwT (ORCPT ); Wed, 13 Jun 2018 09:52:19 -0400 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=nc5FNCKfTbrjXTs0OANgyyccmPQ5rHvjpDzckEglNLs=; b=qXU4C+AdSw0f6hYNObhuA+7UD gCNKvhVS/Xe2FmUlgNojhFypEr7OofqDl6Dm065T1ZpufijBTz0s+jkvr9FlsA77+kSaoN8xVmXTg +K/uRvcIudP62cHgg9PlRH6ilE8nTCIjk1b3Oa+bLpkEv9LugpVAoltqtfGHRwfmd71/z48s+onp8 gRzL1vObEqUBJFIXFkKqEU7kas5UW3d5jqBU6od91IzqlcEVJOPdiJLCufNbft625PkOONNVkc5/i +NyRMeq1dGCyK4K1t7xDRhGUR8VshjyAKMRImC616NPzB1WnbA9mChJPwlvWv3gwHK5sewo0Z/E39 RX/s3JPww==; Received: from 089144194215.atnat0003.highway.a1.net ([89.144.194.215] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fT6C9-0003hh-T6; Wed, 13 Jun 2018 13:52:18 +0000 From: Christoph Hellwig To: Jens Axboe , Coly Li Cc: Kent Overstreet , linux-bcache@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 5/6] bcache: don't clone bio in bch_data_verify Date: Wed, 13 Jun 2018 15:51:57 +0200 Message-Id: <20180613135158.29477-6-hch@lst.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180613135158.29477-1-hch@lst.de> References: <20180613135158.29477-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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 --- 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;