• Home
  • Raw
  • Download

Lines Matching +full:memory +full:- +full:mapped

2  * zpool memory storage api
6 * This is a common frontend for memory storage pool implementations.
7 * Typically, this is used to store compressed memory.
36 * zpool_register_driver() - register a zpool implementation.
42 atomic_set(&driver->refcount, 0); in zpool_register_driver()
43 list_add(&driver->list, &drivers_head); in zpool_register_driver()
49 * zpool_unregister_driver() - unregister a zpool implementation.
63 refcount = atomic_read(&driver->refcount); in zpool_unregister_driver()
66 ret = -EBUSY; in zpool_unregister_driver()
68 list_del(&driver->list); in zpool_unregister_driver()
75 /* this assumes @type is null-terminated. */
82 if (!strcmp(driver->type, type)) { in zpool_get_driver()
83 bool got = try_module_get(driver->owner); in zpool_get_driver()
86 atomic_inc(&driver->refcount); in zpool_get_driver()
98 atomic_dec(&driver->refcount); in zpool_put_driver()
99 module_put(driver->owner); in zpool_put_driver()
103 * zpool_has_pool() - Check if the pool driver is available
116 * The @type string must be null-terminated.
125 request_module("zpool-%s", type); in zpool_has_pool()
138 * zpool_create_pool() - Create a new zpool
145 * used when allocating memory, if the implementation supports it. If the
148 * Implementations must guarantee this to be thread-safe.
150 * The @type and @name strings must be null-terminated.
165 request_module("zpool-%s", type); in zpool_create_pool()
176 pr_err("couldn't create zpool - out of memory\n"); in zpool_create_pool()
181 zpool->driver = driver; in zpool_create_pool()
182 zpool->pool = driver->create(name, gfp, ops, zpool); in zpool_create_pool()
183 zpool->ops = ops; in zpool_create_pool()
184 zpool->evictable = driver->shrink && ops && ops->evict; in zpool_create_pool()
186 if (!zpool->pool) { in zpool_create_pool()
196 list_add(&zpool->list, &pools_head); in zpool_create_pool()
203 * zpool_destroy_pool() - Destroy a zpool
206 * Implementations must guarantee this to be thread-safe,
215 pr_debug("destroying pool type %s\n", zpool->driver->type); in zpool_destroy_pool()
218 list_del(&zpool->list); in zpool_destroy_pool()
220 zpool->driver->destroy(zpool->pool); in zpool_destroy_pool()
221 zpool_put_driver(zpool->driver); in zpool_destroy_pool()
226 * zpool_get_type() - Get the type of the zpool
231 * Implementations must guarantee this to be thread-safe.
237 return zpool->driver->type; in zpool_get_type()
241 * zpool_malloc() - Allocate memory
243 * @size: The amount of memory to allocate.
244 * @gfp: The GFP flags to use when allocating memory.
247 * This allocates the requested amount of memory from the pool.
248 * The gfp flags will be used when allocating memory, if the
252 * Implementations must guarantee this to be thread-safe.
259 return zpool->driver->malloc(zpool->pool, size, gfp, handle); in zpool_malloc()
263 * zpool_free() - Free previously allocated memory
264 * @zpool: The zpool that allocated the memory.
265 * @handle: The handle to the memory to free.
267 * This frees previously allocated memory. This does not guarantee
268 * that the pool will actually free memory, only that the memory
271 * Implementations must guarantee this to be thread-safe,
278 zpool->driver->free(zpool->pool, handle); in zpool_free()
282 * zpool_shrink() - Shrink the pool size
287 * This attempts to shrink the actual memory size of the pool
290 * of the handles, this will fail. If non-NULL, the @reclaimed
294 * Implementations must guarantee this to be thread-safe.
301 return zpool->driver->shrink ? in zpool_shrink()
302 zpool->driver->shrink(zpool->pool, pages, reclaimed) : -EINVAL; in zpool_shrink()
306 * zpool_map_handle() - Map a previously allocated handle into memory
309 * @mapmode: How the memory should be mapped
311 * This maps a previously allocated handle into memory. The @mapmode
312 * param indicates to the implementation how the memory will be
313 * used, i.e. read-only, write-only, read-write. If the
314 * implementation does not support it, the memory will be treated
315 * as read-write.
319 * actions. The code that uses the mapped handle should complete
320 * its operatons on the mapped handle memory quickly and unmap
321 * as soon as possible. As the implementation may use per-cpu
322 * data, multiple handles should not be mapped concurrently on
325 * Returns: A pointer to the handle's mapped memory area.
330 return zpool->driver->map(zpool->pool, handle, mapmode); in zpool_map_handle()
334 * zpool_unmap_handle() - Unmap a previously mapped handle
338 * This unmaps a previously mapped handle. Any locks or other
340 * will be undone here. The memory area returned from
345 zpool->driver->unmap(zpool->pool, handle); in zpool_unmap_handle()
349 * zpool_get_total_size() - The total size of the pool
358 return zpool->driver->total_size(zpool->pool); in zpool_get_total_size()
362 * zpool_evictable() - Test if zpool is potentially evictable
376 return zpool->evictable; in zpool_evictable()
381 MODULE_DESCRIPTION("Common API for compressed memory storage");