summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/compression.c
diff options
context:
space:
mode:
authorDavid Sterba2017-02-14 19:04:07 +0100
committerDavid Sterba2017-02-28 14:26:35 +0100
commit4d3a800ebb1299944408f3b40b5b6b996477fba2 (patch)
tree165a58136bd55ad94dec5154f6e03a47bf4763a9 /fs/btrfs/compression.c
parentbtrfs: merge length input and output parameter in compress_pages (diff)
downloadkernel-qcow2-linux-4d3a800ebb1299944408f3b40b5b6b996477fba2.tar.gz
kernel-qcow2-linux-4d3a800ebb1299944408f3b40b5b6b996477fba2.tar.xz
kernel-qcow2-linux-4d3a800ebb1299944408f3b40b5b6b996477fba2.zip
btrfs: merge nr_pages input and output parameter in compress_pages
The parameter saying how many pages can be allocated at maximum can be merged with the output page counter, to save some stack space. The compression implementation will sink the parameter to a local variable so everything works as before. The nr_pages variables can also be simply merged in compress_file_range into one. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r--fs/btrfs/compression.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 7e214fd254e4..11dcda57e15c 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -914,8 +914,8 @@ static void free_workspaces(void)
* Given an address space and start and length, compress the bytes into @pages
* that are allocated on demand.
*
- * @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 an in/out parameter, holds maximum number of pages to allocate
+ * and returns number of actually allocated pages
*
* @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
@@ -930,7 +930,6 @@ static void free_workspaces(void)
*/
int btrfs_compress_pages(int type, struct address_space *mapping,
u64 start, struct page **pages,
- unsigned long nr_dest_pages,
unsigned long *out_pages,
unsigned long *total_in,
unsigned long *total_out,
@@ -943,7 +942,7 @@ int btrfs_compress_pages(int type, struct address_space *mapping,
ret = btrfs_compress_op[type-1]->compress_pages(workspace, mapping,
start, pages,
- nr_dest_pages, out_pages,
+ out_pages,
total_in, total_out,
max_out);
free_workspace(type, workspace);