Lines Matching refs:qg
109 static void btrfs_qgroup_update_old_refcnt(struct btrfs_qgroup *qg, u64 seq, in btrfs_qgroup_update_old_refcnt() argument
112 if (qg->old_refcnt < seq) in btrfs_qgroup_update_old_refcnt()
113 qg->old_refcnt = seq; in btrfs_qgroup_update_old_refcnt()
114 qg->old_refcnt += mod; in btrfs_qgroup_update_old_refcnt()
117 static void btrfs_qgroup_update_new_refcnt(struct btrfs_qgroup *qg, u64 seq, in btrfs_qgroup_update_new_refcnt() argument
120 if (qg->new_refcnt < seq) in btrfs_qgroup_update_new_refcnt()
121 qg->new_refcnt = seq; in btrfs_qgroup_update_new_refcnt()
122 qg->new_refcnt += mod; in btrfs_qgroup_update_new_refcnt()
125 static inline u64 btrfs_qgroup_get_old_refcnt(struct btrfs_qgroup *qg, u64 seq) in btrfs_qgroup_get_old_refcnt() argument
127 if (qg->old_refcnt < seq) in btrfs_qgroup_get_old_refcnt()
129 return qg->old_refcnt - seq; in btrfs_qgroup_get_old_refcnt()
132 static inline u64 btrfs_qgroup_get_new_refcnt(struct btrfs_qgroup *qg, u64 seq) in btrfs_qgroup_get_new_refcnt() argument
134 if (qg->new_refcnt < seq) in btrfs_qgroup_get_new_refcnt()
136 return qg->new_refcnt - seq; in btrfs_qgroup_get_new_refcnt()
149 static inline u64 qgroup_to_aux(struct btrfs_qgroup *qg) in qgroup_to_aux() argument
151 return (u64)(uintptr_t)qg; in qgroup_to_aux()
2447 struct btrfs_qgroup *qg; in qgroup_update_refcnt() local
2454 qg = find_qgroup_rb(fs_info, unode->val); in qgroup_update_refcnt()
2455 if (!qg) in qgroup_update_refcnt()
2459 ret = ulist_add(qgroups, qg->qgroupid, qgroup_to_aux(qg), in qgroup_update_refcnt()
2463 ret = ulist_add(tmp, qg->qgroupid, qgroup_to_aux(qg), GFP_ATOMIC); in qgroup_update_refcnt()
2470 qg = unode_aux_to_qgroup(tmp_unode); in qgroup_update_refcnt()
2472 btrfs_qgroup_update_old_refcnt(qg, seq, 1); in qgroup_update_refcnt()
2474 btrfs_qgroup_update_new_refcnt(qg, seq, 1); in qgroup_update_refcnt()
2475 list_for_each_entry(glist, &qg->groups, next_group) { in qgroup_update_refcnt()
2536 struct btrfs_qgroup *qg; in qgroup_update_counters() local
2543 qg = unode_aux_to_qgroup(unode); in qgroup_update_counters()
2544 cur_old_count = btrfs_qgroup_get_old_refcnt(qg, seq); in qgroup_update_counters()
2545 cur_new_count = btrfs_qgroup_get_new_refcnt(qg, seq); in qgroup_update_counters()
2547 trace_qgroup_update_counters(fs_info, qg, cur_old_count, in qgroup_update_counters()
2552 qg->rfer += num_bytes; in qgroup_update_counters()
2553 qg->rfer_cmpr += num_bytes; in qgroup_update_counters()
2557 qg->rfer -= num_bytes; in qgroup_update_counters()
2558 qg->rfer_cmpr -= num_bytes; in qgroup_update_counters()
2568 qg->excl -= num_bytes; in qgroup_update_counters()
2569 qg->excl_cmpr -= num_bytes; in qgroup_update_counters()
2579 qg->excl += num_bytes; in qgroup_update_counters()
2580 qg->excl_cmpr += num_bytes; in qgroup_update_counters()
2593 qg->excl += num_bytes; in qgroup_update_counters()
2594 qg->excl_cmpr += num_bytes; in qgroup_update_counters()
2603 qg->excl -= num_bytes; in qgroup_update_counters()
2604 qg->excl_cmpr -= num_bytes; in qgroup_update_counters()
2612 qgroup_dirty(fs_info, qg); in qgroup_update_counters()
3085 static bool qgroup_check_limits(const struct btrfs_qgroup *qg, u64 num_bytes) in qgroup_check_limits() argument
3087 if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) && in qgroup_check_limits()
3088 qgroup_rsv_total(qg) + (s64)qg->rfer + num_bytes > qg->max_rfer) in qgroup_check_limits()
3091 if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) && in qgroup_check_limits()
3092 qgroup_rsv_total(qg) + (s64)qg->excl + num_bytes > qg->max_excl) in qgroup_check_limits()
3137 struct btrfs_qgroup *qg; in qgroup_reserve() local
3140 qg = unode_aux_to_qgroup(unode); in qgroup_reserve()
3142 if (enforce && !qgroup_check_limits(qg, num_bytes)) { in qgroup_reserve()
3147 list_for_each_entry(glist, &qg->groups, next_group) { in qgroup_reserve()
3161 struct btrfs_qgroup *qg; in qgroup_reserve() local
3163 qg = unode_aux_to_qgroup(unode); in qgroup_reserve()
3165 qgroup_rsv_add(fs_info, qg, num_bytes, type); in qgroup_reserve()
3224 struct btrfs_qgroup *qg; in btrfs_qgroup_free_refroot() local
3227 qg = unode_aux_to_qgroup(unode); in btrfs_qgroup_free_refroot()
3229 qgroup_rsv_release(fs_info, qg, num_bytes, type); in btrfs_qgroup_free_refroot()
3231 list_for_each_entry(glist, &qg->groups, next_group) { in btrfs_qgroup_free_refroot()
4101 struct btrfs_qgroup *qg; in qgroup_convert_meta() local
4104 qg = unode_aux_to_qgroup(unode); in qgroup_convert_meta()
4106 qgroup_rsv_release(fs_info, qg, num_bytes, in qgroup_convert_meta()
4108 qgroup_rsv_add(fs_info, qg, num_bytes, in qgroup_convert_meta()
4110 list_for_each_entry(glist, &qg->groups, next_group) { in qgroup_convert_meta()