Lines Matching defs:workspace
23 /* workspace buffer size for s390 zlib hardware support */
26 struct workspace {
39 struct workspace *workspace = list_entry(ws, struct workspace, list);
41 workspace->level = level;
48 struct workspace *workspace = list_entry(ws, struct workspace, list);
50 kvfree(workspace->strm.workspace);
51 kfree(workspace->buf);
52 kfree(workspace);
57 struct workspace *workspace;
60 workspace = kzalloc(sizeof(*workspace), GFP_KERNEL);
61 if (!workspace)
66 workspace->strm.workspace = kvzalloc(workspacesize, GFP_KERNEL);
67 workspace->level = level;
68 workspace->buf = NULL;
70 * In case of s390 zlib hardware support, allocate lager workspace
74 workspace->buf = kmalloc(ZLIB_DFLTCC_BUF_SIZE,
77 workspace->buf_size = ZLIB_DFLTCC_BUF_SIZE;
79 if (!workspace->buf) {
80 workspace->buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
81 workspace->buf_size = PAGE_SIZE;
83 if (!workspace->strm.workspace || !workspace->buf)
86 INIT_LIST_HEAD(&workspace->list);
88 return &workspace->list;
90 zlib_free_workspace(&workspace->list);
98 struct workspace *workspace = list_entry(ws, struct workspace, list);
115 if (Z_OK != zlib_deflateInit(&workspace->strm, workspace->level)) {
121 workspace->strm.total_in = 0;
122 workspace->strm.total_out = 0;
133 workspace->strm.next_in = workspace->buf;
134 workspace->strm.avail_in = 0;
135 workspace->strm.next_out = cpage_out;
136 workspace->strm.avail_out = PAGE_SIZE;
138 while (workspace->strm.total_in < len) {
141 * the workspace buffer if required.
143 if (workspace->strm.avail_in == 0) {
144 bytes_left = len - workspace->strm.total_in;
146 workspace->buf_size / PAGE_SIZE);
158 memcpy(workspace->buf + i * PAGE_SIZE,
162 workspace->strm.next_in = workspace->buf;
172 workspace->strm.next_in = data_in;
174 workspace->strm.avail_in = min(bytes_left,
175 (unsigned long) workspace->buf_size);
178 ret = zlib_deflate(&workspace->strm, Z_SYNC_FLUSH);
182 zlib_deflateEnd(&workspace->strm);
188 if (workspace->strm.total_in > 8192 &&
189 workspace->strm.total_in <
190 workspace->strm.total_out) {
198 if (workspace->strm.avail_out == 0) {
213 workspace->strm.avail_out = PAGE_SIZE;
214 workspace->strm.next_out = cpage_out;
217 if (workspace->strm.total_in >= len)
219 if (workspace->strm.total_out > max_out)
222 workspace->strm.avail_in = 0;
228 ret = zlib_deflate(&workspace->strm, Z_FINISH);
232 zlib_deflateEnd(&workspace->strm);
235 } else if (workspace->strm.avail_out == 0) {
251 workspace->strm.avail_out = PAGE_SIZE;
252 workspace->strm.next_out = cpage_out;
255 zlib_deflateEnd(&workspace->strm);
257 if (workspace->strm.total_out >= workspace->strm.total_in) {
263 *total_out = workspace->strm.total_out;
264 *total_in = workspace->strm.total_in;
279 struct workspace *workspace = list_entry(ws, struct workspace, list);
293 workspace->strm.next_in = data_in;
294 workspace->strm.avail_in = min_t(size_t, srclen, PAGE_SIZE);
295 workspace->strm.total_in = 0;
297 workspace->strm.total_out = 0;
298 workspace->strm.next_out = workspace->buf;
299 workspace->strm.avail_out = workspace->buf_size;
308 workspace->strm.next_in += 2;
309 workspace->strm.avail_in -= 2;
312 if (Z_OK != zlib_inflateInit2(&workspace->strm, wbits)) {
317 while (workspace->strm.total_in < srclen) {
318 ret = zlib_inflate(&workspace->strm, Z_NO_FLUSH);
323 total_out = workspace->strm.total_out;
329 ret2 = btrfs_decompress_buf2page(workspace->buf, buf_start,
337 workspace->strm.next_out = workspace->buf;
338 workspace->strm.avail_out = workspace->buf_size;
340 if (workspace->strm.avail_in == 0) {
349 workspace->strm.next_in = data_in;
350 tmp = srclen - workspace->strm.total_in;
351 workspace->strm.avail_in = min(tmp,
360 zlib_inflateEnd(&workspace->strm);
372 struct workspace *workspace = list_entry(ws, struct workspace, list);
383 workspace->strm.next_in = data_in;
384 workspace->strm.avail_in = srclen;
385 workspace->strm.total_in = 0;
387 workspace->strm.next_out = workspace->buf;
388 workspace->strm.avail_out = workspace->buf_size;
389 workspace->strm.total_out = 0;
397 workspace->strm.next_in += 2;
398 workspace->strm.avail_in -= 2;
401 if (Z_OK != zlib_inflateInit2(&workspace->strm, wbits)) {
411 ret = zlib_inflate(&workspace->strm, Z_NO_FLUSH);
416 total_out = workspace->strm.total_out;
436 memcpy(kaddr + pg_offset, workspace->buf + buf_offset, bytes);
442 workspace->strm.next_out = workspace->buf;
443 workspace->strm.avail_out = workspace->buf_size;
451 zlib_inflateEnd(&workspace->strm);