Lines Matching refs:zpool
3 * zpool memory storage api
19 #include <linux/zpool.h>
21 struct zpool {
30 * zpool_register_driver() - register a zpool implementation.
43 * zpool_unregister_driver() - unregister a zpool implementation.
98 * @type: The type of the zpool to check (e.g. zbud, zsmalloc)
119 request_module("zpool-%s", type);
132 * zpool_create_pool() - Create a new zpool
133 * @type: The type of the zpool to create (e.g. zbud, zsmalloc)
134 * @name: The name of the zpool (e.g. zram0, zswap)
137 * This creates a new zpool of the specified type. The gfp flags will be
139 * ops param is NULL, then the created zpool will not be evictable.
145 * Returns: New zpool on success, NULL on failure.
147 struct zpool *zpool_create_pool(const char *type, const char *name, gfp_t gfp)
150 struct zpool *zpool;
157 request_module("zpool-%s", type);
166 zpool = kmalloc(sizeof(*zpool), gfp);
167 if (!zpool) {
168 pr_err("couldn't create zpool - out of memory\n");
173 zpool->driver = driver;
174 zpool->pool = driver->create(name, gfp);
176 if (!zpool->pool) {
179 kfree(zpool);
185 return zpool;
189 * zpool_destroy_pool() - Destroy a zpool
190 * @zpool: The zpool to destroy.
197 * This destroys an existing zpool. The zpool should not be in use.
199 void zpool_destroy_pool(struct zpool *zpool)
201 pr_debug("destroying pool type %s\n", zpool->driver->type);
203 zpool->driver->destroy(zpool->pool);
204 zpool_put_driver(zpool->driver);
205 kfree(zpool);
209 * zpool_get_type() - Get the type of the zpool
210 * @zpool: The zpool to check
216 * Returns: The type of zpool.
218 const char *zpool_get_type(struct zpool *zpool)
220 return zpool->driver->type;
224 * zpool_malloc_support_movable() - Check if the zpool supports
226 * @zpool: The zpool to check
228 * This returns if the zpool supports allocating movable memory.
232 * Returns: true if the zpool supports allocating movable memory, false if not
234 bool zpool_malloc_support_movable(struct zpool *zpool)
236 return zpool->driver->malloc_support_movable;
241 * @zpool: The zpool to allocate from.
255 int zpool_malloc(struct zpool *zpool, size_t size, gfp_t gfp,
258 return zpool->driver->malloc(zpool->pool, size, gfp, handle);
263 * @zpool: The zpool that allocated the memory.
275 void zpool_free(struct zpool *zpool, unsigned long handle)
277 zpool->driver->free(zpool->pool, handle);
282 * @zpool: The zpool that the handle was allocated from
302 void *zpool_map_handle(struct zpool *zpool, unsigned long handle,
305 return zpool->driver->map(zpool->pool, handle, mapmode);
310 * @zpool: The zpool that the handle was allocated from
318 void zpool_unmap_handle(struct zpool *zpool, unsigned long handle)
320 zpool->driver->unmap(zpool->pool, handle);
325 * @zpool: The zpool to check
329 * Returns: Total size of the zpool in bytes.
331 u64 zpool_get_total_size(struct zpool *zpool)
333 return zpool->driver->total_size(zpool->pool);
337 * zpool_can_sleep_mapped - Test if zpool can sleep when do mapped.
338 * @zpool: The zpool to test
347 * Returns: true if zpool can sleep; false otherwise.
349 bool zpool_can_sleep_mapped(struct zpool *zpool)
351 return zpool->driver->sleep_mapped;