From patchwork Tue Apr 5 11:56:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 8750511 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CAC089F336 for ; Tue, 5 Apr 2016 12:05:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D3B04203AB for ; Tue, 5 Apr 2016 12:05:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 567F2200ED for ; Tue, 5 Apr 2016 12:05:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757989AbcDEMEp (ORCPT ); Tue, 5 Apr 2016 08:04:45 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:35937 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758322AbcDEMAa (ORCPT ); Tue, 5 Apr 2016 08:00:30 -0400 Received: by mail-pf0-f194.google.com with SMTP id q129so1170526pfb.3; Tue, 05 Apr 2016 05:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1mXLaENVppmut42JhFTalGVOCfPlSGDek8x7Y2w12uQ=; b=k55axshZulAjpBtYtyS6dxWH6a8LAVWP9qoCvQ1/iFV66r4J1wgYSYiND30AA/U02k vMX0mJNft9Iz94X58UcbLhYJNKm7srUBp8+d7BghrlIo5QK1kASSc73z6uH9K5ltqEjy 2G/Nf+F5LD9aFe3uRqy7Nax4ODQZzIcVsQAGUAc+2Jpa5CDFxSMPcUerDQBf8So4IFgL NbCS48ZMaXgxL/E/IrMIWkPTzZGUccvi1K2Xv7EXs382sVnKy1RW4zFQP8uyf2B1vFwy YHqTanu4Cer9/eiFMvJZCCbPN0ojz+1CHXmWkH+HzdoLEGHsHhMdHOX8xCs1w84DTU3F 7b+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1mXLaENVppmut42JhFTalGVOCfPlSGDek8x7Y2w12uQ=; b=MNcyICo/f1pGwisOqX/eirVy2LNVkoMIdUSDQBGpcK/LYP+fxsiUSLoqPnfrFe8dRl CKQEPiL8s4yAAVD/CIvt9SiJf/o7FWrCwr4D/O+YJN0B1ZI8DgHnsW+Bl8RPccp1sgu4 m7uU1H0m4fKiDLawRgZ/aboMSAJO2XhuRS2Fi1LNXejI2/xcaaOQ7EE4wCuiwKAJc7IO KfjKIXTv2eroK+RU/XHHpE1a0WXimTs5lbahuYahzE3QsrIRHPrwhmyPiCg9MlAtAETY DOT0XRRapjXwmtvok42qGSdWZENanUlZGveNIaYo6+YEX0VPHtXnYBJ9NTsljKqoS3/c NTUw== X-Gm-Message-State: AD7BkJIbNz/V/ap99tEXi9sf3GBtKUthQcuYDciamBJjhC0/UaMXGgb7wrfnXeqzec/1rA== X-Received: by 10.98.74.6 with SMTP id x6mr28632100pfa.80.1459857624675; Tue, 05 Apr 2016 05:00:24 -0700 (PDT) Received: from localhost (56.34.213.162.lcy-01.canonistack.canonical.com. [162.213.34.56]) by smtp.gmail.com with ESMTPSA id 17sm46545554pfs.40.2016.04.05.05.00.20 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 05 Apr 2016 05:00:24 -0700 (PDT) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Boaz Harrosh , Ming Lei , Kent Overstreet , Shaohua Li , linux-bcache@vger.kernel.org (open list:BCACHE (BLOCK LAYER CACHE)), linux-raid@vger.kernel.org (open list:SOFTWARE RAID (Multiple Disks) SUPPORT) Subject: [PATCH 10/27] bcache: debug: avoid to access .bi_io_vec directly Date: Tue, 5 Apr 2016 19:56:55 +0800 Message-Id: <1459857443-20611-11-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1459857443-20611-1-git-send-email-tom.leiming@gmail.com> References: <1459857443-20611-1-git-send-email-tom.leiming@gmail.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead we use standard iterator way to do that. Signed-off-by: Ming Lei --- drivers/md/bcache/debug.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c index 8b1f1d5..d1ad49d 100644 --- a/drivers/md/bcache/debug.c +++ b/drivers/md/bcache/debug.c @@ -106,8 +106,8 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio) { char name[BDEVNAME_SIZE]; struct bio *check; - struct bio_vec bv, *bv2; - struct bvec_iter iter; + struct bio_vec bv, cbv, *bv2; + struct bvec_iter iter, citer = { 0 }; int i; check = bio_clone(bio, GFP_NOIO); @@ -119,9 +119,13 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio) submit_bio_wait(READ_SYNC, check); + citer.bi_size = UINT_MAX; bio_for_each_segment(bv, bio, iter) { void *p1 = kmap_atomic(bv.bv_page); - void *p2 = page_address(check->bi_io_vec[iter.bi_idx].bv_page); + void *p2; + + cbv = bio_iter_iovec(check, citer); + p2 = page_address(cbv.bv_page); cache_set_err_on(memcmp(p1 + bv.bv_offset, p2 + bv.bv_offset, @@ -132,6 +136,7 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio) (uint64_t) bio->bi_iter.bi_sector); kunmap_atomic(p1); + bio_advance_iter(check, &citer, bv.bv_len); } bio_for_each_segment_all(bv2, check, i)