* Check if there was an error allocating and do the allocation if necessary
* If there are allocations, then free them.
*/
-bool mas_nomem(struct ma_state *ms, gfp_t gfp)
- __must_hold(ms->tree->lock)
+bool mas_nomem(struct ma_state *mas, gfp_t gfp)
+ __must_hold(mas->tree->lock)
{
- if (ms->node != MA_ERROR(-ENOMEM)) {
- struct maple_node *node = mas_get_alloc(ms);
+ if (mas->node != MA_ERROR(-ENOMEM)) {
+ struct maple_node *node = mas_get_alloc(mas);
if (node)
ma_free_alloc(node);
- ms->alloc = NULL;
+ mas->alloc = NULL;
return false;
}
if (gfpflags_allow_blocking(gfp)) {
- mtree_unlock(ms->tree);
- mas_node_node(ms, gfp);
- mtree_lock(ms->tree);
+ mtree_unlock(mas->tree);
+ mas_node_node(mas, gfp);
+ mtree_lock(mas->tree);
} else {
- mas_node_node(ms, gfp);
+ mas_node_node(mas, gfp);
}
- if (!mas_get_alloc(ms))
+ if (!mas_get_alloc(mas))
return false;
- ms->node = MAS_START;
+ mas->node = MAS_START;
return true;
}
-static inline struct maple_node *mas_node_cnt(struct ma_state *ms, int count)
+static inline struct maple_node *mas_node_cnt(struct ma_state *mas, int count)
{
- int allocated = mas_get_alloc_cnt(ms);
+ int allocated = mas_get_alloc_cnt(mas);
BUG_ON(count > 127);
if (allocated < count) {
- mas_set_alloc_req(ms, count - allocated);
- mas_node_node(ms, GFP_NOWAIT | __GFP_NOWARN);
+ mas_set_alloc_req(mas, count - allocated);
+ mas_node_node(mas, GFP_NOWAIT | __GFP_NOWARN);
}
- return ms->alloc;
+ return mas->alloc;
}
/** Private