From patchwork Mon Jun 11 19:48:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10458739 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 B6B5360467 for ; Mon, 11 Jun 2018 19:48:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5A8726CFC for ; Mon, 11 Jun 2018 19:48:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A78A27BA5; Mon, 11 Jun 2018 19:48:36 +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 4722E26CFC for ; Mon, 11 Jun 2018 19:48:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934681AbeFKTsf (ORCPT ); Mon, 11 Jun 2018 15:48:35 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48740 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934347AbeFKTse (ORCPT ); Mon, 11 Jun 2018 15:48:34 -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=krPQmRlUiJGyQrYMpwU1HKe9U d4bV76jgMSS1m7tCkDb9aQAfPWFxwXP+dj6ULdL7fctRiomlXkF3aomRqt6n4p6+ItS304aPhmCOJ QFa1/7T0gZ7/bn0EvGmTW1oz3ktP4J6EV8KcBQaBD1M5AtzdVfgfcX7EBYKCEJBf6Xooj1alswTAM 4UCGAFYgzqHKEV5jUG8dpiDIfi4eWkAF2KV1oFiI2XCOQR3C7U4iBj4K3EcVGwwKLUL5Ws4rPvBDl m5V78jobzMCEccYeLqj+tKL9SFUmuwYmWzx+NFf23XM0f3PJYtJqUP2fVC2/7yev8nbCtL28JIcdi HGoLHcomw==; Received: from 213-225-7-72.nat.highway.a1.net ([213.225.7.72] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSSno-0004OM-Jg; Mon, 11 Jun 2018 19:48:33 +0000 From: Christoph Hellwig To: Jens Axboe , Coly Li Cc: linux-bcache@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 5/6] bcache: don't clone bio in bch_data_verify Date: Mon, 11 Jun 2018 21:48:05 +0200 Message-Id: <20180611194806.13222-6-hch@lst.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180611194806.13222-1-hch@lst.de> References: <20180611194806.13222-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;