From patchwork Fri Nov 11 12:05:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9422903 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 EE52560233 for ; Fri, 11 Nov 2016 12:08:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0E7D299EE for ; Fri, 11 Nov 2016 12:08:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5B9E29A14; Fri, 11 Nov 2016 12:08:54 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 859CF299EE for ; Fri, 11 Nov 2016 12:08:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756353AbcKKMGw (ORCPT ); Fri, 11 Nov 2016 07:06:52 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33235 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756276AbcKKMGs (ORCPT ); Fri, 11 Nov 2016 07:06:48 -0500 Received: by mail-pf0-f193.google.com with SMTP id 144so2418240pfv.0; Fri, 11 Nov 2016 04:06:47 -0800 (PST) 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=CMGIiEu16W1krh3oFg0odzDInoEgWRLO/xEy++cWPTo=; b=ibnFyUqLShnsuA91DFUZZdp9JnsFFFqTutXmF0wwh/bW3pPzvEy+/QGLcVMzMF96qt E1IGkbp/A2vNVJBjZCc86c8c8dEqX7BvwBjU2sU/+hcK4faOyq7t5i9NjE8zUQzLEwZz QFsDWklbi4AJUnX5fd7p4BZnTh2lIYOpJo8qd8RIIJyYGO84REES0b54X58eQMUg8+NC aRmmS/0mCHwQDDcAy8iflmvBItuqXsVoIXJCdmQvssXAXy0LtveSRDY8xPHLvLvfhaqK ysJ3hzIa7jUMmpNQ3pQ/rfZVoQeU/asnxMzg0AyRY27A3KQJxCAlaEADP0xK8smgB8Lr JcDA== 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=CMGIiEu16W1krh3oFg0odzDInoEgWRLO/xEy++cWPTo=; b=VFYYtRj/QvRwZ+gepq5rvljr2CY3Ti6pp665nN4a69udFWmCvnLaa1busAQhdw/F/L UouJaFsV+S0UYipIm7GMt7uSNzQHoqNxWJkT7m1PHZcmgwgpI5UK2NbXJAuwYyj9Nits 6pJ710PsyvBsIZtNLr/FvlGF/7+doZRbX56kilZU57pvL5eKOFnZvJjv9fU69MvCUQR0 ZUxSbO0aBUXzy9NjaAvBcTeaQ6rJLKtuJ/maPe+l+QLz0PcSUN/CRUQyIsKQ/Dakwj0+ PKak92XkyY2FfOV495xFBtWhev871OkOYeu0ruPKimAlOB7CIvQO42D7r4mPtuj4nDVE XxzA== X-Gm-Message-State: ABUngvfvaZiltfwVPKzhZgWEsdlQ6kXU47Chs4CCQtTmOZU2PXdbwdtyVloPrEIHTfxJjQ== X-Received: by 10.98.202.211 with SMTP id y80mr6391025pfk.154.1478866007247; Fri, 11 Nov 2016 04:06:47 -0800 (PST) Received: from localhost ([45.34.23.101]) by smtp.gmail.com with ESMTPSA id ql3sm3540749pac.43.2016.11.11.04.06.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Nov 2016 04:06:46 -0800 (PST) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , Ming Lei , Kent Overstreet , Shaohua Li , Mike Christie , 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 05/12] bcache: debug: avoid to access .bi_io_vec directly Date: Fri, 11 Nov 2016 20:05:33 +0800 Message-Id: <1478865957-25252-6-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478865957-25252-1-git-send-email-tom.leiming@gmail.com> References: <1478865957-25252-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-Virus-Scanned: ClamAV using ClamSMTP Instead we use standard iterator way to do that. Signed-off-by: Ming Lei Reviewed-by: Christoph Hellwig --- 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 1c9130ae0073..06f55056aaae 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);