Lines Matching full:sector
53 * largest node/leaf/sector size that shall be supported.
282 * Allocate a new scrub sector and attach it to @sblock.
320 /* The sector to be added should not be used */ in alloc_scrub_sector()
324 /* The sector count must be smaller than the limit */ in alloc_scrub_sector()
401 static void scrub_sector_get(struct scrub_sector *sector);
402 static void scrub_sector_put(struct scrub_sector *sector);
418 struct scrub_sector *sector);
424 static inline int scrub_is_page_on_raid56(struct scrub_sector *sector) in scrub_is_page_on_raid56() argument
426 return sector->recover && in scrub_is_page_on_raid56()
427 (sector->recover->bioc->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK); in scrub_is_page_on_raid56()
1066 * sector by sector this time in order to know which sectors in scrub_handle_errored_block()
1073 * would be that mirror #1 has an I/O error on the first sector, in scrub_handle_errored_block()
1074 * the second sector is good, and mirror #2 has an I/O error on in scrub_handle_errored_block()
1075 * the second sector, but the first sector is good. in scrub_handle_errored_block()
1076 * Then the first sector of the first mirror can be repaired by in scrub_handle_errored_block()
1077 * taking the first sector of the second mirror, and the in scrub_handle_errored_block()
1078 * second sector of the second mirror can be repaired by in scrub_handle_errored_block()
1079 * copying the contents of the 2nd sector of the 1st mirror. in scrub_handle_errored_block()
1133 * The error disappeared after reading sector by sector, or in scrub_handle_errored_block()
1197 * could happen otherwise that a correct sector would be in scrub_handle_errored_block()
1260 * the 2nd sector of mirror #1 faces I/O errors, and the 2nd sector in scrub_handle_errored_block()
1262 * then the 2nd sector of mirror #3 could be tried, whether now in scrub_handle_errored_block()
1267 * without I/O error based on sector sizes (512 bytes on legacy in scrub_handle_errored_block()
1293 /* Try to find no-io-error sector in mirrors */ in scrub_handle_errored_block()
1310 * Did not find a mirror to fetch the sector from. in scrub_handle_errored_block()
1312 * case (sector->io_error), by filling the block with in scrub_handle_errored_block()
1386 * Here we just cleanup the recover, each sector will be in scrub_handle_errored_block()
1501 struct scrub_sector *sector; in scrub_setup_recheck_block() local
1506 sector = alloc_scrub_sector(sblock, logical, GFP_NOFS); in scrub_setup_recheck_block()
1507 if (!sector) { in scrub_setup_recheck_block()
1514 sector->flags = flags; in scrub_setup_recheck_block()
1515 sector->generation = generation; in scrub_setup_recheck_block()
1516 sector->have_csum = have_csum; in scrub_setup_recheck_block()
1518 memcpy(sector->csum, in scrub_setup_recheck_block()
1531 * We're at the first sector, also populate @sblock in scrub_setup_recheck_block()
1545 sector->recover = recover; in scrub_setup_recheck_block()
1563 struct scrub_sector *sector) in scrub_submit_raid56_bio_wait() argument
1567 bio->bi_iter.bi_sector = (sector->offset + sector->sblock->logical) >> in scrub_submit_raid56_bio_wait()
1571 raid56_parity_recover(bio, sector->recover->bioc, sector->sblock->mirror_num); in scrub_submit_raid56_bio_wait()
1592 struct scrub_sector *sector = sblock->sectors[i]; in scrub_recheck_block_on_raid56() local
1594 bio_add_scrub_sector(bio, sector, fs_info->sectorsize); in scrub_recheck_block_on_raid56()
1634 struct scrub_sector *sector = sblock->sectors[i]; in scrub_recheck_block() local
1639 sector->io_error = 1; in scrub_recheck_block()
1645 bio_add_scrub_sector(&bio, sector, fs_info->sectorsize); in scrub_recheck_block()
1646 bio.bi_iter.bi_sector = (sblock->physical + sector->offset) >> in scrub_recheck_block()
1651 sector->io_error = 1; in scrub_recheck_block()
1662 static inline int scrub_check_fsid(u8 fsid[], struct scrub_sector *sector) in scrub_check_fsid() argument
1664 struct btrfs_fs_devices *fs_devices = sector->sblock->dev->fs_devices; in scrub_check_fsid()
1766 struct scrub_sector *sector = sblock->sectors[sector_num]; in scrub_write_sector_to_dev_replace() local
1768 if (sector->io_error) in scrub_write_sector_to_dev_replace()
1769 memset(scrub_sector_get_kaddr(sector), 0, sectorsize); in scrub_write_sector_to_dev_replace()
1771 return scrub_add_sector_to_wr_bio(sblock->sctx, sector); in scrub_write_sector_to_dev_replace()
1802 struct scrub_sector *sector) in scrub_add_sector_to_wr_bio() argument
1804 struct scrub_block *sblock = sector->sblock; in scrub_add_sector_to_wr_bio()
1823 ret = fill_writer_pointer_gap(sctx, sector->offset + in scrub_add_sector_to_wr_bio()
1830 sbio->physical = sblock->physical_for_dev_replace + sector->offset; in scrub_add_sector_to_wr_bio()
1831 sbio->logical = sblock->logical + sector->offset; in scrub_add_sector_to_wr_bio()
1842 sblock->physical_for_dev_replace + sector->offset || in scrub_add_sector_to_wr_bio()
1844 sblock->logical + sector->offset) { in scrub_add_sector_to_wr_bio()
1849 ret = bio_add_scrub_sector(sbio->bio, sector, sectorsize); in scrub_add_sector_to_wr_bio()
1861 sbio->sectors[sbio->sector_count] = sector; in scrub_add_sector_to_wr_bio()
1862 scrub_sector_get(sector); in scrub_add_sector_to_wr_bio()
1868 scrub_block_get(sector->sblock); in scrub_add_sector_to_wr_bio()
1924 struct scrub_sector *sector = sbio->sectors[i]; in scrub_wr_bio_end_io_worker() local
1926 sector->io_error = 1; in scrub_wr_bio_end_io_worker()
1985 struct scrub_sector *sector; in scrub_checksum_data() local
1989 sector = sblock->sectors[0]; in scrub_checksum_data()
1990 if (!sector->have_csum) in scrub_checksum_data()
1993 kaddr = scrub_sector_get_kaddr(sector); in scrub_checksum_data()
2000 if (memcmp(csum, sector->csum, fs_info->csum_size)) in scrub_checksum_data()
2021 struct scrub_sector *sector; in scrub_checksum_tree_block() local
2026 /* Each member in sectors is just one sector */ in scrub_checksum_tree_block()
2029 sector = sblock->sectors[0]; in scrub_checksum_tree_block()
2030 kaddr = scrub_sector_get_kaddr(sector); in scrub_checksum_tree_block()
2042 if (sector->generation != btrfs_stack_header_generation(h)) { in scrub_checksum_tree_block()
2047 if (!scrub_check_fsid(h->fsid, sector)) in scrub_checksum_tree_block()
2078 struct scrub_sector *sector; in scrub_checksum_super() local
2084 sector = sblock->sectors[0]; in scrub_checksum_super()
2085 kaddr = scrub_sector_get_kaddr(sector); in scrub_checksum_super()
2091 if (sector->generation != btrfs_super_generation(s)) in scrub_checksum_super()
2094 if (!scrub_check_fsid(s->fsid, sector)) in scrub_checksum_super()
2128 static void scrub_sector_get(struct scrub_sector *sector) in scrub_sector_get() argument
2130 atomic_inc(§or->refs); in scrub_sector_get()
2133 static void scrub_sector_put(struct scrub_sector *sector) in scrub_sector_put() argument
2135 if (atomic_dec_and_test(§or->refs)) in scrub_sector_put()
2136 kfree(sector); in scrub_sector_put()
2215 struct scrub_sector *sector) in scrub_add_sector_to_rd_bio() argument
2217 struct scrub_block *sblock = sector->sblock; in scrub_add_sector_to_rd_bio()
2241 sbio->physical = sblock->physical + sector->offset; in scrub_add_sector_to_rd_bio()
2242 sbio->logical = sblock->logical + sector->offset; in scrub_add_sector_to_rd_bio()
2253 sblock->physical + sector->offset || in scrub_add_sector_to_rd_bio()
2255 sblock->logical + sector->offset || in scrub_add_sector_to_rd_bio()
2261 sbio->sectors[sbio->sector_count] = sector; in scrub_add_sector_to_rd_bio()
2262 ret = bio_add_scrub_sector(sbio->bio, sector, sectorsize); in scrub_add_sector_to_rd_bio()
2377 struct scrub_sector *sector = sblock->sectors[i]; in scrub_missing_raid56_pages() local
2379 raid56_add_scrub_pages(rbio, scrub_sector_get_page(sector), in scrub_missing_raid56_pages()
2380 scrub_sector_get_page_offset(sector), in scrub_missing_raid56_pages()
2381 sector->offset + sector->sblock->logical); in scrub_missing_raid56_pages()
2420 struct scrub_sector *sector; in scrub_sectors() local
2422 * Here we will allocate one page for one sector to scrub. in scrub_sectors()
2428 sector = alloc_scrub_sector(sblock, logical, GFP_KERNEL); in scrub_sectors()
2429 if (!sector) { in scrub_sectors()
2436 sector->flags = flags; in scrub_sectors()
2437 sector->generation = gen; in scrub_sectors()
2439 sector->have_csum = 1; in scrub_sectors()
2440 memcpy(sector->csum, csum, sctx->fs_info->csum_size); in scrub_sectors()
2442 sector->have_csum = 0; in scrub_sectors()
2459 struct scrub_sector *sector = sblock->sectors[index]; in scrub_sectors() local
2462 ret = scrub_add_sector_to_rd_bio(sctx, sector); in scrub_sectors()
2498 struct scrub_sector *sector = sbio->sectors[i]; in scrub_bio_end_io_worker() local
2500 sector->io_error = 1; in scrub_bio_end_io_worker()
2501 sector->sblock->no_io_error_seen = 0; in scrub_bio_end_io_worker()
2507 struct scrub_sector *sector = sbio->sectors[i]; in scrub_bio_end_io_worker() local
2508 struct scrub_block *sblock = sector->sblock; in scrub_bio_end_io_worker()
2757 struct scrub_sector *sector; in scrub_sectors_for_parity() local
2759 sector = alloc_scrub_sector(sblock, logical, GFP_KERNEL); in scrub_sectors_for_parity()
2760 if (!sector) { in scrub_sectors_for_parity()
2767 sblock->sectors[index] = sector; in scrub_sectors_for_parity()
2769 scrub_sector_get(sector); in scrub_sectors_for_parity()
2770 list_add_tail(§or->list, &sparity->sectors_list); in scrub_sectors_for_parity()
2771 sector->flags = flags; in scrub_sectors_for_parity()
2772 sector->generation = gen; in scrub_sectors_for_parity()
2774 sector->have_csum = 1; in scrub_sectors_for_parity()
2775 memcpy(sector->csum, csum, sctx->fs_info->csum_size); in scrub_sectors_for_parity()
2777 sector->have_csum = 0; in scrub_sectors_for_parity()
2788 struct scrub_sector *sector = sblock->sectors[index]; in scrub_sectors_for_parity() local
2791 ret = scrub_add_sector_to_rd_bio(sctx, sector); in scrub_sectors_for_parity()
2798 /* Last one frees, either here or in bio completion for last sector */ in scrub_sectors_for_parity()