aboutsummaryrefslogtreecommitdiffstats
path: root/fs/isofs/compress.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/isofs/compress.c')
-rw-r--r--fs/isofs/compress.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c
index f311bf084015..2e4e834d1a98 100644
--- a/fs/isofs/compress.c
+++ b/fs/isofs/compress.c
@@ -26,7 +26,7 @@
26#include "zisofs.h" 26#include "zisofs.h"
27 27
28/* This should probably be global. */ 28/* This should probably be global. */
29static char zisofs_sink_page[PAGE_CACHE_SIZE]; 29static char zisofs_sink_page[PAGE_SIZE];
30 30
31/* 31/*
32 * This contains the zlib memory allocation and the mutex for the 32 * This contains the zlib memory allocation and the mutex for the
@@ -70,11 +70,11 @@ static loff_t zisofs_uncompress_block(struct inode *inode, loff_t block_start,
70 for ( i = 0 ; i < pcount ; i++ ) { 70 for ( i = 0 ; i < pcount ; i++ ) {
71 if (!pages[i]) 71 if (!pages[i])
72 continue; 72 continue;
73 memset(page_address(pages[i]), 0, PAGE_CACHE_SIZE); 73 memset(page_address(pages[i]), 0, PAGE_SIZE);
74 flush_dcache_page(pages[i]); 74 flush_dcache_page(pages[i]);
75 SetPageUptodate(pages[i]); 75 SetPageUptodate(pages[i]);
76 } 76 }
77 return ((loff_t)pcount) << PAGE_CACHE_SHIFT; 77 return ((loff_t)pcount) << PAGE_SHIFT;
78 } 78 }
79 79
80 /* Because zlib is not thread-safe, do all the I/O at the top. */ 80 /* Because zlib is not thread-safe, do all the I/O at the top. */
@@ -121,11 +121,11 @@ static loff_t zisofs_uncompress_block(struct inode *inode, loff_t block_start,
121 if (pages[curpage]) { 121 if (pages[curpage]) {
122 stream.next_out = page_address(pages[curpage]) 122 stream.next_out = page_address(pages[curpage])
123 + poffset; 123 + poffset;
124 stream.avail_out = PAGE_CACHE_SIZE - poffset; 124 stream.avail_out = PAGE_SIZE - poffset;
125 poffset = 0; 125 poffset = 0;
126 } else { 126 } else {
127 stream.next_out = (void *)&zisofs_sink_page; 127 stream.next_out = (void *)&zisofs_sink_page;
128 stream.avail_out = PAGE_CACHE_SIZE; 128 stream.avail_out = PAGE_SIZE;
129 } 129 }
130 } 130 }
131 if (!stream.avail_in) { 131 if (!stream.avail_in) {
@@ -220,14 +220,14 @@ static int zisofs_fill_pages(struct inode *inode, int full_page, int pcount,
220 * pages with the data we have anyway... 220 * pages with the data we have anyway...
221 */ 221 */
222 start_off = page_offset(pages[full_page]); 222 start_off = page_offset(pages[full_page]);
223 end_off = min_t(loff_t, start_off + PAGE_CACHE_SIZE, inode->i_size); 223 end_off = min_t(loff_t, start_off + PAGE_SIZE, inode->i_size);
224 224
225 cstart_block = start_off >> zisofs_block_shift; 225 cstart_block = start_off >> zisofs_block_shift;
226 cend_block = (end_off + (1 << zisofs_block_shift) - 1) 226 cend_block = (end_off + (1 << zisofs_block_shift) - 1)
227 >> zisofs_block_shift; 227 >> zisofs_block_shift;
228 228
229 WARN_ON(start_off - (full_page << PAGE_CACHE_SHIFT) != 229 WARN_ON(start_off - (full_page << PAGE_SHIFT) !=
230 ((cstart_block << zisofs_block_shift) & PAGE_CACHE_MASK)); 230 ((cstart_block << zisofs_block_shift) & PAGE_MASK));
231 231
232 /* Find the pointer to this specific chunk */ 232 /* Find the pointer to this specific chunk */
233 /* Note: we're not using isonum_731() here because the data is known aligned */ 233 /* Note: we're not using isonum_731() here because the data is known aligned */
@@ -260,10 +260,10 @@ static int zisofs_fill_pages(struct inode *inode, int full_page, int pcount,
260 ret = zisofs_uncompress_block(inode, block_start, block_end, 260 ret = zisofs_uncompress_block(inode, block_start, block_end,
261 pcount, pages, poffset, &err); 261 pcount, pages, poffset, &err);
262 poffset += ret; 262 poffset += ret;
263 pages += poffset >> PAGE_CACHE_SHIFT; 263 pages += poffset >> PAGE_SHIFT;
264 pcount -= poffset >> PAGE_CACHE_SHIFT; 264 pcount -= poffset >> PAGE_SHIFT;
265 full_page -= poffset >> PAGE_CACHE_SHIFT; 265 full_page -= poffset >> PAGE_SHIFT;
266 poffset &= ~PAGE_CACHE_MASK; 266 poffset &= ~PAGE_MASK;
267 267
268 if (err) { 268 if (err) {
269 brelse(bh); 269 brelse(bh);
@@ -282,7 +282,7 @@ static int zisofs_fill_pages(struct inode *inode, int full_page, int pcount,
282 282
283 if (poffset && *pages) { 283 if (poffset && *pages) {
284 memset(page_address(*pages) + poffset, 0, 284 memset(page_address(*pages) + poffset, 0,
285 PAGE_CACHE_SIZE - poffset); 285 PAGE_SIZE - poffset);
286 flush_dcache_page(*pages); 286 flush_dcache_page(*pages);
287 SetPageUptodate(*pages); 287 SetPageUptodate(*pages);
288 } 288 }
@@ -302,12 +302,12 @@ static int zisofs_readpage(struct file *file, struct page *page)
302 int i, pcount, full_page; 302 int i, pcount, full_page;
303 unsigned int zisofs_block_shift = ISOFS_I(inode)->i_format_parm[1]; 303 unsigned int zisofs_block_shift = ISOFS_I(inode)->i_format_parm[1];
304 unsigned int zisofs_pages_per_cblock = 304 unsigned int zisofs_pages_per_cblock =
305 PAGE_CACHE_SHIFT <= zisofs_block_shift ? 305 PAGE_SHIFT <= zisofs_block_shift ?
306 (1 << (zisofs_block_shift - PAGE_CACHE_SHIFT)) : 0; 306 (1 << (zisofs_block_shift - PAGE_SHIFT)) : 0;
307 struct page *pages[max_t(unsigned, zisofs_pages_per_cblock, 1)]; 307 struct page *pages[max_t(unsigned, zisofs_pages_per_cblock, 1)];
308 pgoff_t index = page->index, end_index; 308 pgoff_t index = page->index, end_index;
309 309
310 end_index = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 310 end_index = (inode->i_size + PAGE_SIZE - 1) >> PAGE_SHIFT;
311 /* 311 /*
312 * If this page is wholly outside i_size we just return zero; 312 * If this page is wholly outside i_size we just return zero;
313 * do_generic_file_read() will handle this for us 313 * do_generic_file_read() will handle this for us
@@ -318,7 +318,7 @@ static int zisofs_readpage(struct file *file, struct page *page)
318 return 0; 318 return 0;
319 } 319 }
320 320
321 if (PAGE_CACHE_SHIFT <= zisofs_block_shift) { 321 if (PAGE_SHIFT <= zisofs_block_shift) {
322 /* We have already been given one page, this is the one 322 /* We have already been given one page, this is the one
323 we must do. */ 323 we must do. */
324 full_page = index & (zisofs_pages_per_cblock - 1); 324 full_page = index & (zisofs_pages_per_cblock - 1);
@@ -351,7 +351,7 @@ static int zisofs_readpage(struct file *file, struct page *page)
351 kunmap(pages[i]); 351 kunmap(pages[i]);
352 unlock_page(pages[i]); 352 unlock_page(pages[i]);
353 if (i != full_page) 353 if (i != full_page)
354 page_cache_release(pages[i]); 354 put_page(pages[i]);
355 } 355 }
356 } 356 }
357 357