From patchwork Fri Sep 2 19:40:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9311579 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 6BB3160772 for ; Fri, 2 Sep 2016 19:41:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 588E629835 for ; Fri, 2 Sep 2016 19:41:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D53A2984D; Fri, 2 Sep 2016 19:41:51 +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_SIGNED, 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 70E5C29835 for ; Fri, 2 Sep 2016 19:41:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932783AbcIBTlq (ORCPT ); Fri, 2 Sep 2016 15:41:46 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:42638 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932780AbcIBTln (ORCPT ); Fri, 2 Sep 2016 15:41:43 -0400 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u82JZAQn010579 for ; Fri, 2 Sep 2016 12:41:43 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=AivrltvM/DdWFJOOi1TgTwHEmvYH5OH0Q7XGvWiJs50=; b=fshAjm39AF2EVvq1fdQe/FxVazdYgLeH1u9mCycEOU+aIdu+QeQwZOwOx6+gI9x3QdXf +QIGvSeZB5NM3TcHwU//Y7zJMeaX5HvUnXYvjoQKcTWguUuXGEZHEaMgoR7FpJ7Mq6mJ Wf/JJ5NCyikzw9mbcOif3YUO8uqzAyXwi10= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 257b5sst73-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 02 Sep 2016 12:41:43 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.26) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 2 Sep 2016 15:41:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=QY29BtCwbCltULZHVQ3Ed1in84P6xy2c9BU0KyoDkI0=; b=DXXocE0UmUiMkiGfaCUb7YaCRabPFFxDAGA8AFdfTh0fLugdj0FLqCMM7PqWTbZe83JHjq0TTFyHBCse0fJdD/vskUNrpsgZiuGFrnuxUOMo26PUm/qc0y4zrOACFRHeBd8j9iIfkfjfxeDpfg0qQo5teSDuTQ11vbDtfZp2dZ8= Received: from localhost (107.15.72.49) by DM5PR15MB1322.namprd15.prod.outlook.com (10.173.210.12) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.9; Fri, 2 Sep 2016 19:41:40 +0000 From: Josef Bacik To: , Subject: [PATCH 5/7] Btrfs: don't pass the inode through clean_io_failure Date: Fri, 2 Sep 2016 15:40:04 -0400 Message-ID: <1472845206-22870-6-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472845206-22870-1-git-send-email-jbacik@fb.com> References: <1472845206-22870-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 X-Originating-IP: [107.15.72.49] X-ClientProxiedBy: DM3PR14CA0038.namprd14.prod.outlook.com (10.164.193.176) To DM5PR15MB1322.namprd15.prod.outlook.com (10.173.210.12) X-MS-Office365-Filtering-Correlation-Id: 143bef6d-1b80-4ed7-2577-08d3d369290a X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1322; 2:HmxjN1F6QHsaWm45JY1e10VWeaw07VuuEORfIQ7wUNLQZrFEichk1Tk1LiyDSvV+zjv9rAuPQAO4oPYuVuMOL/JEDf/Bnk2eYyt12XcIv7OxYooCwMb2NMyPfnCyrT6hZlgy4+s3aDDsx8zpwPNV1zBSlYiC83ECXniw7OoVumw4RPYaAr2z64lHsbV3EVqy; 3:f4/1dNsZa01xog7kH/OerQ7hBb/wOCLdtTEvv16qDiG1aejx1iuty1J4VZ+RgkvvCxRpUBnc/hDIA2g8Qrn3ZjkPygBFhwOdz3O8/zOa+ZrYOe7/5srQXpA3paSRJJCn; 25:FcYsyzvGednPXLfUF1VwUeAs7sQLcmfgXDK0dNY1q+jI1/+PIqKhGdXGjBpMVWvdACaJIa9K4lxn+S3uFzRXba3eDXiShur5Kuv/7TOo/ndtmD9dFJwUlgDrTO2rWGRXlhkl3zuvjYpOfpqTSIkPwx1K8VF0Ef9CjryKE7i9x35G1GlwTFJmu0G+sS/U0glkEsGTLL4cRHm/1vHRXA4AiHup6qIPp/UiE88tFpoPWQWO0AeyGy83D5TZ5zvDK3pp0XzvxtwGENK6nZnn5uy0doHhO18gnyc/BGQXHEC/dC/EOMZgVP9A5I/DbGeGccZbcceKy6c+/x20lE7s9BL+gQn5wOizJq0Cf+GXsNzLy160T9ytI/ha4EPfRZuuGSSnWtflh2XZsQNffIRGooEkxg==; 31:n5aJ3I9zMvPCfS53OYBJ8TXZ+AdIadUUfelS9ESYowmcORiSBpkQeKUeATM5oOCmHjvylqvJ4m5wmqq0P2aE8gz3FkCC4bIjDx5QeV+u/RjGSA6CCAxzj6OCGZyYdp6BwQnracqPvsj5VLHWf5n0mw1y+S0C+yCwN6obFr2DS9SEROfAgtjizNTnQyt7AqIbcFs6y/8 rRAN8AsAsVGbhefQ+MieGwh8EhAkbNOwhwnk= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM5PR15MB1322; X-LD-Processed: 8ae927fe-1255-47a7-a2af-5f3a069daaa2,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1322; 20:PFJTfTMYLorxBVfk8tK4GY87qRLfXEb9LRZrvAuSH6ois+FyyD0BjY0/vx2c5eAG/7XfzBzRmPefWQUaJELbi8CAoGyCIaJXVOcJOhtmdXntTrC4VJBdeMnmAPs9llVSI1AQkI2JZ141OPZXxgSVq5m+6sug5ck3Z8Xutmegink=; 4:wvvimY6Dfz2aBJs/RmnH17icM0LTA3yudIw/REH/1zP8q8SvrSKar3Teu1kr+rdlK0iwZ7Icf+dP1inzxhSO2clnT3pHrTsXMe8c0PHhMrRmzPrpvv7jXIIwRhy+HYZmTR+j7hBj7JSpCAI4928LLuOq2d+bKGyW2OxMB7PkkvrJRSxY8JWjECpMha0ZJYTXCTRzQcxG1EkVC7el5aL0l4YAvvMmBwWyKTZHCRPA2/1C6wkjOXcXyOFnQ3LakhzSboihk/0+ui/Jg+CGf+q9I4HmDpCxQIJaNqmmRXMyk2ijwl7GB6BdmXSgWk4VbpueS1TsnxCz+D8AWe7XSDY40lGgMkWypw9FsV5uAZwHlwJS6mmeO0Roj6dgP3/tBoHhtce2stQzlwK/vLqSen6nuzCdziJrNNli2G7ox7uANUKQ8Cs8IN/NfenJ70FCh7eN X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:DM5PR15MB1322; BCL:0; PCL:0; RULEID:; SRVR:DM5PR15MB1322; X-Forefront-PRVS: 00531FAC2C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(7916002)(189002)(199003)(107886002)(189998001)(76506005)(105586002)(229853001)(86362001)(33646002)(450100001)(5660300001)(97736004)(8676002)(5001770100001)(50226002)(81166006)(7736002)(66066001)(81156014)(48376002)(106356001)(7846002)(19580395003)(305945005)(47776003)(586003)(101416001)(50466002)(6116002)(3846002)(2906002)(92566002)(2950100001)(77096005)(5003940100001)(68736007)(19580405001)(42186005)(76176999)(36756003)(50986999); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR15MB1322; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR15MB1322; 23:/s5jkf+pYtwPJ8Dqn3SOsAS8AU/MiO9KneQt5ltiI?= =?us-ascii?Q?fMcC/tZYPj5OGxXNvg3BTLTKC86367G5sgQ1TTYZhLHyuRWlYKuIM9aSKyv9?= =?us-ascii?Q?XgDTn/93s/y32gdDDQ/T2zx+zEfhH5y/Mi+9so5g33uR2TD34u+K7zk0B6rX?= =?us-ascii?Q?atDhCqPOIerd8ZXBE9Rwqc4WSthSljTLsQasp/Rixk6OMiNNpjjNOWsb+XiY?= =?us-ascii?Q?zNrwRCa6+wtFUbG16NLEGyZrA/xX0gcDgMbLVnuPuwNtgUpXObpOD7Kepkvw?= =?us-ascii?Q?Dk52dKr4/8A1d1q3dxKtNhi0lk7NtdRbXMb7gb/NhyZv45ez02NZhqtMuEs3?= =?us-ascii?Q?v12heBqQD3YF5eSAUvTRm6vYYTJZViOpZMe3e97RG/aXR1G481Ycp5yKP6D0?= =?us-ascii?Q?KaoY5Zl/fYaVvxGR7KNw+KDFevHXAyTlNVCIYi9neSIXQAV0cqGAQXgfq6pv?= =?us-ascii?Q?Od1W8T0CaDbXvXtKq0NjaQ04c72DqxPU1JptRqJQMF4B67aXey7rhJNvI0sv?= =?us-ascii?Q?s0tXpr1mx0XP6nnCMg86wAgW2wFwgYVOMepboSn06F22MjQpE8c0I3FZYeZo?= =?us-ascii?Q?5VySTkogBgmIweIZyn6LVHZxNoCDbaPmidFL6GgsUP/Lsi0wCJF0KuDWqXOt?= =?us-ascii?Q?DiTB3YEPEGOb+AXMtFCaRNLW5zw9oYw6miaH+IcbCPA821pY3jO8cAfkp8Nh?= =?us-ascii?Q?VFDazkJLiHTi00tuT4n2Ddw+B5aj8dR+BrNXDTvz0odOkv5YQBoWC9J4oPcc?= =?us-ascii?Q?573tAyg2WB8dLYN9mfAY48w3rAuvGzBodKopJBld/pT2KjIDcKkINqzxZVxd?= =?us-ascii?Q?/mMwmHaz8YuPn1Y7dIOJ3K3N89z8pJosOjwQoVVJeZrVsppyGQSAFO7j/Els?= =?us-ascii?Q?vRWnZDxeAW4O+ko6kKlLuIwoyyqRcDajycmv6Tx+3Wh2vmDS6eL3JwaCv+sW?= =?us-ascii?Q?Bsiel89nB0dH4fs1fR9PrKwpIYpkqOFpg6P2V7GNcHkkT1j2O9w5lxxzSm4p?= =?us-ascii?Q?FZShLK7sOjnJFv9Rf3+UV7JlIjE9wsP0ijA4x/24+SgjPkuWuibip4vCVict?= =?us-ascii?Q?M7quB6B4kj21ImxUmdQdtGVhykMeaFzuU5PmKnHYgcZi47wqeO1m3cZ5kfwy?= =?us-ascii?Q?LjanOB63cVxG8a/oIurqRwiDCjhzJ1FIS5urJIDIS5cW3G+mT1Spw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1322; 6:91xYVO4gpjGnBvO1F6lB6I12ifXE705StR4fyYQWmeyO0syeVeL/KnmUm88K2iTXMkSX2Q31txxlt4Ut2uI5S1e4S9/PxySgsAhLlJt4+WtzbpNuNl/Kn9zTuI3BL81W7/lTXHFlbHPpO4ezPWWP1j5H8tRkfADMru39jyZ7VoM3MzpioXa35Gjo3tEj1HTfQgW5Sd3Fvb/hkvYxJh+f3TrwkOOxSogQhTgaTbGhW9g629iyXKKTXrK//ytdAUOBJDUY+9Q9FtUrPDy3Yg6hChIyY1SWkmz/aHG/dOjaOp8=; 5:EgpuL9rIvC5WAGeJx99t1AVvH0tHDgb1EUSaXmRBLklMA5IQYHCMhqTFMGz1P8Eey65YqvNYFtCzXlToICS6Ugs/Fsv7UUt0UhdA4Xgex3356UMcEq3ntx7aT8D6f5Da64l8YjW5jjXo+DsGa6CO3Q==; 24:7WImHbft8nxC/TrGaaWEOG3XJF61jSmUrpxHvgMoqIbeqwkSfr0HETh72Ap/zYAxPxgmjnDHrHHiigqMlDZ4o+GfNPuvzSDgG7FGnN103VM=; 7:Xn2VT6//IXq+Q7/6i+8JJiYCKSA+pHp91LLjPIaxinUG84P5s+NsbVcLO7CitqTGLmXx7c4jRT5q+MjvTn0Wd0tEw8CiUHO9LR5eZzWtYnjx9DqjsAgrg5j9IK2xvZU8RJOx9RwEPhY6Dg8hw9ee9toeOqocNM8PQKUEtA1rANCLJpACk/NF/jfkhTFfpNwSi6ZNuomtIFhJ+Jig2G3Tit3beh7PQgcy9SPFucvCp+ExBQsIWdiWIAFRsdhOHzBX SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1322; 20:v9l+e7ukPz4JFTkoXFBmls6RNiTiDWeVsgqCWw+aeRfUeMNvipVy8NsEn+3PbFQEGVN+LUQlPq7z8+Wy0hT6m63XK8rFNdBaoNb9Iiq+BnjrDNmsGfJ4040u6RNGpEJ4Y9TUHdTHQJRo3EkE4L9XFeATSZ/tKAVRUH5Yyc/2v5I= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2016 19:41:40.1210 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR15MB1322 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-02_06:, , signatures=0 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 Instead pass around the failure tree and the io tree. Signed-off-by: Josef Bacik --- fs/btrfs/extent_io.c | 49 +++++++++++++++++++++++++++---------------------- fs/btrfs/extent_io.h | 10 +++++++--- fs/btrfs/inode.c | 24 ++++++++++++++++++------ 3 files changed, 52 insertions(+), 31 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 045e525..5dcdd3e 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -1946,11 +1946,12 @@ 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 extent_io_tree *failure_tree, + struct extent_io_tree *io_tree, + struct io_failure_record *rec) { int ret; int err = 0; - struct extent_io_tree *failure_tree = &BTRFS_I(inode)->io_failure_tree; set_state_failrec(failure_tree, rec->start, NULL); ret = clear_extent_bits(failure_tree, rec->start, @@ -1959,7 +1960,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(io_tree, rec->start, rec->start + rec->len - 1, EXTENT_DAMAGED); if (ret && !err) @@ -2076,24 +2077,24 @@ int repair_eb_io_failure(struct btrfs_root *root, struct extent_buffer *eb, * 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, - unsigned int pg_offset) +int clean_io_failure(struct btrfs_fs_info *fs_info, + struct extent_io_tree *failure_tree, + struct extent_io_tree *io_tree, u64 start, + struct page *page, u64 ino, unsigned int pg_offset) { u64 private; struct io_failure_record *failrec; - struct btrfs_fs_info *fs_info = BTRFS_I(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, - (u64)-1, 1, EXTENT_DIRTY, 0); + ret = count_range_bits(failure_tree, &private, (u64)-1, 1, + EXTENT_DIRTY, 0); if (!ret) return 0; - ret = get_state_failrec(&BTRFS_I(inode)->io_failure_tree, start, - &failrec); + ret = get_state_failrec(failure_tree, start, &failrec); if (ret) return 0; @@ -2108,25 +2109,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(&io_tree->lock); + state = find_first_extent_bit_state(io_tree, failrec->start, EXTENT_LOCKED); - spin_unlock(&BTRFS_I(inode)->io_tree.lock); + spin_unlock(&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(fs_info, btrfs_ino(inode), start, - failrec->len, failrec->logical, page, - pg_offset, failrec->failed_mirror); + repair_io_failure(fs_info, ino, start, failrec->len, + failrec->logical, page, pg_offset, + failrec->failed_mirror); } } out: - free_io_failure(inode, failrec); + free_io_failure(failure_tree, io_tree, failrec); return 0; } @@ -2362,6 +2363,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, struct io_failure_record *failrec; struct inode *inode = page->mapping->host; struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree; + struct extent_io_tree *failure_tree = &BTRFS_I(inode)->io_failure_tree; struct bio *bio; int read_mode; int ret; @@ -2374,7 +2376,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(failure_tree, tree, failrec); return -EIO; } @@ -2389,7 +2391,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(failure_tree, tree, failrec); return -EIO; } bio_set_op_attrs(bio, REQ_OP_READ, read_mode); @@ -2400,7 +2402,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, ret = tree->ops->submit_bio_hook(tree->private_data, bio, failrec->this_mirror, failrec->bio_flags, 0); if (ret) { - free_io_failure(inode, failrec); + free_io_failure(failure_tree, tree, failrec); bio_put(bio); } @@ -2506,7 +2508,7 @@ static void end_bio_extent_readpage(struct bio *bio) struct bio_vec *bvec; int uptodate = !bio->bi_error; struct btrfs_io_bio *io_bio = btrfs_io_bio(bio); - struct extent_io_tree *tree; + struct extent_io_tree *tree, *failure_tree; u64 offset = 0; u64 start; u64 end; @@ -2525,6 +2527,7 @@ static void end_bio_extent_readpage(struct bio *bio) "mirror=%u\n", (u64)bio->bi_iter.bi_sector, bio->bi_error, io_bio->mirror_num); tree = &BTRFS_I(inode)->io_tree; + failure_tree = &BTRFS_I(inode)->io_failure_tree; /* We always issue full-page reads, but if some block * in a page fails to read, blk_update_request() will @@ -2556,7 +2559,9 @@ 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)->root->fs_info, + failure_tree, tree, start, + page, btrfs_ino(inode), 0); } if (likely(uptodate)) diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 0518e3e..c393c06 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h @@ -429,8 +429,10 @@ struct btrfs_fs_info; 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 inode *inode, u64 start, struct page *page, - unsigned int pg_offset); +int clean_io_failure(struct btrfs_fs_info *fs_info, + struct extent_io_tree *failure_tree, + struct extent_io_tree *io_tree, u64 start, + struct page *page, u64 ino, unsigned int pg_offset); void end_extent_writepage(struct page *page, int err, u64 start, u64 end); int repair_eb_io_failure(struct btrfs_root *root, struct extent_buffer *eb, int mirror_num); @@ -463,7 +465,9 @@ 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 extent_io_tree *failure_tree, + struct extent_io_tree *io_tree, + 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 0b97cb4..8ca791f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -7870,6 +7870,8 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio, bio_end_io_t *repair_endio, void *repair_arg) { struct io_failure_record *failrec; + struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; + struct extent_io_tree *failure_tree = &BTRFS_I(inode)->io_failure_tree; struct bio *bio; int isector; int read_mode; @@ -7884,7 +7886,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(failure_tree, io_tree, failrec); return -EIO; } @@ -7900,7 +7902,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(failure_tree, io_tree, failrec); return -EIO; } bio_set_op_attrs(bio, REQ_OP_READ, read_mode); @@ -7911,7 +7913,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(failure_tree, io_tree, failrec); bio_put(bio); } @@ -7930,6 +7932,7 @@ static void btrfs_retry_endio_nocsum(struct bio *bio) struct btrfs_retry_complete *done = bio->bi_private; struct inode *inode; struct bio_vec *bvec; + struct extent_io_tree *io_tree, *failure_tree; int i; if (bio->bi_error) @@ -7937,11 +7940,15 @@ static void btrfs_retry_endio_nocsum(struct bio *bio) ASSERT(bio->bi_vcnt == 1); inode = bio->bi_io_vec->bv_page->mapping->host; + io_tree = &BTRFS_I(inode)->io_tree; + failure_tree = &BTRFS_I(inode)->io_failure_tree; ASSERT(bio->bi_io_vec->bv_len == BTRFS_I(inode)->root->sectorsize); 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(inode)->root->fs_info, failure_tree, + io_tree, done->start, bvec->bv_page, + btrfs_ino(inode), 0); end: complete(&done->done); bio_put(bio); @@ -8004,6 +8011,7 @@ static void btrfs_retry_endio(struct bio *bio) { struct btrfs_retry_complete *done = bio->bi_private; struct btrfs_io_bio *io_bio = btrfs_io_bio(bio); + struct extent_io_tree *io_tree, *failure_tree; struct inode *inode; struct bio_vec *bvec; u64 start; @@ -8020,6 +8028,8 @@ static void btrfs_retry_endio(struct bio *bio) ASSERT(bio->bi_vcnt == 1); inode = bio->bi_io_vec->bv_page->mapping->host; + io_tree = &BTRFS_I(inode)->io_tree; + failure_tree = &BTRFS_I(inode)->io_failure_tree; ASSERT(bio->bi_io_vec->bv_len == BTRFS_I(inode)->root->sectorsize); bio_for_each_segment_all(bvec, bio, i) { @@ -8027,8 +8037,10 @@ 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, - bvec->bv_page, bvec->bv_offset); + clean_io_failure(BTRFS_I(inode)->root->fs_info, + failure_tree, io_tree, done->start, + bvec->bv_page, btrfs_ino(inode), + bvec->bv_offset); else uptodate = 0; }