Lines Matching defs:level

31 static zstd_parameters zstd_get_btrfs_parameters(unsigned int level,
34 zstd_parameters params = zstd_get_params(level, src_len);
46 unsigned int level;
58 * Zstd workspaces have different memory requirements depending on the level.
59 * The zstd workspaces are managed by having individual lists for each level
60 * and a global lru. Forward progress is maintained by protecting a max level
64 * have available workspaces and scans up. This lets us recycle higher level
67 * level. Putting a workspace involves adding it back to the appropriate places
95 struct list_head *zstd_alloc_workspace(unsigned int level);
122 unsigned int level;
131 level = victim->level;
136 if (list_empty(&wsm.idle_ws[level - 1]))
137 clear_bit(level - 1, &wsm.active_map);
150 * It is possible based on the level configurations that a higher level
151 * workspace uses less memory than a lower level workspace. In order to reuse
153 * the required memory for each level and enforces the monotonicity between
154 * level and memory required.
159 unsigned int level;
161 for (level = 1; level <= ZSTD_BTRFS_MAX_LEVEL; level++) {
163 zstd_get_btrfs_parameters(level, ZSTD_BTRFS_MAX_INPUT);
170 zstd_ws_mem_sizes[level - 1] = max_size;
222 * @level: compression level
225 * compression level. This lets us utilize already allocated workspaces before
231 static struct list_head *zstd_find_workspace(unsigned int level)
235 int i = level - 1;
243 /* keep its place if it's a lower level using this */
244 workspace->req_level = level;
245 if (level == workspace->level)
260 * @level: compression level
262 * If @level is 0, then any compression level can be used. Therefore, we begin
265 * memory pressure, go to sleep waiting for the max level workspace to free up.
267 struct list_head *zstd_get_workspace(unsigned int level)
272 /* level == 0 means we can use any workspace */
273 if (!level)
274 level = 1;
277 ws = zstd_find_workspace(level);
282 ws = zstd_alloc_workspace(level);
303 * the requested compression level. Here is where we continue to protect the
304 * max level workspace or update last_used accordingly. If the reclaim timer
305 * isn't set, it is also set here. Only the max level workspace tries and wakes
314 /* A node is only taken off the lru if we are the corresponding level */
315 if (workspace->req_level == workspace->level) {
316 /* Hide a max level workspace from reclaim */
328 set_bit(workspace->level - 1, &wsm.active_map);
329 list_add(&workspace->list, &wsm.idle_ws[workspace->level - 1]);
334 if (workspace->level == ZSTD_BTRFS_MAX_LEVEL)
347 struct list_head *zstd_alloc_workspace(unsigned int level)
355 workspace->size = zstd_ws_mem_sizes[level - 1];
356 workspace->level = level;
357 workspace->req_level = level;