diff options
author | Brian Behlendorf <[email protected]> | 2011-04-20 14:22:35 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-04-20 14:39:15 -0700 |
commit | 3dfc591ac4003d1c92159b5dfe8970f24e008f81 (patch) | |
tree | 0a3014aeffafed2ac02e307eaf5fdb2be649c420 /module | |
parent | b1cbc4610c8b5a9b5de80cb850a6eb58bb811a1d (diff) |
Linux 2.6.39 compat, zlib_deflate_workspacesize()
The function zlib_deflate_workspacesize() now take 2 arguments.
This was done to avoid always having to allocate the maximum size
workspace (268K). The caller can now specific the windowBits and
memLevel compression parameters to get a smaller workspace.
For our purposes we introduce a spl_zlib_deflate_workspacesize()
wrapper which accepts both arguments. When the two argument
version of zlib_deflate_workspacesize() is available the arguments
are passed through. When it's not we assume the worst case and
a maximally sized workspace is used.
Diffstat (limited to 'module')
-rw-r--r-- | module/spl/spl-zlib.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/module/spl/spl-zlib.c b/module/spl/spl-zlib.c index 02825b461..c42562f81 100644 --- a/module/spl/spl-zlib.c +++ b/module/spl/spl-zlib.c @@ -198,10 +198,14 @@ EXPORT_SYMBOL(z_uncompress); int zlib_init(void) { + int size; SENTRY; + + size = MAX(spl_zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL), + zlib_inflate_workspacesize()); + zlib_workspace_cache = kmem_cache_create("spl_zlib_workspace_cache", - max(zlib_deflate_workspacesize(), zlib_inflate_workspacesize()), - 0, NULL, NULL, NULL, NULL, NULL, KMC_VMEM); + size, 0, NULL, NULL, NULL, NULL, NULL, KMC_VMEM); if (!zlib_workspace_cache) SRETURN(1); |