From patchwork Sat Oct 29 08:08:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9403465 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 E9DCE601C0 for ; Sat, 29 Oct 2016 08:33:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D56F42A6A0 for ; Sat, 29 Oct 2016 08:33:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8F2D2A6BD; Sat, 29 Oct 2016 08:33:12 +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 5A22D2A6A0 for ; Sat, 29 Oct 2016 08:33:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932585AbcJ2Icf (ORCPT ); Sat, 29 Oct 2016 04:32:35 -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 Received: by mail-pf0-f194.google.com with SMTP id u84so3374601pfj.1; Sat, 29 Oct 2016 01:12:25 -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=TcTDT4/B52q8BLPwxFWAFCyk7Zysn8YxWWM9YZ/yxfk=; b=h/e0V6dQWUH1awJbN5bc0FV5iK66nN04JvYDW5An5V4aYFz+ohZYHn0NuP7PoMHlqp jMzHUHD2gSkjs/6jHMwbC64ZfRwGV4gnPjJBvkZNjJwG0cNv/F26cVfSynXnQdk67yp8 CriBw06ITbUKkSpImGlT+HYagCruKpEwJLirEFNr+1y7iQxCUghFRUGmCEHhTu7Dh8ia TZVLVKPg6jFnqccu/oH1CtJ9JJ6FKbT4ivs7Ud7aEryRxIWa1WqGWWMu7UZrxsrsHZBK SHGZOvAPAjBFYN9uGwPNBGhhHRW2gO06Bmo058axNS8N/cv13W17/wjNsi3e68NlXB6A PIqw== 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=TcTDT4/B52q8BLPwxFWAFCyk7Zysn8YxWWM9YZ/yxfk=; b=mGr2z5Rc3VI1rMfjVABoe/N6iXY2oQ+AIeWet52YroVa1D6OSCcLyiAH7zq091IMSp JpQE5YbsgUS0dJDabVpdhfR0/I3/D34kShcC2sS0yvrps+szKaUlJPmooJcQlUix7YH6 +mdrHMCjDzLWE/5MYy8Wr9RghzZOEskcNZzNqkd1u5mlKcd932Qc9wx0IeYFJoe/63iD uFrzwjEtZ7AUIbw/0ZauKlm7779I1Ira6UQKJLsZbZny3XkheqXCJv0Vx74tsZWakTpN K1SMouwrg3/yCpqi37wf9AC9vSDqnYxxi7ndjVNr6rpTrFkSKIPv9S57XeiW+dfFhBxJ W+4w== X-Gm-Message-State: ABUngvd1ju2fRSPQxiWbCrLtfNHiTMlMN6ODdYwB15cxueeUQCsBYt3KHdEfDDvSj2cChg== X-Received: by 10.99.66.130 with SMTP id p124mr26341848pga.30.1477728745469; Sat, 29 Oct 2016 01:12:25 -0700 (PDT) Received: from localhost ([45.34.23.101]) by smtp.gmail.com with ESMTPSA id g27sm7711592pfj.46.2016.10.29.01.12.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Oct 2016 01:12:24 -0700 (PDT) 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-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 --- 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);