Lines Matching refs:bctl
3443 struct btrfs_balance_control *bctl) in insert_balance_item() argument
3478 btrfs_cpu_balance_args_to_disk(&disk_bargs, &bctl->data); in insert_balance_item()
3480 btrfs_cpu_balance_args_to_disk(&disk_bargs, &bctl->meta); in insert_balance_item()
3482 btrfs_cpu_balance_args_to_disk(&disk_bargs, &bctl->sys); in insert_balance_item()
3485 btrfs_set_balance_flags(leaf, item, bctl->flags); in insert_balance_item()
3539 static void update_balance_args(struct btrfs_balance_control *bctl) in update_balance_args() argument
3544 if (bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) in update_balance_args()
3545 bctl->data.flags |= BTRFS_BALANCE_ARGS_SOFT; in update_balance_args()
3546 if (bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) in update_balance_args()
3547 bctl->sys.flags |= BTRFS_BALANCE_ARGS_SOFT; in update_balance_args()
3548 if (bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT) in update_balance_args()
3549 bctl->meta.flags |= BTRFS_BALANCE_ARGS_SOFT; in update_balance_args()
3558 if (!(bctl->data.flags & BTRFS_BALANCE_ARGS_USAGE) && in update_balance_args()
3559 !(bctl->data.flags & BTRFS_BALANCE_ARGS_USAGE_RANGE) && in update_balance_args()
3560 !(bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT)) { in update_balance_args()
3561 bctl->data.flags |= BTRFS_BALANCE_ARGS_USAGE; in update_balance_args()
3562 bctl->data.usage = 90; in update_balance_args()
3564 if (!(bctl->sys.flags & BTRFS_BALANCE_ARGS_USAGE) && in update_balance_args()
3565 !(bctl->sys.flags & BTRFS_BALANCE_ARGS_USAGE_RANGE) && in update_balance_args()
3566 !(bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT)) { in update_balance_args()
3567 bctl->sys.flags |= BTRFS_BALANCE_ARGS_USAGE; in update_balance_args()
3568 bctl->sys.usage = 90; in update_balance_args()
3570 if (!(bctl->meta.flags & BTRFS_BALANCE_ARGS_USAGE) && in update_balance_args()
3571 !(bctl->meta.flags & BTRFS_BALANCE_ARGS_USAGE_RANGE) && in update_balance_args()
3572 !(bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT)) { in update_balance_args()
3573 bctl->meta.flags |= BTRFS_BALANCE_ARGS_USAGE; in update_balance_args()
3574 bctl->meta.usage = 90; in update_balance_args()
3583 struct btrfs_balance_control *bctl = fs_info->balance_ctl; in reset_balance_state() local
3592 kfree(bctl); in reset_balance_state()
3777 struct btrfs_balance_control *bctl = fs_info->balance_ctl; in should_balance_chunk() local
3783 (bctl->flags & BTRFS_BALANCE_TYPE_MASK))) { in should_balance_chunk()
3788 bargs = &bctl->data; in should_balance_chunk()
3790 bargs = &bctl->sys; in should_balance_chunk()
3792 bargs = &bctl->meta; in should_balance_chunk()
3864 struct btrfs_balance_control *bctl = fs_info->balance_ctl; in __btrfs_balance() local
3877 u64 limit_data = bctl->data.limit; in __btrfs_balance()
3878 u64 limit_meta = bctl->meta.limit; in __btrfs_balance()
3879 u64 limit_sys = bctl->sys.limit; in __btrfs_balance()
3893 memset(&bctl->stat, 0, sizeof(bctl->stat)); in __btrfs_balance()
3901 bctl->data.limit = limit_data; in __btrfs_balance()
3902 bctl->meta.limit = limit_meta; in __btrfs_balance()
3903 bctl->sys.limit = limit_sys; in __btrfs_balance()
3952 bctl->stat.considered++; in __btrfs_balance()
3967 bctl->stat.expected++; in __btrfs_balance()
3985 count_data < bctl->data.limit_min) in __btrfs_balance()
3987 count_meta < bctl->meta.limit_min) in __btrfs_balance()
3989 count_sys < bctl->sys.limit_min)) { in __btrfs_balance()
4024 bctl->stat.completed++; in __btrfs_balance()
4201 struct btrfs_balance_control *bctl = fs_info->balance_ctl; in describe_balance_start_or_resume() local
4218 if (bctl->flags & BTRFS_BALANCE_FORCE) in describe_balance_start_or_resume()
4221 if (bctl->flags & BTRFS_BALANCE_DATA) { in describe_balance_start_or_resume()
4222 describe_balance_args(&bctl->data, tmp_buf, sizeof(tmp_buf)); in describe_balance_start_or_resume()
4226 if (bctl->flags & BTRFS_BALANCE_METADATA) { in describe_balance_start_or_resume()
4227 describe_balance_args(&bctl->meta, tmp_buf, sizeof(tmp_buf)); in describe_balance_start_or_resume()
4231 if (bctl->flags & BTRFS_BALANCE_SYSTEM) { in describe_balance_start_or_resume()
4232 describe_balance_args(&bctl->sys, tmp_buf, sizeof(tmp_buf)); in describe_balance_start_or_resume()
4243 (bctl->flags & BTRFS_BALANCE_RESUME) ? in describe_balance_start_or_resume()
4253 struct btrfs_balance_control *bctl, in btrfs_balance() argument
4282 if (mixed && (bctl->flags & allowed)) { in btrfs_balance()
4283 if (!(bctl->flags & BTRFS_BALANCE_DATA) || in btrfs_balance()
4284 !(bctl->flags & BTRFS_BALANCE_METADATA) || in btrfs_balance()
4285 memcmp(&bctl->data, &bctl->meta, sizeof(bctl->data))) { in btrfs_balance()
4309 if (!validate_convert_profile(fs_info, &bctl->data, allowed, "data") || in btrfs_balance()
4310 !validate_convert_profile(fs_info, &bctl->meta, allowed, "metadata") || in btrfs_balance()
4311 !validate_convert_profile(fs_info, &bctl->sys, allowed, "system")) { in btrfs_balance()
4329 if (((bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) && in btrfs_balance()
4331 !(bctl->sys.target & allowed)) || in btrfs_balance()
4332 ((bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT) && in btrfs_balance()
4334 !(bctl->meta.target & allowed))) in btrfs_balance()
4340 meta_target = (bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT) ? in btrfs_balance()
4341 bctl->meta.target : fs_info->avail_metadata_alloc_bits; in btrfs_balance()
4342 data_target = (bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) ? in btrfs_balance()
4343 bctl->data.target : fs_info->avail_data_alloc_bits; in btrfs_balance()
4347 if (bctl->flags & BTRFS_BALANCE_FORCE) { in btrfs_balance()
4366 ret = insert_balance_item(fs_info, bctl); in btrfs_balance()
4370 if (!(bctl->flags & BTRFS_BALANCE_RESUME)) { in btrfs_balance()
4374 fs_info->balance_ctl = bctl; in btrfs_balance()
4379 update_balance_args(bctl); in btrfs_balance()
4433 if (bctl->flags & BTRFS_BALANCE_RESUME) in btrfs_balance()
4436 kfree(bctl); in btrfs_balance()
4492 struct btrfs_balance_control *bctl; in btrfs_recover_balance() local
4516 bctl = kzalloc(sizeof(*bctl), GFP_NOFS); in btrfs_recover_balance()
4517 if (!bctl) { in btrfs_recover_balance()
4525 bctl->flags = btrfs_balance_flags(leaf, item); in btrfs_recover_balance()
4526 bctl->flags |= BTRFS_BALANCE_RESUME; in btrfs_recover_balance()
4529 btrfs_disk_balance_args_to_cpu(&bctl->data, &disk_bargs); in btrfs_recover_balance()
4531 btrfs_disk_balance_args_to_cpu(&bctl->meta, &disk_bargs); in btrfs_recover_balance()
4533 btrfs_disk_balance_args_to_cpu(&bctl->sys, &disk_bargs); in btrfs_recover_balance()
4554 fs_info->balance_ctl = bctl; in btrfs_recover_balance()