From patchwork Fri May 5 15:57:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9713885 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 BAC91602B9 for ; Fri, 5 May 2017 15:57:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACE5C2844C for ; Fri, 5 May 2017 15:57:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1B1F28617; Fri, 5 May 2017 15:57:26 +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_SIGNED, 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 110E02844C for ; Fri, 5 May 2017 15:57:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752387AbdEEP5Y (ORCPT ); Fri, 5 May 2017 11:57:24 -0400 Received: from mail-yb0-f196.google.com ([209.85.213.196]:33093 "EHLO mail-yb0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752087AbdEEP5W (ORCPT ); Fri, 5 May 2017 11:57:22 -0400 Received: by mail-yb0-f196.google.com with SMTP id d72so341816ybh.0 for ; Fri, 05 May 2017 08:57:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=CIt7avmkVK4YwNWL8jCoZBSE5FQessOtNvpjwJA39Io=; b=yNETnwPLNbLEGHw1/dPM2cF18avo/3xPqpmT7Z/5l5cIOE5o+e3ZKl7B9ahlGdzZ1c Gra6O5KnOV0PoUpAav9jd6uqnMLGTiqLKe4jIsvCSBJRfnivs+4vrRpsTwT6mVFwzqOm UNvLzkyFzIzx4f9f89sJveVt4g8Izxuk7maIEtS4A0s83272FqVs4pmEKYSzDketP3Lh mn5Suag1qsdsQ1PLzn7dBXkXpUpYycOMGRkLpz8S76jZmRzZ4kcvCshBmijDXIURxwV8 /hwt5WbpjiGoD4xNhq/iJM5SneUs0NWtLE6dnferIGemZKBXIW1jsia9B7hlBWERib/w DXBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=CIt7avmkVK4YwNWL8jCoZBSE5FQessOtNvpjwJA39Io=; b=JtE6MaaL0vCW0VaiFjnWDVAQQg1nXuF0+L/F095tDaNupuKVCILfUWA8L0c1yJjE++ Lje4rRty6bfe1Aj/SD3wC7UUy9nV50s/RzIGHRnrPFtDDRIus0TYvX3OvLDs5JJc/DhI yJ+JdHLVDNtUL3boR4aMuGFCJrOJK8TXjZ2Jt2yzM9pr337C3St1dZjHJEGzgSihIH9z PRHsD4MXfbaOombKD86UevlP6Y7t9Zf71WwRY5U4zebQi06sVna84vGzKOemCjMOdbKd heFL46E/Y5DQH4BUz7TQ/Vtv2TSG3r7Y1/m9DdqeB8KQEhIMaxAJWBmIEVBAgIfhrcsX kc/w== X-Gm-Message-State: AN3rC/4L62LVlZy7uNcGiTE69VYdw5Z2+5vKzNO3WV4k2w4noUPQ+IWQ r6kP+SZkmTr8KZ1D X-Received: by 10.37.44.69 with SMTP id s66mr40121433ybs.84.1493999841185; Fri, 05 May 2017 08:57:21 -0700 (PDT) Received: from localhost ([2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id g15sm2515452ywk.7.2017.05.05.08.57.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 May 2017 08:57:20 -0700 (PDT) From: Josef Bacik X-Google-Original-From: Josef Bacik To: linux-btrfs@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 2/3] btrfs: remove inode argument from repair_io_failure Date: Fri, 5 May 2017 11:57:14 -0400 Message-Id: <1493999835-26731-3-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493999835-26731-1-git-send-email-jbacik@fb.com> References: <1493999835-26731-1-git-send-email-jbacik@fb.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 Once we remove the btree_inode we won't have an inode to pass anymore, just pass the fs_info directly and the inum since we use that to print out the repair message. Signed-off-by: Josef Bacik Reviewed-by: Chandan Rajendra Reviewed-by: David Sterba --- fs/btrfs/extent_io.c | 16 +++++++--------- fs/btrfs/extent_io.h | 6 +++--- fs/btrfs/scrub.c | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index acc7c68..de6f890 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -1972,11 +1972,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 btrfs_inode *inode, u64 start, u64 length, - u64 logical, struct page *page, - unsigned int pg_offset, int mirror_num) +int repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start, + u64 length, u64 logical, struct page *page, + unsigned int pg_offset, int mirror_num) { - struct btrfs_fs_info *fs_info = inode->root->fs_info; struct bio *bio; struct btrfs_device *dev; u64 map_length = 0; @@ -2035,7 +2034,7 @@ int repair_io_failure(struct btrfs_inode *inode, u64 start, u64 length, btrfs_info_rl_in_rcu(fs_info, "read error corrected: ino %llu off %llu (dev %s sector %llu)", - btrfs_ino(inode), start, + ino, start, rcu_str_deref(dev->name), sector); btrfs_bio_counter_dec(fs_info); bio_put(bio); @@ -2055,8 +2054,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(BTRFS_I(fs_info->btree_inode), start, - PAGE_SIZE, start, p, + ret = repair_io_failure(fs_info, 0, start, PAGE_SIZE, start, p, start - page_offset(p), mirror_num); if (ret) break; @@ -2114,8 +2112,8 @@ int clean_io_failure(struct btrfs_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, - failrec->logical, page, + repair_io_failure(fs_info, btrfs_ino(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 e4e01d1..fd04124 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h @@ -467,9 +467,9 @@ struct bio *btrfs_bio_clone(struct bio *bio, gfp_t gfp_mask); struct btrfs_fs_info; 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 repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start, + u64 length, u64 logical, struct page *page, + unsigned int pg_offset, int mirror_num); 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); diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index b0251eb..594d5c4 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(BTRFS_I(inode), offset, PAGE_SIZE, + ret = repair_io_failure(fs_info, inum, offset, PAGE_SIZE, fixup->logical, page, offset - page_offset(page), fixup->mirror_num);