Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757056AbcJ2Ick (ORCPT ); Sat, 29 Oct 2016 04:32:40 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34108 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756777AbcJ2IM0 (ORCPT ); Sat, 29 Oct 2016 04:12:26 -0400 From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , "Kirill A . Shutemov" , Ming Lei , Kent Overstreet , Shaohua Li , Mike Christie , Hannes Reinecke , Guoqing Jiang , 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 06/60] bcache: debug: avoid to access .bi_io_vec directly Date: Sat, 29 Oct 2016 16:08:05 +0800 Message-Id: <1477728600-12938-7-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> References: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1347 Lines: 47 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 333a1e5f6ae6..430f3050663c 100644 --- a/drivers/md/bcache/debug.c +++ b/drivers/md/bcache/debug.c @@ -107,8 +107,8 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio) { char name[BDEVNAME_SIZE]; struct bio *check; - struct bio_vec bv; - struct bvec_iter iter; + struct bio_vec bv, cbv; + struct bvec_iter iter, citer = { 0 }; check = bio_clone(bio, GFP_NOIO); if (!check) @@ -120,9 +120,13 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio) submit_bio_wait(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, @@ -133,6 +137,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_free_pages(check); -- 2.7.4