Lines Matching full:array

106  * Array of pointers with lazy allocation of leaf pages.  Callers of
108 * serialize access to the array.
113 void *mthca_array_get(struct mthca_array *array, int index) in mthca_array_get() argument
117 if (array->page_list[p].page) in mthca_array_get()
118 return array->page_list[p].page[index & MTHCA_ARRAY_MASK]; in mthca_array_get()
123 int mthca_array_set(struct mthca_array *array, int index, void *value) in mthca_array_set() argument
128 if (!array->page_list[p].page) in mthca_array_set()
129 array->page_list[p].page = (void **) get_zeroed_page(GFP_ATOMIC); in mthca_array_set()
131 if (!array->page_list[p].page) in mthca_array_set()
134 array->page_list[p].page[index & MTHCA_ARRAY_MASK] = value; in mthca_array_set()
135 ++array->page_list[p].used; in mthca_array_set()
140 void mthca_array_clear(struct mthca_array *array, int index) in mthca_array_clear() argument
144 if (--array->page_list[p].used == 0) { in mthca_array_clear()
145 free_page((unsigned long) array->page_list[p].page); in mthca_array_clear()
146 array->page_list[p].page = NULL; in mthca_array_clear()
148 array->page_list[p].page[index & MTHCA_ARRAY_MASK] = NULL; in mthca_array_clear()
150 if (array->page_list[p].used < 0) in mthca_array_clear()
151 pr_debug("Array %p index %d page %d with ref count %d < 0\n", in mthca_array_clear()
152 array, index, p, array->page_list[p].used); in mthca_array_clear()
155 int mthca_array_init(struct mthca_array *array, int nent) in mthca_array_init() argument
160 array->page_list = kmalloc_array(npage, sizeof(*array->page_list), in mthca_array_init()
162 if (!array->page_list) in mthca_array_init()
166 array->page_list[i].page = NULL; in mthca_array_init()
167 array->page_list[i].used = 0; in mthca_array_init()
173 void mthca_array_cleanup(struct mthca_array *array, int nent) in mthca_array_cleanup() argument
178 free_page((unsigned long) array->page_list[i].page); in mthca_array_cleanup()
180 kfree(array->page_list); in mthca_array_cleanup()