From patchwork Fri Feb 17 14:43:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 9579977 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 AC8AD600F6 for ; Fri, 17 Feb 2017 14:44:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CA55286F3 for ; Fri, 17 Feb 2017 14:44:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9172A286F7; Fri, 17 Feb 2017 14:44:20 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 891B2286F5 for ; Fri, 17 Feb 2017 14:44:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934542AbdBQOoQ (ORCPT ); Fri, 17 Feb 2017 09:44:16 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:33710 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934526AbdBQOoP (ORCPT ); Fri, 17 Feb 2017 09:44:15 -0500 Received: by mail-wr0-f193.google.com with SMTP id i10so5520665wrb.0 for ; Fri, 17 Feb 2017 06:44:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=u2RaWLZA48U/5lwLAnQQ/ARrFjuVvpDWyY/Vtm/yQK8=; b=foasTS9sOOd60Bf8+xJei1XrXrZW00wuHXbXBG2SeLrUW9BYjvBmSiukdnfYsQC9ui LCEMXL47NmOgqZPh4/DmPHgsWuUWvyUCq6IZPPyRAuboUBzudV7Q27NMYvEc08Ji9C11 aBFl4IhLGNJ3wr/S8PR65sIMwNX78aQrxC4+tlhyOk5voEHuAvPRwk/slbnRZnXa/VRN rwbVJaw+R0GsAK6Yfu+IgCUsFTooYp7ml370mpIHZ84F2/wzZJcHwjyFmfsA8waD8bvH VF7j6z/lj0q62NcTdBv5RevMfeH+Xyn5PIeeHfXkRSwDtlxpe0OpinjlF6nQLkRxSTR/ B55A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=u2RaWLZA48U/5lwLAnQQ/ARrFjuVvpDWyY/Vtm/yQK8=; b=uDgvujHvTdPeuIz4uYspqq+eLwVompJ76pnNG4M1C95UzJ8ICTtTu+XZv9Fswa24no WndQ04afLUlVnF/S8dCeVaEEt83MUSobspBsWYP0hK4KNuf/O57puKh5DGGiK52LKjCH 2OitC/gVg0t/WXE0Gbk0Qr9gcyPtv85YzoJBcRM54Hivqpq6OJFIR8WUnp0XaqS9HdQJ c2gW1dh5vq57UiOp89glRQrO7QrB7Zxgs86kDCydGIXIEYzOw/XVAJ9DMng58WkyXzCD NgpIABPIe/f63elzZ1LMgkC09q9GdoSvfgcrfV2Tob5XPuqI1FYoZd9Kl4AVCNYeB6TI SQLQ== X-Gm-Message-State: AMke39mCxqN2/2auBvAB0hTUdyicqxBhgqb8W9dGbvUUxadpEZCpJj7pmR7r5jnbfarsFQ== X-Received: by 10.223.145.4 with SMTP id j4mr6928797wrj.101.1487342653709; Fri, 17 Feb 2017 06:44:13 -0800 (PST) Received: from fisk.suse.de (ivokamhome.ddns.nbis.net. [87.120.136.31]) by smtp.gmail.com with ESMTPSA id y126sm1932713wmg.19.2017.02.17.06.44.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Feb 2017 06:44:13 -0800 (PST) From: Nikolay Borisov X-Google-Original-From: Nikolay Borisov To: dsterba@suse.com Cc: linux-btrfs@vger.kernel.org, Nikolay Borisov Subject: [PATCH 27/38] btrfs: make clean_io_failure take btrfs_inode Date: Fri, 17 Feb 2017 16:43:18 +0200 Message-Id: <1487342609-20652-28-git-send-email-nborisov@suse.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487342609-20652-1-git-send-email-nborisov@suse.com> References: <1487342609-20652-1-git-send-email-nborisov@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Nikolay Borisov --- fs/btrfs/extent_io.c | 20 ++++++++++---------- fs/btrfs/extent_io.h | 2 +- fs/btrfs/inode.c | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index a405f63f7053..16860ab7cb5e 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2089,23 +2089,23 @@ int repair_eb_io_failure(struct btrfs_fs_info *fs_info, * each time an IO finishes, we do a fast check in the IO failure tree * to see if we need to process or clean up an io_failure_record */ -int clean_io_failure(struct inode *inode, u64 start, struct page *page, +int clean_io_failure(struct btrfs_inode *inode, u64 start, struct page *page, unsigned int pg_offset) { u64 private; struct io_failure_record *failrec; - struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info; + struct btrfs_fs_info *fs_info = inode->root->fs_info; struct extent_state *state; int num_copies; int ret; private = 0; - ret = count_range_bits(&BTRFS_I(inode)->io_failure_tree, &private, + ret = count_range_bits(&inode->io_failure_tree, &private, (u64)-1, 1, EXTENT_DIRTY, 0); if (!ret) return 0; - ret = get_state_failrec(&BTRFS_I(inode)->io_failure_tree, start, + ret = get_state_failrec(&inode->io_failure_tree, start, &failrec); if (ret) return 0; @@ -2122,25 +2122,25 @@ int clean_io_failure(struct inode *inode, u64 start, struct page *page, if (fs_info->sb->s_flags & MS_RDONLY) goto out; - spin_lock(&BTRFS_I(inode)->io_tree.lock); - state = find_first_extent_bit_state(&BTRFS_I(inode)->io_tree, + spin_lock(&inode->io_tree.lock); + state = find_first_extent_bit_state(&inode->io_tree, failrec->start, EXTENT_LOCKED); - spin_unlock(&BTRFS_I(inode)->io_tree.lock); + spin_unlock(&inode->io_tree.lock); if (state && state->start <= failrec->start && state->end >= failrec->start + failrec->len - 1) { num_copies = btrfs_num_copies(fs_info, failrec->logical, failrec->len); if (num_copies > 1) { - repair_io_failure(BTRFS_I(inode), start, failrec->len, + repair_io_failure(inode, start, failrec->len, failrec->logical, page, pg_offset, failrec->failed_mirror); } } out: - free_io_failure(BTRFS_I(inode), failrec); + free_io_failure(inode, failrec); return 0; } @@ -2576,7 +2576,7 @@ static void end_bio_extent_readpage(struct bio *bio) if (ret) uptodate = 0; else - clean_io_failure(inode, start, page, 0); + clean_io_failure(BTRFS_I(inode), start, page, 0); } if (likely(uptodate)) diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index a3b13b4385bc..81c9f678ada5 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h @@ -456,7 +456,7 @@ struct btrfs_inode; int repair_io_failure(struct btrfs_inode *inode, u64 start, u64 length, u64 logical, struct page *page, unsigned int pg_offset, int mirror_num); -int clean_io_failure(struct inode *inode, u64 start, struct page *page, +int clean_io_failure(struct btrfs_inode *inode, u64 start, struct page *page, unsigned int pg_offset); void end_extent_writepage(struct page *page, int err, u64 start, u64 end); int repair_eb_io_failure(struct btrfs_fs_info *fs_info, diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index f71296933aec..a472d13a9ecb 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -7907,7 +7907,7 @@ static void btrfs_retry_endio_nocsum(struct bio *bio) done->uptodate = 1; bio_for_each_segment_all(bvec, bio, i) - clean_io_failure(done->inode, done->start, bvec->bv_page, 0); + clean_io_failure(BTRFS_I(done->inode), done->start, bvec->bv_page, 0); end: complete(&done->done); bio_put(bio); @@ -7993,7 +7993,7 @@ static void btrfs_retry_endio(struct bio *bio) bvec->bv_page, bvec->bv_offset, done->start, bvec->bv_len); if (!ret) - clean_io_failure(done->inode, done->start, + clean_io_failure(BTRFS_I(done->inode), done->start, bvec->bv_page, bvec->bv_offset); else uptodate = 0;