Lines Matching refs:bg
110 struct btrfs_block_group *bg;
585 struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
594 struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
601 struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
692 struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
754 struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
787 struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
821 struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
1014 int num_copies = btrfs_num_copies(fs_info, stripe->bg->start,
1015 stripe->bg->length);
1080 * in-place, but queue the bg to be relocated.
1084 btrfs_repair_one_zone(fs_info, sctx->stripes[0].bg->start);
1111 num_sectors = bio_size >> stripe->bg->fs_info->sectorsize_bits;
1123 queue_work(stripe->bg->fs_info->scrub_workers, &stripe->work);
1130 struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
1198 struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
1521 static int scrub_find_fill_first_stripe(struct btrfs_block_group *bg,
1529 struct btrfs_fs_info *fs_info = bg->fs_info;
1530 struct btrfs_root *extent_root = btrfs_extent_root(fs_info, bg->start);
1531 struct btrfs_root *csum_root = btrfs_csum_root(fs_info, bg->start);
1545 /* The range must be inside the bg. */
1546 ASSERT(logical_start >= bg->start && logical_end <= bg->start + bg->length);
1564 * The extra calculation against bg->start is to handle block groups
1567 stripe->logical = round_down(cur_logical - bg->start, BTRFS_STRIPE_LEN) +
1568 bg->start;
1571 stripe->bg = bg;
1602 if (bg->flags & BTRFS_BLOCK_GROUP_DATA) {
1653 unsigned int nr_sectors = min_t(u64, BTRFS_STRIPE_LEN, stripe->bg->start +
1654 stripe->bg->length - stripe->logical) >>
1658 ASSERT(stripe->bg);
1686 int num_copies = btrfs_num_copies(fs_info, stripe->bg->start,
1687 stripe->bg->length);
1700 struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
1802 static int queue_scrub_stripe(struct scrub_ctx *sctx, struct btrfs_block_group *bg,
1821 ret = scrub_find_fill_first_stripe(bg, &sctx->extent_path,
1845 struct btrfs_block_group *bg,
1881 rot = div_u64(full_stripe_start - bg->start,
1889 ret = scrub_find_fill_first_stripe(bg, &extent_path, &csum_path,
2014 struct btrfs_block_group *bg,
2025 /* The range must be inside the bg */
2026 ASSERT(logical_start >= bg->start && logical_end <= bg->start + bg->length);
2045 spin_lock(&bg->lock);
2046 if (test_bit(BLOCK_GROUP_FLAG_REMOVED, &bg->runtime_flags)) {
2047 spin_unlock(&bg->lock);
2051 spin_unlock(&bg->lock);
2053 ret = queue_scrub_stripe(sctx, bg, device, mirror_num,
2086 struct btrfs_block_group *bg,
2098 bg->start;
2113 struct btrfs_block_group *bg,
2119 const u64 orig_logical = simple_stripe_get_logical(map, bg, stripe_index);
2126 while (cur_logical < bg->start + bg->length) {
2132 ret = scrub_simple_mirror(sctx, bg, map, cur_logical,
2146 struct btrfs_block_group *bg,
2154 const u64 chunk_logical = bg->start;
2197 sctx->raid56_data_stripes[i].bg = bg;
2218 ret = scrub_simple_mirror(sctx, bg, map, bg->start, bg->length,
2225 ret = scrub_simple_stripe(sctx, bg, map, scrub_dev, stripe_index);
2254 ret = scrub_raid56_parity_stripe(sctx, scrub_dev, bg,
2269 ret = scrub_simple_mirror(sctx, bg, map, logical, BTRFS_STRIPE_LEN,
2315 struct btrfs_block_group *bg,
2328 em = lookup_extent_mapping(map_tree, bg->start, bg->length);
2336 spin_lock(&bg->lock);
2337 if (!test_bit(BLOCK_GROUP_FLAG_REMOVED, &bg->runtime_flags))
2339 spin_unlock(&bg->lock);
2343 if (em->start != bg->start)
2352 ret = scrub_stripe(sctx, bg, em, scrub_dev, i);
2533 * 1. The only SYSTEM bg is marked RO.
2534 * Since SYSTEM bg is small, that's pretty common.
2535 * 2. New SYSTEM bg will be allocated
2537 * 3. New SYSTEM bg is empty and will get cleaned up
2539 * 4. Empty SYSTEM bg get scrubbed
2583 * Thus we want the RAID56 bg to be marked RO to