Lines Matching refs:failrec
305 state->failrec = NULL; in alloc_extent_state()
2021 struct io_failure_record *failrec) in set_state_failrec() argument
2042 state->failrec = failrec; in set_state_failrec()
2049 struct io_failure_record **failrec) in get_state_failrec() argument
2070 *failrec = state->failrec; in get_state_failrec()
2292 struct io_failure_record *failrec; in clean_io_failure() local
2303 ret = get_state_failrec(failure_tree, start, &failrec); in clean_io_failure()
2307 BUG_ON(!failrec->this_mirror); in clean_io_failure()
2309 if (failrec->in_validation) { in clean_io_failure()
2313 failrec->start); in clean_io_failure()
2321 failrec->start, in clean_io_failure()
2325 if (state && state->start <= failrec->start && in clean_io_failure()
2326 state->end >= failrec->start + failrec->len - 1) { in clean_io_failure()
2327 num_copies = btrfs_num_copies(fs_info, failrec->logical, in clean_io_failure()
2328 failrec->len); in clean_io_failure()
2330 repair_io_failure(fs_info, ino, start, failrec->len, in clean_io_failure()
2331 failrec->logical, page, pg_offset, in clean_io_failure()
2332 failrec->failed_mirror); in clean_io_failure()
2337 free_io_failure(failure_tree, io_tree, failrec); in clean_io_failure()
2351 struct io_failure_record *failrec; in btrfs_free_io_failure_record() local
2367 failrec = state->failrec; in btrfs_free_io_failure_record()
2369 kfree(failrec); in btrfs_free_io_failure_record()
2380 struct io_failure_record *failrec; in btrfs_get_io_failure_record() local
2388 ret = get_state_failrec(failure_tree, start, &failrec); in btrfs_get_io_failure_record()
2390 failrec = kzalloc(sizeof(*failrec), GFP_NOFS); in btrfs_get_io_failure_record()
2391 if (!failrec) in btrfs_get_io_failure_record()
2394 failrec->start = start; in btrfs_get_io_failure_record()
2395 failrec->len = end - start + 1; in btrfs_get_io_failure_record()
2396 failrec->this_mirror = 0; in btrfs_get_io_failure_record()
2397 failrec->bio_flags = 0; in btrfs_get_io_failure_record()
2398 failrec->in_validation = 0; in btrfs_get_io_failure_record()
2401 em = lookup_extent_mapping(em_tree, start, failrec->len); in btrfs_get_io_failure_record()
2404 kfree(failrec); in btrfs_get_io_failure_record()
2414 kfree(failrec); in btrfs_get_io_failure_record()
2422 failrec->bio_flags = EXTENT_BIO_COMPRESSED; in btrfs_get_io_failure_record()
2423 extent_set_compress_type(&failrec->bio_flags, in btrfs_get_io_failure_record()
2429 logical, start, failrec->len); in btrfs_get_io_failure_record()
2431 failrec->logical = logical; in btrfs_get_io_failure_record()
2438 ret = set_state_failrec(failure_tree, start, failrec); in btrfs_get_io_failure_record()
2443 kfree(failrec); in btrfs_get_io_failure_record()
2449 failrec->logical, failrec->start, failrec->len, in btrfs_get_io_failure_record()
2450 failrec->in_validation); in btrfs_get_io_failure_record()
2458 *failrec_ret = failrec; in btrfs_get_io_failure_record()
2464 struct io_failure_record *failrec, int failed_mirror) in btrfs_check_repairable() argument
2469 num_copies = btrfs_num_copies(fs_info, failrec->logical, failrec->len); in btrfs_check_repairable()
2478 num_copies, failrec->this_mirror, failed_mirror); in btrfs_check_repairable()
2496 BUG_ON(failrec->in_validation); in btrfs_check_repairable()
2497 failrec->in_validation = 1; in btrfs_check_repairable()
2498 failrec->this_mirror = failed_mirror; in btrfs_check_repairable()
2505 if (failrec->in_validation) { in btrfs_check_repairable()
2506 BUG_ON(failrec->this_mirror != failed_mirror); in btrfs_check_repairable()
2507 failrec->in_validation = 0; in btrfs_check_repairable()
2508 failrec->this_mirror = 0; in btrfs_check_repairable()
2510 failrec->failed_mirror = failed_mirror; in btrfs_check_repairable()
2511 failrec->this_mirror++; in btrfs_check_repairable()
2512 if (failrec->this_mirror == failed_mirror) in btrfs_check_repairable()
2513 failrec->this_mirror++; in btrfs_check_repairable()
2516 if (failrec->this_mirror > num_copies) { in btrfs_check_repairable()
2519 num_copies, failrec->this_mirror, failed_mirror); in btrfs_check_repairable()
2528 struct io_failure_record *failrec, in btrfs_create_repair_bio() argument
2539 bio->bi_iter.bi_sector = failrec->logical >> 9; in btrfs_create_repair_bio()
2555 bio_add_page(bio, page, failrec->len, pg_offset); in btrfs_create_repair_bio()
2570 struct io_failure_record *failrec; in bio_readpage_error() local
2582 ret = btrfs_get_io_failure_record(inode, start, end, &failrec); in bio_readpage_error()
2586 if (!btrfs_check_repairable(inode, failed_bio_pages, failrec, in bio_readpage_error()
2588 free_io_failure(failure_tree, tree, failrec); in bio_readpage_error()
2596 bio = btrfs_create_repair_bio(inode, failed_bio, failrec, page, in bio_readpage_error()
2604 read_mode, failrec->this_mirror, failrec->in_validation); in bio_readpage_error()
2606 status = tree->ops->submit_bio_hook(tree->private_data, bio, failrec->this_mirror, in bio_readpage_error()
2607 failrec->bio_flags); in bio_readpage_error()
2609 free_io_failure(failure_tree, tree, failrec); in bio_readpage_error()