Lines Matching refs:qg
94 static void btrfs_qgroup_update_old_refcnt(struct btrfs_qgroup *qg, u64 seq, in btrfs_qgroup_update_old_refcnt() argument
97 if (qg->old_refcnt < seq) in btrfs_qgroup_update_old_refcnt()
98 qg->old_refcnt = seq; in btrfs_qgroup_update_old_refcnt()
99 qg->old_refcnt += mod; in btrfs_qgroup_update_old_refcnt()
102 static void btrfs_qgroup_update_new_refcnt(struct btrfs_qgroup *qg, u64 seq, in btrfs_qgroup_update_new_refcnt() argument
105 if (qg->new_refcnt < seq) in btrfs_qgroup_update_new_refcnt()
106 qg->new_refcnt = seq; in btrfs_qgroup_update_new_refcnt()
107 qg->new_refcnt += mod; in btrfs_qgroup_update_new_refcnt()
110 static inline u64 btrfs_qgroup_get_old_refcnt(struct btrfs_qgroup *qg, u64 seq) in btrfs_qgroup_get_old_refcnt() argument
112 if (qg->old_refcnt < seq) in btrfs_qgroup_get_old_refcnt()
114 return qg->old_refcnt - seq; in btrfs_qgroup_get_old_refcnt()
117 static inline u64 btrfs_qgroup_get_new_refcnt(struct btrfs_qgroup *qg, u64 seq) in btrfs_qgroup_get_new_refcnt() argument
119 if (qg->new_refcnt < seq) in btrfs_qgroup_get_new_refcnt()
121 return qg->new_refcnt - seq; in btrfs_qgroup_get_new_refcnt()
1497 struct btrfs_qgroup *qg; in qgroup_update_refcnt() local
1504 qg = find_qgroup_rb(fs_info, unode->val); in qgroup_update_refcnt()
1505 if (!qg) in qgroup_update_refcnt()
1509 ret = ulist_add(qgroups, qg->qgroupid, ptr_to_u64(qg), in qgroup_update_refcnt()
1513 ret = ulist_add(tmp, qg->qgroupid, ptr_to_u64(qg), GFP_ATOMIC); in qgroup_update_refcnt()
1520 qg = u64_to_ptr(tmp_unode->aux); in qgroup_update_refcnt()
1522 btrfs_qgroup_update_old_refcnt(qg, seq, 1); in qgroup_update_refcnt()
1524 btrfs_qgroup_update_new_refcnt(qg, seq, 1); in qgroup_update_refcnt()
1525 list_for_each_entry(glist, &qg->groups, next_group) { in qgroup_update_refcnt()
1586 struct btrfs_qgroup *qg; in qgroup_update_counters() local
1593 qg = u64_to_ptr(unode->aux); in qgroup_update_counters()
1594 cur_old_count = btrfs_qgroup_get_old_refcnt(qg, seq); in qgroup_update_counters()
1595 cur_new_count = btrfs_qgroup_get_new_refcnt(qg, seq); in qgroup_update_counters()
1599 qg->rfer += num_bytes; in qgroup_update_counters()
1600 qg->rfer_cmpr += num_bytes; in qgroup_update_counters()
1604 qg->rfer -= num_bytes; in qgroup_update_counters()
1605 qg->rfer_cmpr -= num_bytes; in qgroup_update_counters()
1615 qg->excl -= num_bytes; in qgroup_update_counters()
1616 qg->excl_cmpr -= num_bytes; in qgroup_update_counters()
1626 qg->excl += num_bytes; in qgroup_update_counters()
1627 qg->excl_cmpr += num_bytes; in qgroup_update_counters()
1640 qg->excl += num_bytes; in qgroup_update_counters()
1641 qg->excl_cmpr += num_bytes; in qgroup_update_counters()
1650 qg->excl -= num_bytes; in qgroup_update_counters()
1651 qg->excl_cmpr -= num_bytes; in qgroup_update_counters()
1659 qgroup_dirty(fs_info, qg); in qgroup_update_counters()
2073 struct btrfs_qgroup *qg; in qgroup_reserve() local
2076 qg = u64_to_ptr(unode->aux); in qgroup_reserve()
2078 if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) && in qgroup_reserve()
2079 qg->reserved + (s64)qg->rfer + num_bytes > in qgroup_reserve()
2080 qg->max_rfer) { in qgroup_reserve()
2085 if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) && in qgroup_reserve()
2086 qg->reserved + (s64)qg->excl + num_bytes > in qgroup_reserve()
2087 qg->max_excl) { in qgroup_reserve()
2092 list_for_each_entry(glist, &qg->groups, next_group) { in qgroup_reserve()
2106 struct btrfs_qgroup *qg; in qgroup_reserve() local
2108 qg = u64_to_ptr(unode->aux); in qgroup_reserve()
2110 qg->reserved += num_bytes; in qgroup_reserve()
2150 struct btrfs_qgroup *qg; in btrfs_qgroup_free_refroot() local
2153 qg = u64_to_ptr(unode->aux); in btrfs_qgroup_free_refroot()
2155 qg->reserved -= num_bytes; in btrfs_qgroup_free_refroot()
2157 list_for_each_entry(glist, &qg->groups, next_group) { in btrfs_qgroup_free_refroot()