Lines Matching +full:5 +full:bg
53 #define BTRFS_MIN_ACTIVE_ZONES (BTRFS_SUPER_MIRROR_MAX + 5)
1367 static int btrfs_load_block_group_single(struct btrfs_block_group *bg, in btrfs_load_block_group_single() argument
1372 btrfs_err(bg->fs_info, in btrfs_load_block_group_single()
1378 bg->alloc_offset = info->alloc_offset; in btrfs_load_block_group_single()
1379 bg->zone_capacity = info->capacity; in btrfs_load_block_group_single()
1381 set_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &bg->runtime_flags); in btrfs_load_block_group_single()
1385 static int btrfs_load_block_group_dup(struct btrfs_block_group *bg, in btrfs_load_block_group_dup() argument
1390 struct btrfs_fs_info *fs_info = bg->fs_info; in btrfs_load_block_group_dup()
1397 bg->zone_capacity = min_not_zero(zone_info[0].capacity, zone_info[1].capacity); in btrfs_load_block_group_dup()
1400 btrfs_err(bg->fs_info, in btrfs_load_block_group_dup()
1406 btrfs_err(bg->fs_info, in btrfs_load_block_group_dup()
1412 btrfs_err(bg->fs_info, in btrfs_load_block_group_dup()
1418 if (!btrfs_zone_activate(bg)) in btrfs_load_block_group_dup()
1421 set_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &bg->runtime_flags); in btrfs_load_block_group_dup()
1424 bg->alloc_offset = zone_info[0].alloc_offset; in btrfs_load_block_group_dup()
1428 static int btrfs_load_block_group_raid1(struct btrfs_block_group *bg, in btrfs_load_block_group_raid1() argument
1433 struct btrfs_fs_info *fs_info = bg->fs_info; in btrfs_load_block_group_raid1()
1443 bg->zone_capacity = min_not_zero(zone_info[0].capacity, zone_info[1].capacity); in btrfs_load_block_group_raid1()
1459 !btrfs_zone_activate(bg)) { in btrfs_load_block_group_raid1()
1464 set_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &bg->runtime_flags); in btrfs_load_block_group_raid1()
1469 bg->alloc_offset = zone_info[0].alloc_offset; in btrfs_load_block_group_raid1()
1471 bg->alloc_offset = zone_info[i - 1].alloc_offset; in btrfs_load_block_group_raid1()
1476 static int btrfs_load_block_group_raid0(struct btrfs_block_group *bg, in btrfs_load_block_group_raid0() argument
1481 struct btrfs_fs_info *fs_info = bg->fs_info; in btrfs_load_block_group_raid0()
1495 if (!btrfs_zone_activate(bg)) in btrfs_load_block_group_raid0()
1499 set_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &bg->runtime_flags); in btrfs_load_block_group_raid0()
1501 bg->zone_capacity += zone_info[i].capacity; in btrfs_load_block_group_raid0()
1502 bg->alloc_offset += zone_info[i].alloc_offset; in btrfs_load_block_group_raid0()
1508 static int btrfs_load_block_group_raid10(struct btrfs_block_group *bg, in btrfs_load_block_group_raid10() argument
1513 struct btrfs_fs_info *fs_info = bg->fs_info; in btrfs_load_block_group_raid10()
1527 if (!btrfs_zone_activate(bg)) in btrfs_load_block_group_raid10()
1531 set_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &bg->runtime_flags); in btrfs_load_block_group_raid10()
1535 bg->zone_capacity += zone_info[i].capacity; in btrfs_load_block_group_raid10()
1536 bg->alloc_offset += zone_info[i].alloc_offset; in btrfs_load_block_group_raid10()
1606 "zoned: failed to determine allocation offset of bg %llu", in btrfs_load_block_group_zone_info()
1682 "zoned: got wrong write pointer in BG %llu: %llu > %llu", in btrfs_load_block_group_zone_info()
2392 struct btrfs_block_group *bg = in btrfs_zone_finish_endio_workfn() local
2395 wait_on_extent_buffer_writeback(bg->last_eb); in btrfs_zone_finish_endio_workfn()
2396 free_extent_buffer(bg->last_eb); in btrfs_zone_finish_endio_workfn()
2397 btrfs_zone_finish_endio(bg->fs_info, bg->start, bg->length); in btrfs_zone_finish_endio_workfn()
2398 btrfs_put_block_group(bg); in btrfs_zone_finish_endio_workfn()
2401 void btrfs_schedule_zone_finish_bg(struct btrfs_block_group *bg, in btrfs_schedule_zone_finish_bg() argument
2404 if (!test_bit(BLOCK_GROUP_FLAG_SEQUENTIAL_ZONE, &bg->runtime_flags) || in btrfs_schedule_zone_finish_bg()
2405 eb->start + eb->len * 2 <= bg->start + bg->zone_capacity) in btrfs_schedule_zone_finish_bg()
2408 if (WARN_ON(bg->zone_finish_work.func == btrfs_zone_finish_endio_workfn)) { in btrfs_schedule_zone_finish_bg()
2409 btrfs_err(bg->fs_info, "double scheduling of bg %llu zone finishing", in btrfs_schedule_zone_finish_bg()
2410 bg->start); in btrfs_schedule_zone_finish_bg()
2415 btrfs_get_block_group(bg); in btrfs_schedule_zone_finish_bg()
2417 bg->last_eb = eb; in btrfs_schedule_zone_finish_bg()
2418 INIT_WORK(&bg->zone_finish_work, btrfs_zone_finish_endio_workfn); in btrfs_schedule_zone_finish_bg()
2419 queue_work(system_unbound_wq, &bg->zone_finish_work); in btrfs_schedule_zone_finish_bg()
2422 void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg) in btrfs_clear_data_reloc_bg() argument
2424 struct btrfs_fs_info *fs_info = bg->fs_info; in btrfs_clear_data_reloc_bg()
2427 if (fs_info->data_reloc_bg == bg->start) in btrfs_clear_data_reloc_bg()
2553 struct btrfs_block_group *bg; in btrfs_zoned_activate_one_bg() local
2565 list_for_each_entry(bg, &space_info->block_groups[index], in btrfs_zoned_activate_one_bg()
2567 if (!spin_trylock(&bg->lock)) in btrfs_zoned_activate_one_bg()
2569 if (btrfs_zoned_bg_is_full(bg) || in btrfs_zoned_activate_one_bg()
2571 &bg->runtime_flags)) { in btrfs_zoned_activate_one_bg()
2572 spin_unlock(&bg->lock); in btrfs_zoned_activate_one_bg()
2575 spin_unlock(&bg->lock); in btrfs_zoned_activate_one_bg()
2577 if (btrfs_zone_activate(bg)) { in btrfs_zoned_activate_one_bg()