diff options
author | David Sterba <dsterba@suse.com> | 2017-02-14 19:04:07 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-02-28 14:26:35 +0100 |
commit | 38c31464089f639630b7c28ce933a4d60e135a02 (patch) | |
tree | fd39ede7261635ac2f47ece7139c668820cf9db0 /fs/btrfs/compression.c | |
parent | 52f75f4fe74ce86376d68b30c94d5fb11cb4019e (diff) | |
download | talos-obmc-linux-38c31464089f639630b7c28ce933a4d60e135a02.tar.gz talos-obmc-linux-38c31464089f639630b7c28ce933a4d60e135a02.zip |
btrfs: merge length input and output parameter in compress_pages
The length parameter is basically duplicated for input and output in the
top level caller of the compress_pages chain. We can simply use one
variable for that and reduce stack consumption. The compression
implementation will sink the parameter to a local variable so everything
works as before.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r-- | fs/btrfs/compression.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index d426e4a10b2b..7e214fd254e4 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -911,27 +911,25 @@ static void free_workspaces(void) } /* - * given an address space and start/len, compress the bytes. + * Given an address space and start and length, compress the bytes into @pages + * that are allocated on demand. * - * pages are allocated to hold the compressed result and stored - * in 'pages' + * @out_pages is used to return the number of pages allocated. There + * may be pages allocated even if we return an error. * - * out_pages is used to return the number of pages allocated. There - * may be pages allocated even if we return an error - * - * total_in is used to return the number of bytes actually read. It - * may be smaller then len if we had to exit early because we + * @total_in is used to return the number of bytes actually read. It + * may be smaller than the input length if we had to exit early because we * ran out of room in the pages array or because we cross the * max_out threshold. * - * total_out is used to return the total number of compressed bytes + * @total_out is an in/out parameter, must be set to the input length and will + * be also used to return the total number of compressed bytes * - * max_out tells us the max number of bytes that we're allowed to + * @max_out tells us the max number of bytes that we're allowed to * stuff into pages */ int btrfs_compress_pages(int type, struct address_space *mapping, - u64 start, unsigned long len, - struct page **pages, + u64 start, struct page **pages, unsigned long nr_dest_pages, unsigned long *out_pages, unsigned long *total_in, @@ -944,7 +942,7 @@ int btrfs_compress_pages(int type, struct address_space *mapping, workspace = find_workspace(type); ret = btrfs_compress_op[type-1]->compress_pages(workspace, mapping, - start, len, pages, + start, pages, nr_dest_pages, out_pages, total_in, total_out, max_out); |