Lines Matching refs:qg
104 static void btrfs_qgroup_update_old_refcnt(struct btrfs_qgroup *qg, u64 seq, in btrfs_qgroup_update_old_refcnt() argument
107 if (qg->old_refcnt < seq) in btrfs_qgroup_update_old_refcnt()
108 qg->old_refcnt = seq; in btrfs_qgroup_update_old_refcnt()
109 qg->old_refcnt += mod; in btrfs_qgroup_update_old_refcnt()
112 static void btrfs_qgroup_update_new_refcnt(struct btrfs_qgroup *qg, u64 seq, in btrfs_qgroup_update_new_refcnt() argument
115 if (qg->new_refcnt < seq) in btrfs_qgroup_update_new_refcnt()
116 qg->new_refcnt = seq; in btrfs_qgroup_update_new_refcnt()
117 qg->new_refcnt += mod; in btrfs_qgroup_update_new_refcnt()
120 static inline u64 btrfs_qgroup_get_old_refcnt(struct btrfs_qgroup *qg, u64 seq) in btrfs_qgroup_get_old_refcnt() argument
122 if (qg->old_refcnt < seq) in btrfs_qgroup_get_old_refcnt()
124 return qg->old_refcnt - seq; in btrfs_qgroup_get_old_refcnt()
127 static inline u64 btrfs_qgroup_get_new_refcnt(struct btrfs_qgroup *qg, u64 seq) in btrfs_qgroup_get_new_refcnt() argument
129 if (qg->new_refcnt < seq) in btrfs_qgroup_get_new_refcnt()
131 return qg->new_refcnt - seq; in btrfs_qgroup_get_new_refcnt()
144 static inline u64 qgroup_to_aux(struct btrfs_qgroup *qg) in qgroup_to_aux() argument
146 return (u64)(uintptr_t)qg; in qgroup_to_aux()
2438 struct btrfs_qgroup *qg; in qgroup_update_refcnt() local
2445 qg = find_qgroup_rb(fs_info, unode->val); in qgroup_update_refcnt()
2446 if (!qg) in qgroup_update_refcnt()
2450 ret = ulist_add(qgroups, qg->qgroupid, qgroup_to_aux(qg), in qgroup_update_refcnt()
2454 ret = ulist_add(tmp, qg->qgroupid, qgroup_to_aux(qg), GFP_ATOMIC); in qgroup_update_refcnt()
2461 qg = unode_aux_to_qgroup(tmp_unode); in qgroup_update_refcnt()
2463 btrfs_qgroup_update_old_refcnt(qg, seq, 1); in qgroup_update_refcnt()
2465 btrfs_qgroup_update_new_refcnt(qg, seq, 1); in qgroup_update_refcnt()
2466 list_for_each_entry(glist, &qg->groups, next_group) { in qgroup_update_refcnt()
2527 struct btrfs_qgroup *qg; in qgroup_update_counters() local
2534 qg = unode_aux_to_qgroup(unode); in qgroup_update_counters()
2535 cur_old_count = btrfs_qgroup_get_old_refcnt(qg, seq); in qgroup_update_counters()
2536 cur_new_count = btrfs_qgroup_get_new_refcnt(qg, seq); in qgroup_update_counters()
2538 trace_qgroup_update_counters(fs_info, qg, cur_old_count, in qgroup_update_counters()
2543 qg->rfer += num_bytes; in qgroup_update_counters()
2544 qg->rfer_cmpr += num_bytes; in qgroup_update_counters()
2548 qg->rfer -= num_bytes; in qgroup_update_counters()
2549 qg->rfer_cmpr -= num_bytes; in qgroup_update_counters()
2559 qg->excl -= num_bytes; in qgroup_update_counters()
2560 qg->excl_cmpr -= num_bytes; in qgroup_update_counters()
2570 qg->excl += num_bytes; in qgroup_update_counters()
2571 qg->excl_cmpr += num_bytes; in qgroup_update_counters()
2584 qg->excl += num_bytes; in qgroup_update_counters()
2585 qg->excl_cmpr += num_bytes; in qgroup_update_counters()
2594 qg->excl -= num_bytes; in qgroup_update_counters()
2595 qg->excl_cmpr -= num_bytes; in qgroup_update_counters()
2603 qgroup_dirty(fs_info, qg); in qgroup_update_counters()
3069 static bool qgroup_check_limits(const struct btrfs_qgroup *qg, u64 num_bytes) in qgroup_check_limits() argument
3071 if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) && in qgroup_check_limits()
3072 qgroup_rsv_total(qg) + (s64)qg->rfer + num_bytes > qg->max_rfer) in qgroup_check_limits()
3075 if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) && in qgroup_check_limits()
3076 qgroup_rsv_total(qg) + (s64)qg->excl + num_bytes > qg->max_excl) in qgroup_check_limits()
3121 struct btrfs_qgroup *qg; in qgroup_reserve() local
3124 qg = unode_aux_to_qgroup(unode); in qgroup_reserve()
3126 if (enforce && !qgroup_check_limits(qg, num_bytes)) { in qgroup_reserve()
3131 list_for_each_entry(glist, &qg->groups, next_group) { in qgroup_reserve()
3145 struct btrfs_qgroup *qg; in qgroup_reserve() local
3147 qg = unode_aux_to_qgroup(unode); in qgroup_reserve()
3149 qgroup_rsv_add(fs_info, qg, num_bytes, type); in qgroup_reserve()
3208 struct btrfs_qgroup *qg; in btrfs_qgroup_free_refroot() local
3211 qg = unode_aux_to_qgroup(unode); in btrfs_qgroup_free_refroot()
3213 qgroup_rsv_release(fs_info, qg, num_bytes, type); in btrfs_qgroup_free_refroot()
3215 list_for_each_entry(glist, &qg->groups, next_group) { in btrfs_qgroup_free_refroot()
4082 struct btrfs_qgroup *qg; in qgroup_convert_meta() local
4085 qg = unode_aux_to_qgroup(unode); in qgroup_convert_meta()
4087 qgroup_rsv_release(fs_info, qg, num_bytes, in qgroup_convert_meta()
4089 qgroup_rsv_add(fs_info, qg, num_bytes, in qgroup_convert_meta()
4091 list_for_each_entry(glist, &qg->groups, next_group) { in qgroup_convert_meta()