Lines Matching refs:grp
40 static int erofs_workgroup_get(struct erofs_workgroup *grp)
45 o = erofs_wait_on_workgroup_freezed(grp);
49 if (atomic_cmpxchg(&grp->refcount, o, o + 1) != o)
62 struct erofs_workgroup *grp;
66 grp = xa_load(&sbi->managed_pslots, index);
67 if (grp) {
68 if (erofs_workgroup_get(grp)) {
74 DBG_BUGON(index != grp->index);
77 return grp;
81 struct erofs_workgroup *grp)
91 atomic_inc(&grp->refcount);
95 pre = __xa_cmpxchg(&sbi->managed_pslots, grp->index,
96 NULL, grp, GFP_NOFS);
106 atomic_dec(&grp->refcount);
107 grp = pre;
110 return grp;
113 static void __erofs_workgroup_free(struct erofs_workgroup *grp)
116 erofs_workgroup_free_rcu(grp);
119 int erofs_workgroup_put(struct erofs_workgroup *grp)
121 int count = atomic_dec_return(&grp->refcount);
126 __erofs_workgroup_free(grp);
131 struct erofs_workgroup *grp)
138 if (!erofs_workgroup_try_to_freeze(grp, 1))
147 if (erofs_try_to_free_all_cached_pages(sbi, grp)) {
148 erofs_workgroup_unfreeze(grp, 1);
157 DBG_BUGON(__xa_erase(&sbi->managed_pslots, grp->index) != grp);
160 erofs_workgroup_unfreeze(grp, 0);
161 __erofs_workgroup_free(grp);
168 struct erofs_workgroup *grp;
173 xa_for_each(&sbi->managed_pslots, index, grp) {
175 if (!erofs_try_to_release_workgroup(sbi, grp))