btrfs: plumb level through the compression interface
[sfrench/cifs-2.6.git] / fs / btrfs / zlib.c
index 773d1d70ceeca44c566deaaa3d5a004b4fd5160f..fc883a14ecbfed02a907e0926f2b326be20aa5b2 100644 (file)
@@ -39,9 +39,9 @@ static void zlib_cleanup_workspace_manager(void)
        btrfs_cleanup_workspace_manager(&wsm);
 }
 
-static struct list_head *zlib_get_workspace(void)
+static struct list_head *zlib_get_workspace(unsigned int level)
 {
-       return btrfs_get_workspace(&wsm);
+       return btrfs_get_workspace(&wsm, level);
 }
 
 static void zlib_put_workspace(struct list_head *ws)
@@ -58,7 +58,7 @@ static void zlib_free_workspace(struct list_head *ws)
        kfree(workspace);
 }
 
-static struct list_head *zlib_alloc_workspace(void)
+static struct list_head *zlib_alloc_workspace(unsigned int level)
 {
        struct workspace *workspace;
        int workspacesize;
@@ -70,6 +70,7 @@ static struct list_head *zlib_alloc_workspace(void)
        workspacesize = max(zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL),
                        zlib_inflate_workspacesize());
        workspace->strm.workspace = kvmalloc(workspacesize, GFP_KERNEL);
+       workspace->level = level;
        workspace->buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
        if (!workspace->strm.workspace || !workspace->buf)
                goto fail;