aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/lzo.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/lzo.c')
-rw-r--r--fs/btrfs/lzo.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c
index a2f051347731..1adfbe7be6b8 100644
--- a/fs/btrfs/lzo.c
+++ b/fs/btrfs/lzo.c
@@ -55,8 +55,8 @@ static struct list_head *lzo_alloc_workspace(void)
55 return ERR_PTR(-ENOMEM); 55 return ERR_PTR(-ENOMEM);
56 56
57 workspace->mem = vmalloc(LZO1X_MEM_COMPRESS); 57 workspace->mem = vmalloc(LZO1X_MEM_COMPRESS);
58 workspace->buf = vmalloc(lzo1x_worst_compress(PAGE_CACHE_SIZE)); 58 workspace->buf = vmalloc(lzo1x_worst_compress(PAGE_SIZE));
59 workspace->cbuf = vmalloc(lzo1x_worst_compress(PAGE_CACHE_SIZE)); 59 workspace->cbuf = vmalloc(lzo1x_worst_compress(PAGE_SIZE));
60 if (!workspace->mem || !workspace->buf || !workspace->cbuf) 60 if (!workspace->mem || !workspace->buf || !workspace->cbuf)
61 goto fail; 61 goto fail;
62 62
@@ -116,7 +116,7 @@ static int lzo_compress_pages(struct list_head *ws,
116 *total_out = 0; 116 *total_out = 0;
117 *total_in = 0; 117 *total_in = 0;
118 118
119 in_page = find_get_page(mapping, start >> PAGE_CACHE_SHIFT); 119 in_page = find_get_page(mapping, start >> PAGE_SHIFT);
120 data_in = kmap(in_page); 120 data_in = kmap(in_page);
121 121
122 /* 122 /*
@@ -133,10 +133,10 @@ static int lzo_compress_pages(struct list_head *ws,
133 tot_out = LZO_LEN; 133 tot_out = LZO_LEN;
134 pages[0] = out_page; 134 pages[0] = out_page;
135 nr_pages = 1; 135 nr_pages = 1;
136 pg_bytes_left = PAGE_CACHE_SIZE - LZO_LEN; 136 pg_bytes_left = PAGE_SIZE - LZO_LEN;
137 137
138 /* compress at most one page of data each time */ 138 /* compress at most one page of data each time */
139 in_len = min(len, PAGE_CACHE_SIZE); 139 in_len = min(len, PAGE_SIZE);
140 while (tot_in < len) { 140 while (tot_in < len) {
141 ret = lzo1x_1_compress(data_in, in_len, workspace->cbuf, 141 ret = lzo1x_1_compress(data_in, in_len, workspace->cbuf,
142 &out_len, workspace->mem); 142 &out_len, workspace->mem);
@@ -201,7 +201,7 @@ static int lzo_compress_pages(struct list_head *ws,
201 cpage_out = kmap(out_page); 201 cpage_out = kmap(out_page);
202 pages[nr_pages++] = out_page; 202 pages[nr_pages++] = out_page;
203 203
204 pg_bytes_left = PAGE_CACHE_SIZE; 204 pg_bytes_left = PAGE_SIZE;
205 out_offset = 0; 205 out_offset = 0;
206 } 206 }
207 } 207 }
@@ -221,12 +221,12 @@ static int lzo_compress_pages(struct list_head *ws,
221 221
222 bytes_left = len - tot_in; 222 bytes_left = len - tot_in;
223 kunmap(in_page); 223 kunmap(in_page);
224 page_cache_release(in_page); 224 put_page(in_page);
225 225
226 start += PAGE_CACHE_SIZE; 226 start += PAGE_SIZE;
227 in_page = find_get_page(mapping, start >> PAGE_CACHE_SHIFT); 227 in_page = find_get_page(mapping, start >> PAGE_SHIFT);
228 data_in = kmap(in_page); 228 data_in = kmap(in_page);
229 in_len = min(bytes_left, PAGE_CACHE_SIZE); 229 in_len = min(bytes_left, PAGE_SIZE);
230 } 230 }
231 231
232 if (tot_out > tot_in) 232 if (tot_out > tot_in)
@@ -248,7 +248,7 @@ out:
248 248
249 if (in_page) { 249 if (in_page) {
250 kunmap(in_page); 250 kunmap(in_page);
251 page_cache_release(in_page); 251 put_page(in_page);
252 } 252 }
253 253
254 return ret; 254 return ret;
@@ -266,7 +266,7 @@ static int lzo_decompress_biovec(struct list_head *ws,
266 char *data_in; 266 char *data_in;
267 unsigned long page_in_index = 0; 267 unsigned long page_in_index = 0;
268 unsigned long page_out_index = 0; 268 unsigned long page_out_index = 0;
269 unsigned long total_pages_in = DIV_ROUND_UP(srclen, PAGE_CACHE_SIZE); 269 unsigned long total_pages_in = DIV_ROUND_UP(srclen, PAGE_SIZE);
270 unsigned long buf_start; 270 unsigned long buf_start;
271 unsigned long buf_offset = 0; 271 unsigned long buf_offset = 0;
272 unsigned long bytes; 272 unsigned long bytes;
@@ -289,7 +289,7 @@ static int lzo_decompress_biovec(struct list_head *ws,
289 tot_in = LZO_LEN; 289 tot_in = LZO_LEN;
290 in_offset = LZO_LEN; 290 in_offset = LZO_LEN;
291 tot_len = min_t(size_t, srclen, tot_len); 291 tot_len = min_t(size_t, srclen, tot_len);
292 in_page_bytes_left = PAGE_CACHE_SIZE - LZO_LEN; 292 in_page_bytes_left = PAGE_SIZE - LZO_LEN;
293 293
294 tot_out = 0; 294 tot_out = 0;
295 pg_offset = 0; 295 pg_offset = 0;
@@ -345,12 +345,12 @@ cont:
345 345
346 data_in = kmap(pages_in[++page_in_index]); 346 data_in = kmap(pages_in[++page_in_index]);
347 347
348 in_page_bytes_left = PAGE_CACHE_SIZE; 348 in_page_bytes_left = PAGE_SIZE;
349 in_offset = 0; 349 in_offset = 0;
350 } 350 }
351 } 351 }
352 352
353 out_len = lzo1x_worst_compress(PAGE_CACHE_SIZE); 353 out_len = lzo1x_worst_compress(PAGE_SIZE);
354 ret = lzo1x_decompress_safe(buf, in_len, workspace->buf, 354 ret = lzo1x_decompress_safe(buf, in_len, workspace->buf,
355 &out_len); 355 &out_len);
356 if (need_unmap) 356 if (need_unmap)
@@ -399,7 +399,7 @@ static int lzo_decompress(struct list_head *ws, unsigned char *data_in,
399 in_len = read_compress_length(data_in); 399 in_len = read_compress_length(data_in);
400 data_in += LZO_LEN; 400 data_in += LZO_LEN;
401 401
402 out_len = PAGE_CACHE_SIZE; 402 out_len = PAGE_SIZE;
403 ret = lzo1x_decompress_safe(data_in, in_len, workspace->buf, &out_len); 403 ret = lzo1x_decompress_safe(data_in, in_len, workspace->buf, &out_len);
404 if (ret != LZO_E_OK) { 404 if (ret != LZO_E_OK) {
405 printk(KERN_WARNING "BTRFS: decompress failed!\n"); 405 printk(KERN_WARNING "BTRFS: decompress failed!\n");