Lines Matching defs:level

34 static zstd_parameters zstd_get_btrfs_parameters(int level,
37 zstd_parameters params = zstd_get_params(level, src_len);
49 int level;
62 * Zstd workspaces have different memory requirements depending on the level.
63 * The zstd workspaces are managed by having individual lists for each level
64 * and a global lru. Forward progress is maintained by protecting a max level
68 * have available workspaces and scans up. This lets us recycle higher level
71 * level. Putting a workspace involves adding it back to the appropriate places
95 static inline int clip_level(int level)
97 return max(0, level - 1);
127 int level;
136 level = victim->level;
141 if (list_empty(&zwsm->idle_ws[level]))
142 clear_bit(level, &zwsm->active_map);
155 * It is possible based on the level configurations that a higher level
156 * workspace uses less memory than a lower level workspace. In order to reuse
158 * the required memory for each level and enforces the monotonicity between
159 * level and memory required.
164 int level;
166 for (level = ZSTD_BTRFS_MIN_LEVEL; level <= ZSTD_BTRFS_MAX_LEVEL; level++) {
167 if (level == 0)
170 zstd_get_btrfs_parameters(level, ZSTD_BTRFS_MAX_INPUT);
177 /* Use level 1 workspace size for all the fast mode negative levels. */
178 zstd_ws_mem_sizes[clip_level(level)] = max_size;
235 * Find workspace for given level.
237 * @level: compression level
240 * compression level. This lets us utilize already allocated workspaces before
246 static struct list_head *zstd_find_workspace(struct btrfs_fs_info *fs_info, int level)
251 int i = clip_level(level);
260 /* keep its place if it's a lower level using this */
261 workspace->req_level = level;
262 if (clip_level(level) == workspace->level)
276 * Zstd get_workspace for level.
278 * @level: compression level
280 * If @level is 0, then any compression level can be used. Therefore, we begin
283 * memory pressure, go to sleep waiting for the max level workspace to free up.
285 struct list_head *zstd_get_workspace(struct btrfs_fs_info *fs_info, int level)
293 /* level == 0 means we can use any workspace */
294 if (!level)
295 level = 1;
298 ws = zstd_find_workspace(fs_info, level);
303 ws = zstd_alloc_workspace(fs_info, level);
315 ws = zstd_find_workspace(fs_info, level);
334 * the requested compression level. Here is where we continue to protect the
335 * max level workspace or update last_used accordingly. If the reclaim timer
336 * isn't set, it is also set here. Only the max level workspace tries and wakes
348 /* A node is only taken off the lru if we are the corresponding level */
349 if (clip_level(workspace->req_level) == workspace->level) {
350 /* Hide a max level workspace from reclaim */
351 if (workspace->level == ZSTD_BTRFS_MAX_LEVEL - 1 &&
363 set_bit(workspace->level, &zwsm->active_map);
364 list_add(&workspace->list, &zwsm->idle_ws[workspace->level]);
371 wakeup = (workspace->level == clip_level(ZSTD_BTRFS_MAX_LEVEL));
387 struct list_head *zstd_alloc_workspace(struct btrfs_fs_info *fs_info, int level)
395 /* Use level 1 workspace size for all the fast mode negative levels. */
396 workspace->size = zstd_ws_mem_sizes[clip_level(level)];
397 workspace->level = clip_level(level);
398 workspace->req_level = level;
440 "zstd compression init level %d failed, root %llu inode %llu offset %llu",
471 "zstd compression level %d failed, error %d root %llu inode %llu offset %llu",
542 "zstd compression end level %d failed, error %d root %llu inode %llu offset %llu",