Lines Matching full:array

111  * Array of pointers with lazy allocation of leaf pages.  Callers of
113 * serialize access to the array.
118 void *mthca_array_get(struct mthca_array *array, int index) in mthca_array_get() argument
122 if (array->page_list[p].page) in mthca_array_get()
123 return array->page_list[p].page[index & MTHCA_ARRAY_MASK]; in mthca_array_get()
128 int mthca_array_set(struct mthca_array *array, int index, void *value) in mthca_array_set() argument
133 if (!array->page_list[p].page) in mthca_array_set()
134 array->page_list[p].page = (void **) get_zeroed_page(GFP_ATOMIC); in mthca_array_set()
136 if (!array->page_list[p].page) in mthca_array_set()
139 array->page_list[p].page[index & MTHCA_ARRAY_MASK] = value; in mthca_array_set()
140 ++array->page_list[p].used; in mthca_array_set()
145 void mthca_array_clear(struct mthca_array *array, int index) in mthca_array_clear() argument
149 if (--array->page_list[p].used == 0) { in mthca_array_clear()
150 free_page((unsigned long) array->page_list[p].page); in mthca_array_clear()
151 array->page_list[p].page = NULL; in mthca_array_clear()
153 array->page_list[p].page[index & MTHCA_ARRAY_MASK] = NULL; in mthca_array_clear()
155 if (array->page_list[p].used < 0) in mthca_array_clear()
156 pr_debug("Array %p index %d page %d with ref count %d < 0\n", in mthca_array_clear()
157 array, index, p, array->page_list[p].used); in mthca_array_clear()
160 int mthca_array_init(struct mthca_array *array, int nent) in mthca_array_init() argument
165 array->page_list = kmalloc(npage * sizeof *array->page_list, GFP_KERNEL); in mthca_array_init()
166 if (!array->page_list) in mthca_array_init()
170 array->page_list[i].page = NULL; in mthca_array_init()
171 array->page_list[i].used = 0; in mthca_array_init()
177 void mthca_array_cleanup(struct mthca_array *array, int nent) in mthca_array_cleanup() argument
182 free_page((unsigned long) array->page_list[i].page); in mthca_array_cleanup()
184 kfree(array->page_list); in mthca_array_cleanup()