From patchwork Fri Feb 17 14:43:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 9579997 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 B2734600F6 for ; Fri, 17 Feb 2017 14:44:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2FF4286F3 for ; Fri, 17 Feb 2017 14:44:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98215286F7; Fri, 17 Feb 2017 14:44:48 +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 3688E286F3 for ; Fri, 17 Feb 2017 14:44:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934471AbdBQOoV (ORCPT ); Fri, 17 Feb 2017 09:44:21 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:33811 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934408AbdBQOoT (ORCPT ); Fri, 17 Feb 2017 09:44:19 -0500 Received: by mail-wr0-f193.google.com with SMTP id c4so5516988wrd.1 for ; Fri, 17 Feb 2017 06:44:18 -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=mMAeAlzAOLjRP7nzT3NP2R3cbCGxvVh0G9WOmUlneHw=; b=FQ87zFQ2FqzCB4Ehr28ifkuyX18PCSpmlXdJusDDqDZTGqJZbnJh2PmKn/qbMSufFk GLAUt8YYucUdLIx1iIuCVYd4GjqNRk/rKoecP3gUufhIU/Ffy+16ikfFNCHMcCUyj+Fz OTHNMjy2jgoAPIycw0QUxmpfoxpezMEwWFyBpkKN6tb6M7t//UB+TWuAbfx+13Db6f+F F+yhaolxcke32BzLYe1BGmkYiMRxHtvP/hD67YkBABugVibSNReSmAUsISFiaiioO3Ka f5e1RR+VRL2arG3dbTAw3IVSXrJR1ptSzWufpFcboMIn5gvEHJ2JnpbgWMbx58SoIMIP Lb7w== 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=mMAeAlzAOLjRP7nzT3NP2R3cbCGxvVh0G9WOmUlneHw=; b=PGhsb4BEMywztzx77UqC09AO1w7LN6/efPOqCykv51QUa9hoCiid16SajXZUBPbNTV lgb2kLN8fetjkEdN41GkUx0x0rOIN+kHQ5GF4gRlsaQBm/3uu4rhLLYvnt/wIONkIvux e8ssi5lXBmaTghC7XK1I/fLz4lZGmqZ8dLSkL3bAPK71AHAhlS9fmqqBZ/l4jCLUDMUQ SWPsrbPBlGNaf1qrpXwDIhUBFVk0IMoyhJKf9enC8AZXPGbWiV43QGIJFqbipypvdhHc wa+wkatS/WLDEqyL6owqxlKaq69ehFvUHKlVM3EcxdeCbgDuPLxl1EKb7ibPPyoguPnm aRQw== X-Gm-Message-State: AMke39kzPIU2+yxbB8cBFWCJIVMgc+GzloujARJLCRkPVCpirPHhXkzqD+OR+1A5U5j5Wg== X-Received: by 10.223.131.193 with SMTP id 59mr6524983wre.186.1487342652797; Fri, 17 Feb 2017 06:44:12 -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.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Feb 2017 06:44:12 -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 26/38] btrfs: make repair_io_failure take btrfs_inode Date: Fri, 17 Feb 2017 16:43:17 +0200 Message-Id: <1487342609-20652-27-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 | 10 +++++----- fs/btrfs/extent_io.h | 4 ++-- fs/btrfs/scrub.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 0e73e48a9c4c..a405f63f7053 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -1992,10 +1992,10 @@ int free_io_failure(struct btrfs_inode *inode, struct io_failure_record *rec) * currently, there can be no more than two copies of every data bit. thus, * exactly one rewrite is required. */ -int repair_io_failure(struct inode *inode, u64 start, u64 length, u64 logical, +int repair_io_failure(struct btrfs_inode *inode, u64 start, u64 length, u64 logical, struct page *page, unsigned int pg_offset, int mirror_num) { - struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info; + struct btrfs_fs_info *fs_info = inode->root->fs_info; struct bio *bio; struct btrfs_device *dev; u64 map_length = 0; @@ -2054,7 +2054,7 @@ int repair_io_failure(struct inode *inode, u64 start, u64 length, u64 logical, btrfs_info_rl_in_rcu(fs_info, "read error corrected: ino %llu off %llu (dev %s sector %llu)", - btrfs_ino(BTRFS_I(inode)), start, + btrfs_ino(inode), start, rcu_str_deref(dev->name), sector); btrfs_bio_counter_dec(fs_info); bio_put(bio); @@ -2074,7 +2074,7 @@ int repair_eb_io_failure(struct btrfs_fs_info *fs_info, for (i = 0; i < num_pages; i++) { struct page *p = eb->pages[i]; - ret = repair_io_failure(fs_info->btree_inode, start, + ret = repair_io_failure(BTRFS_I(fs_info->btree_inode), start, PAGE_SIZE, start, p, start - page_offset(p), mirror_num); if (ret) @@ -2133,7 +2133,7 @@ int clean_io_failure(struct inode *inode, u64 start, struct page *page, num_copies = btrfs_num_copies(fs_info, failrec->logical, failrec->len); if (num_copies > 1) { - repair_io_failure(inode, start, failrec->len, + repair_io_failure(BTRFS_I(inode), start, failrec->len, failrec->logical, page, pg_offset, failrec->failed_mirror); } diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 5b4132a9093a..a3b13b4385bc 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h @@ -451,8 +451,9 @@ struct bio *btrfs_io_bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs); struct bio *btrfs_bio_clone(struct bio *bio, gfp_t gfp_mask); struct btrfs_fs_info; +struct btrfs_inode; -int repair_io_failure(struct inode *inode, u64 start, u64 length, u64 logical, +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, @@ -480,7 +481,6 @@ 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, diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 82d873406aa3..bdf58b0eaef8 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -731,7 +731,7 @@ static int scrub_fixup_readpage(u64 inum, u64 offset, u64 root, void *fixup_ctx) ret = -EIO; goto out; } - ret = repair_io_failure(inode, offset, PAGE_SIZE, + ret = repair_io_failure(BTRFS_I(inode), offset, PAGE_SIZE, fixup->logical, page, offset - page_offset(page), fixup->mirror_num);