From patchwork Tue Jun 19 04:52:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10473129 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 9708B601D7 for ; Tue, 19 Jun 2018 04:52:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88DAA28ABA for ; Tue, 19 Jun 2018 04:52:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D33B28C14; Tue, 19 Jun 2018 04:52:33 +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 0B6DF28ABA for ; Tue, 19 Jun 2018 04:52:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937259AbeFSEwc (ORCPT ); Tue, 19 Jun 2018 00:52:32 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:40540 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935681AbeFSEwb (ORCPT ); Tue, 19 Jun 2018 00:52:31 -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=jcrA+PM3WuRMrAAVZByCPDmBe ECyBHCk8wqh7We5kRvIMmJ/+xZ3oArEYkyquANM2gwkFHI3vsUvO88viqFlDDr+DhV+GpuNzkhwAP mYuUZbZI6UZRRkzdfQJ6TxobhYZ7yXASpzH97hvTeXgdUTXc/ie8s/1hi9J5K/3iAXMZ2ZEnwL5+T WM+Gf87LtWs3h+pxXQqxLQ6rpvQyzYfjxlgqahlOOfpdUt9kFyVRJt3c4P/dQlfnkSzOdBBmSMvTC 489FkhOTSuf9DaUhFM6fIgBG04Latctj5yzSLj+xNMgm0B3JQBodtktfcMjoVq+bhZkFTJucNerUv 8YHomI0bA==; Received: from 089144192009.atnat0001.highway.a1.net ([89.144.192.9] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fV8d2-0008Qd-T4; Tue, 19 Jun 2018 04:52:29 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ming Lei , Boaz Harrosh , linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH 2/6] bcache: don't clone bio in bch_data_verify Date: Tue, 19 Jun 2018 06:52:12 +0200 Message-Id: <20180619045216.21130-3-hch@lst.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180619045216.21130-1-hch@lst.de> References: <20180619045216.21130-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;