From patchwork Fri Feb 17 14:43:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 9579979 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 01473600F6 for ; Fri, 17 Feb 2017 14:44:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5EC7286F3 for ; Fri, 17 Feb 2017 14:44:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB060286F7; Fri, 17 Feb 2017 14:44:21 +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 72786286F3 for ; Fri, 17 Feb 2017 14:44:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934508AbdBQOoT (ORCPT ); Fri, 17 Feb 2017 09:44:19 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34162 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934382AbdBQOoQ (ORCPT ); Fri, 17 Feb 2017 09:44:16 -0500 Received: by mail-wm0-f66.google.com with SMTP id c85so2931907wmi.1 for ; Fri, 17 Feb 2017 06:44:15 -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=LhiuXBeDlyE2PdmpTOqFU8SwX5VjBU/1KVZXoB5AuGs=; b=ZjEpTwKK/jz5ZzFuaLowCUJR96kG/GbCgW6Fvw5pL9kH9eqBrbFWBWt14uw2/wcnIx txDZ2lmcc3qJSWd5zqRwTuyVI10hU2T1L2785wUCG6I/zF0jOoIV8f4BulF2EMW5C+a7 1wKNZRMH/ylh71eheZfDvGZ8euMUDI6nb3+4WUFIkGPji+4Pcg+L9GijjvJAGy//5/Oi uLO06IO1WctBKMwbzETBq+6+mcNkBMtvsv19R4ACVQay+I4gyNsL4FHKZlwzjXi2M4EH n2a+pusubvCAvajhMy9Sbcrn0wW+YG3IS0uVXhnnVpIj9W0zb1o4exWmUrK/fCdmNJLX 0Icw== 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=LhiuXBeDlyE2PdmpTOqFU8SwX5VjBU/1KVZXoB5AuGs=; b=K01ozbY5GNMidFVFSqpzy4szDOicl9kammAW/APb8Z64TRHjUn0obmTDzS7MIB32gv TgXDoW3qGODJO4Xt94BaNIZ69dihgq5hw2Jx6aIU1l430D3P1NjyMEWDjRN3i/LkQ365 J4+S/DMRd71P+C75d6kolagqZUkIl2vHpz895EXKOJvX6ZZijZWy1fYyQh3JRPLFIFnk oKXWUNN4JpEH8spZdqsoJa0WH930dMEH6c6VPh9KvkccIvU4UuFJ/hpehaxpHyN0HoA8 E0QWLg0RY+vObGKf1YSqyPxQZ0FX5/ebzY+qQRLf6EnYGzX+yRnxUg4pF/14RVOB/gkv NSLg== X-Gm-Message-State: AMke39nYWbLqeQZxXMWaGm1jqSxmjaQbfUv6NOT8hOTzlD21RJR0EUFlPJ207KZEYTphGw== X-Received: by 10.28.30.12 with SMTP id e12mr2424162wme.125.1487342650113; Fri, 17 Feb 2017 06:44:10 -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.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Feb 2017 06:44:09 -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 23/38] btrfs: make free_io_failure take btrfs_inode Date: Fri, 17 Feb 2017 16:43:14 +0200 Message-Id: <1487342609-20652-24-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 | 14 +++++++------- fs/btrfs/extent_io.h | 4 +++- fs/btrfs/inode.c | 6 +++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 996306d322de..0e73e48a9c4c 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -1959,11 +1959,11 @@ static void check_page_uptodate(struct extent_io_tree *tree, struct page *page) SetPageUptodate(page); } -int free_io_failure(struct inode *inode, struct io_failure_record *rec) +int free_io_failure(struct btrfs_inode *inode, struct io_failure_record *rec) { int ret; int err = 0; - struct extent_io_tree *failure_tree = &BTRFS_I(inode)->io_failure_tree; + struct extent_io_tree *failure_tree = &inode->io_failure_tree; set_state_failrec(failure_tree, rec->start, NULL); ret = clear_extent_bits(failure_tree, rec->start, @@ -1972,7 +1972,7 @@ int free_io_failure(struct inode *inode, struct io_failure_record *rec) if (ret) err = ret; - ret = clear_extent_bits(&BTRFS_I(inode)->io_tree, rec->start, + ret = clear_extent_bits(&inode->io_tree, rec->start, rec->start + rec->len - 1, EXTENT_DAMAGED); if (ret && !err) @@ -2140,7 +2140,7 @@ int clean_io_failure(struct inode *inode, u64 start, struct page *page, } out: - free_io_failure(inode, failrec); + free_io_failure(BTRFS_I(inode), failrec); return 0; } @@ -2393,7 +2393,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, ret = btrfs_check_repairable(inode, failed_bio, failrec, failed_mirror); if (!ret) { - free_io_failure(inode, failrec); + free_io_failure(BTRFS_I(inode), failrec); return -EIO; } @@ -2406,7 +2406,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, (int)phy_offset, failed_bio->bi_end_io, NULL); if (!bio) { - free_io_failure(inode, failrec); + free_io_failure(BTRFS_I(inode), failrec); return -EIO; } bio_set_op_attrs(bio, REQ_OP_READ, read_mode); @@ -2418,7 +2418,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, ret = tree->ops->submit_bio_hook(inode, bio, failrec->this_mirror, failrec->bio_flags, 0); if (ret) { - free_io_failure(inode, failrec); + free_io_failure(BTRFS_I(inode), failrec); bio_put(bio); } diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 270d03be290e..5b4132a9093a 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h @@ -480,6 +480,8 @@ struct io_failure_record { int in_validation; }; +struct btrfs_inode; + void btrfs_free_io_failure_record(struct inode *inode, u64 start, u64 end); int btrfs_get_io_failure_record(struct inode *inode, u64 start, u64 end, struct io_failure_record **failrec_ret); @@ -489,7 +491,7 @@ struct bio *btrfs_create_repair_bio(struct inode *inode, struct bio *failed_bio, struct io_failure_record *failrec, struct page *page, int pg_offset, int icsum, bio_end_io_t *endio_func, void *data); -int free_io_failure(struct inode *inode, struct io_failure_record *rec); +int free_io_failure(struct btrfs_inode *inode, struct io_failure_record *rec); #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS noinline u64 find_lock_delalloc_range(struct inode *inode, struct extent_io_tree *tree, diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8c03abf69ac8..8c22820b6b0a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -7852,7 +7852,7 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio, ret = btrfs_check_dio_repairable(inode, failed_bio, failrec, failed_mirror); if (!ret) { - free_io_failure(inode, failrec); + free_io_failure(BTRFS_I(inode), failrec); return -EIO; } @@ -7866,7 +7866,7 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio, bio = btrfs_create_repair_bio(inode, failed_bio, failrec, page, pgoff, isector, repair_endio, repair_arg); if (!bio) { - free_io_failure(inode, failrec); + free_io_failure(BTRFS_I(inode), failrec); return -EIO; } bio_set_op_attrs(bio, REQ_OP_READ, read_mode); @@ -7877,7 +7877,7 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio, ret = submit_dio_repair_bio(inode, bio, failrec->this_mirror); if (ret) { - free_io_failure(inode, failrec); + free_io_failure(BTRFS_I(inode), failrec); bio_put(bio); }