Lines Matching refs:failrec
217 state->failrec = NULL; in alloc_extent_state()
1806 struct io_failure_record *failrec) in set_state_failrec() argument
1827 state->failrec = failrec; in set_state_failrec()
1834 struct io_failure_record **failrec) in get_state_failrec() argument
1855 *failrec = state->failrec; in get_state_failrec()
2077 struct io_failure_record *failrec; in clean_io_failure() local
2088 ret = get_state_failrec(failure_tree, start, &failrec); in clean_io_failure()
2092 BUG_ON(!failrec->this_mirror); in clean_io_failure()
2094 if (failrec->in_validation) { in clean_io_failure()
2098 failrec->start); in clean_io_failure()
2106 failrec->start, in clean_io_failure()
2110 if (state && state->start <= failrec->start && in clean_io_failure()
2111 state->end >= failrec->start + failrec->len - 1) { in clean_io_failure()
2112 num_copies = btrfs_num_copies(fs_info, failrec->logical, in clean_io_failure()
2113 failrec->len); in clean_io_failure()
2115 repair_io_failure(fs_info, ino, start, failrec->len, in clean_io_failure()
2116 failrec->logical, page, pg_offset, in clean_io_failure()
2117 failrec->failed_mirror); in clean_io_failure()
2122 free_io_failure(failure_tree, io_tree, failrec); in clean_io_failure()
2136 struct io_failure_record *failrec; in btrfs_free_io_failure_record() local
2152 failrec = state->failrec; in btrfs_free_io_failure_record()
2154 kfree(failrec); in btrfs_free_io_failure_record()
2165 struct io_failure_record *failrec; in btrfs_get_io_failure_record() local
2173 ret = get_state_failrec(failure_tree, start, &failrec); in btrfs_get_io_failure_record()
2175 failrec = kzalloc(sizeof(*failrec), GFP_NOFS); in btrfs_get_io_failure_record()
2176 if (!failrec) in btrfs_get_io_failure_record()
2179 failrec->start = start; in btrfs_get_io_failure_record()
2180 failrec->len = end - start + 1; in btrfs_get_io_failure_record()
2181 failrec->this_mirror = 0; in btrfs_get_io_failure_record()
2182 failrec->bio_flags = 0; in btrfs_get_io_failure_record()
2183 failrec->in_validation = 0; in btrfs_get_io_failure_record()
2186 em = lookup_extent_mapping(em_tree, start, failrec->len); in btrfs_get_io_failure_record()
2189 kfree(failrec); in btrfs_get_io_failure_record()
2199 kfree(failrec); in btrfs_get_io_failure_record()
2207 failrec->bio_flags = EXTENT_BIO_COMPRESSED; in btrfs_get_io_failure_record()
2208 extent_set_compress_type(&failrec->bio_flags, in btrfs_get_io_failure_record()
2214 logical, start, failrec->len); in btrfs_get_io_failure_record()
2216 failrec->logical = logical; in btrfs_get_io_failure_record()
2223 ret = set_state_failrec(failure_tree, start, failrec); in btrfs_get_io_failure_record()
2228 kfree(failrec); in btrfs_get_io_failure_record()
2234 failrec->logical, failrec->start, failrec->len, in btrfs_get_io_failure_record()
2235 failrec->in_validation); in btrfs_get_io_failure_record()
2243 *failrec_ret = failrec; in btrfs_get_io_failure_record()
2249 struct io_failure_record *failrec, int failed_mirror) in btrfs_check_repairable() argument
2254 num_copies = btrfs_num_copies(fs_info, failrec->logical, failrec->len); in btrfs_check_repairable()
2263 num_copies, failrec->this_mirror, failed_mirror); in btrfs_check_repairable()
2281 BUG_ON(failrec->in_validation); in btrfs_check_repairable()
2282 failrec->in_validation = 1; in btrfs_check_repairable()
2283 failrec->this_mirror = failed_mirror; in btrfs_check_repairable()
2290 if (failrec->in_validation) { in btrfs_check_repairable()
2291 BUG_ON(failrec->this_mirror != failed_mirror); in btrfs_check_repairable()
2292 failrec->in_validation = 0; in btrfs_check_repairable()
2293 failrec->this_mirror = 0; in btrfs_check_repairable()
2295 failrec->failed_mirror = failed_mirror; in btrfs_check_repairable()
2296 failrec->this_mirror++; in btrfs_check_repairable()
2297 if (failrec->this_mirror == failed_mirror) in btrfs_check_repairable()
2298 failrec->this_mirror++; in btrfs_check_repairable()
2301 if (failrec->this_mirror > num_copies) { in btrfs_check_repairable()
2304 num_copies, failrec->this_mirror, failed_mirror); in btrfs_check_repairable()
2313 struct io_failure_record *failrec, in btrfs_create_repair_bio() argument
2324 bio->bi_iter.bi_sector = failrec->logical >> 9; in btrfs_create_repair_bio()
2340 bio_add_page(bio, page, failrec->len, pg_offset); in btrfs_create_repair_bio()
2357 struct io_failure_record *failrec; in bio_readpage_error() local
2369 ret = btrfs_get_io_failure_record(inode, start, end, &failrec); in bio_readpage_error()
2373 if (!btrfs_check_repairable(inode, failed_bio_pages, failrec, in bio_readpage_error()
2375 free_io_failure(failure_tree, tree, failrec); in bio_readpage_error()
2383 bio = btrfs_create_repair_bio(inode, failed_bio, failrec, page, in bio_readpage_error()
2391 read_mode, failrec->this_mirror, failrec->in_validation); in bio_readpage_error()
2393 status = tree->ops->submit_bio_hook(tree->private_data, bio, failrec->this_mirror, in bio_readpage_error()
2394 failrec->bio_flags, 0); in bio_readpage_error()
2396 free_io_failure(failure_tree, tree, failrec); in bio_readpage_error()