Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6385692imm; Wed, 27 Jun 2018 06:59:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJIwYmvp8haEJiZ27EC4Vy4AXN3ST07ETsRHm5cuEIjJi9TONTB9U+ZueAjtvedLHRtwIq/ X-Received: by 2002:a17:902:6bc7:: with SMTP id m7-v6mr6375595plt.162.1530107957371; Wed, 27 Jun 2018 06:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530107957; cv=none; d=google.com; s=arc-20160816; b=duqOnDxGz08magOTane04NmhV35cs+qKQsGZbpKd+NZjZBd52w3dDsSUNbI++eVUA7 x1Y5JeEP+l8UtJdcwRqlsuUii+1/JQABwn4Cew5rUVGEk/AKdTSOkTkoNYxU9sv+Fugq q+kCQHef/YOnLGQ5A9OMllGj/V1nPXBWEYCem5NWLw9D4VPpTtxHiLR5dfyBaM/v73uV o5N8ig/+O0aGlsK8XN3aOWCYiOBPd9eq3wORVM+9NfpLOoKKJNIeYHsB4mbzfT3slve8 rivmDMSfUoJK8ALdeCffhDeXCRcNxC67cxwnNvUO8ToHC1XGQVQrTQTU+HQ8pd5aMXA5 kf+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=I4/85DGOxEVy2GfUkQQzfOl2ywWOctDmAXBqGoyEAOs=; b=FWHecuQwUJrsa30QH3r+oxlKk1ehFMKfAn9cL+8qTDQ+u0PhCMmnr5DAHJ2gyKfYsM qjeai7z7Sf96SKa+VnpPpTe/ZaHlcTCEcLSaLzKz5AspW9k8W8XE+MzMSjajzq47TBWy osCVNjBwfMj93dUfM1rusAa4USkQeReWssLrK1tCO6vMthilN1zR7S7/Yn4yl3dIBZqb rAQN6i+652x3MIU63P2qDQz/6V0p3mAE5LP8GEEOYuG3LrIz+mVGZ8TooaRMraYgAWUV VuFPweKoY/53WNiDjv2f5PxciJIehzTey5r3uJyiL+LLUS+xXMb+ESGjnFkIe1S6IizM x+PA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3-v6si3943708pld.229.2018.06.27.06.59.02; Wed, 27 Jun 2018 06:59:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965061AbeF0Mq2 (ORCPT + 99 others); Wed, 27 Jun 2018 08:46:28 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57302 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S964963AbeF0Mq0 (ORCPT ); Wed, 27 Jun 2018 08:46:26 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7FE6D4023337; Wed, 27 Jun 2018 12:46:25 +0000 (UTC) Received: from localhost (ovpn-12-44.pek2.redhat.com [10.72.12.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD7742026D5B; Wed, 27 Jun 2018 12:46:17 +0000 (UTC) From: Ming Lei To: Jens Axboe , Christoph Hellwig , Kent Overstreet Cc: David Sterba , Huang Ying , Mike Snitzer , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Theodore Ts'o , "Darrick J . Wong" , Coly Li , Filipe Manana , Randy Dunlap , Christoph Hellwig Subject: [PATCH V7 02/24] bcache: don't clone bio in bch_data_verify Date: Wed, 27 Jun 2018 20:45:26 +0800 Message-Id: <20180627124548.3456-3-ming.lei@redhat.com> In-Reply-To: <20180627124548.3456-1-ming.lei@redhat.com> References: <20180627124548.3456-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 27 Jun 2018 12:46:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 27 Jun 2018 12:46:25 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ming.lei@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoph Hellwig We immediately overwrite the biovec array, so instead just allocate a new bio and copy over the disk, setor and size. Acked-by: Coly Li Reviewed-by: Ming Lei 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; -- 2.9.5