Lines Matching refs:failrec
305 state->failrec = NULL; in alloc_extent_state()
2018 struct io_failure_record *failrec) in set_state_failrec() argument
2039 state->failrec = failrec; in set_state_failrec()
2046 struct io_failure_record **failrec) in get_state_failrec() argument
2067 *failrec = state->failrec; in get_state_failrec()
2289 struct io_failure_record *failrec; in clean_io_failure() local
2300 ret = get_state_failrec(failure_tree, start, &failrec); in clean_io_failure()
2304 BUG_ON(!failrec->this_mirror); in clean_io_failure()
2306 if (failrec->in_validation) { in clean_io_failure()
2310 failrec->start); in clean_io_failure()
2318 failrec->start, in clean_io_failure()
2322 if (state && state->start <= failrec->start && in clean_io_failure()
2323 state->end >= failrec->start + failrec->len - 1) { in clean_io_failure()
2324 num_copies = btrfs_num_copies(fs_info, failrec->logical, in clean_io_failure()
2325 failrec->len); in clean_io_failure()
2327 repair_io_failure(fs_info, ino, start, failrec->len, in clean_io_failure()
2328 failrec->logical, page, pg_offset, in clean_io_failure()
2329 failrec->failed_mirror); in clean_io_failure()
2334 free_io_failure(failure_tree, io_tree, failrec); in clean_io_failure()
2348 struct io_failure_record *failrec; in btrfs_free_io_failure_record() local
2364 failrec = state->failrec; in btrfs_free_io_failure_record()
2366 kfree(failrec); in btrfs_free_io_failure_record()
2377 struct io_failure_record *failrec; in btrfs_get_io_failure_record() local
2385 ret = get_state_failrec(failure_tree, start, &failrec); in btrfs_get_io_failure_record()
2387 failrec = kzalloc(sizeof(*failrec), GFP_NOFS); in btrfs_get_io_failure_record()
2388 if (!failrec) in btrfs_get_io_failure_record()
2391 failrec->start = start; in btrfs_get_io_failure_record()
2392 failrec->len = end - start + 1; in btrfs_get_io_failure_record()
2393 failrec->this_mirror = 0; in btrfs_get_io_failure_record()
2394 failrec->bio_flags = 0; in btrfs_get_io_failure_record()
2395 failrec->in_validation = 0; in btrfs_get_io_failure_record()
2398 em = lookup_extent_mapping(em_tree, start, failrec->len); in btrfs_get_io_failure_record()
2401 kfree(failrec); in btrfs_get_io_failure_record()
2411 kfree(failrec); in btrfs_get_io_failure_record()
2419 failrec->bio_flags = EXTENT_BIO_COMPRESSED; in btrfs_get_io_failure_record()
2420 extent_set_compress_type(&failrec->bio_flags, in btrfs_get_io_failure_record()
2426 logical, start, failrec->len); in btrfs_get_io_failure_record()
2428 failrec->logical = logical; in btrfs_get_io_failure_record()
2435 ret = set_state_failrec(failure_tree, start, failrec); in btrfs_get_io_failure_record()
2440 kfree(failrec); in btrfs_get_io_failure_record()
2446 failrec->logical, failrec->start, failrec->len, in btrfs_get_io_failure_record()
2447 failrec->in_validation); in btrfs_get_io_failure_record()
2455 *failrec_ret = failrec; in btrfs_get_io_failure_record()
2461 struct io_failure_record *failrec, int failed_mirror) in btrfs_check_repairable() argument
2466 num_copies = btrfs_num_copies(fs_info, failrec->logical, failrec->len); in btrfs_check_repairable()
2475 num_copies, failrec->this_mirror, failed_mirror); in btrfs_check_repairable()
2493 BUG_ON(failrec->in_validation); in btrfs_check_repairable()
2494 failrec->in_validation = 1; in btrfs_check_repairable()
2495 failrec->this_mirror = failed_mirror; in btrfs_check_repairable()
2502 if (failrec->in_validation) { in btrfs_check_repairable()
2503 BUG_ON(failrec->this_mirror != failed_mirror); in btrfs_check_repairable()
2504 failrec->in_validation = 0; in btrfs_check_repairable()
2505 failrec->this_mirror = 0; in btrfs_check_repairable()
2507 failrec->failed_mirror = failed_mirror; in btrfs_check_repairable()
2508 failrec->this_mirror++; in btrfs_check_repairable()
2509 if (failrec->this_mirror == failed_mirror) in btrfs_check_repairable()
2510 failrec->this_mirror++; in btrfs_check_repairable()
2513 if (failrec->this_mirror > num_copies) { in btrfs_check_repairable()
2516 num_copies, failrec->this_mirror, failed_mirror); in btrfs_check_repairable()
2525 struct io_failure_record *failrec, in btrfs_create_repair_bio() argument
2536 bio->bi_iter.bi_sector = failrec->logical >> 9; in btrfs_create_repair_bio()
2552 bio_add_page(bio, page, failrec->len, pg_offset); in btrfs_create_repair_bio()
2567 struct io_failure_record *failrec; in bio_readpage_error() local
2579 ret = btrfs_get_io_failure_record(inode, start, end, &failrec); in bio_readpage_error()
2583 if (!btrfs_check_repairable(inode, failed_bio_pages, failrec, in bio_readpage_error()
2585 free_io_failure(failure_tree, tree, failrec); in bio_readpage_error()
2593 bio = btrfs_create_repair_bio(inode, failed_bio, failrec, page, in bio_readpage_error()
2601 read_mode, failrec->this_mirror, failrec->in_validation); in bio_readpage_error()
2603 status = tree->ops->submit_bio_hook(tree->private_data, bio, failrec->this_mirror, in bio_readpage_error()
2604 failrec->bio_flags); in bio_readpage_error()
2606 free_io_failure(failure_tree, tree, failrec); in bio_readpage_error()