diff options
Diffstat (limited to 'fs/squashfs/cache.c')
-rw-r--r-- | fs/squashfs/cache.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/squashfs/cache.c b/fs/squashfs/cache.c index 1cb70a0b2168..23813c078cc9 100644 --- a/fs/squashfs/cache.c +++ b/fs/squashfs/cache.c | |||
@@ -30,7 +30,7 @@ | |||
30 | * access the metadata and fragment caches. | 30 | * access the metadata and fragment caches. |
31 | * | 31 | * |
32 | * To avoid out of memory and fragmentation issues with vmalloc the cache | 32 | * To avoid out of memory and fragmentation issues with vmalloc the cache |
33 | * uses sequences of kmalloced PAGE_CACHE_SIZE buffers. | 33 | * uses sequences of kmalloced PAGE_SIZE buffers. |
34 | * | 34 | * |
35 | * It should be noted that the cache is not used for file datablocks, these | 35 | * It should be noted that the cache is not used for file datablocks, these |
36 | * are decompressed and cached in the page-cache in the normal way. The | 36 | * are decompressed and cached in the page-cache in the normal way. The |
@@ -231,7 +231,7 @@ void squashfs_cache_delete(struct squashfs_cache *cache) | |||
231 | /* | 231 | /* |
232 | * Initialise cache allocating the specified number of entries, each of | 232 | * Initialise cache allocating the specified number of entries, each of |
233 | * size block_size. To avoid vmalloc fragmentation issues each entry | 233 | * size block_size. To avoid vmalloc fragmentation issues each entry |
234 | * is allocated as a sequence of kmalloced PAGE_CACHE_SIZE buffers. | 234 | * is allocated as a sequence of kmalloced PAGE_SIZE buffers. |
235 | */ | 235 | */ |
236 | struct squashfs_cache *squashfs_cache_init(char *name, int entries, | 236 | struct squashfs_cache *squashfs_cache_init(char *name, int entries, |
237 | int block_size) | 237 | int block_size) |
@@ -255,7 +255,7 @@ struct squashfs_cache *squashfs_cache_init(char *name, int entries, | |||
255 | cache->unused = entries; | 255 | cache->unused = entries; |
256 | cache->entries = entries; | 256 | cache->entries = entries; |
257 | cache->block_size = block_size; | 257 | cache->block_size = block_size; |
258 | cache->pages = block_size >> PAGE_CACHE_SHIFT; | 258 | cache->pages = block_size >> PAGE_SHIFT; |
259 | cache->pages = cache->pages ? cache->pages : 1; | 259 | cache->pages = cache->pages ? cache->pages : 1; |
260 | cache->name = name; | 260 | cache->name = name; |
261 | cache->num_waiters = 0; | 261 | cache->num_waiters = 0; |
@@ -275,7 +275,7 @@ struct squashfs_cache *squashfs_cache_init(char *name, int entries, | |||
275 | } | 275 | } |
276 | 276 | ||
277 | for (j = 0; j < cache->pages; j++) { | 277 | for (j = 0; j < cache->pages; j++) { |
278 | entry->data[j] = kmalloc(PAGE_CACHE_SIZE, GFP_KERNEL); | 278 | entry->data[j] = kmalloc(PAGE_SIZE, GFP_KERNEL); |
279 | if (entry->data[j] == NULL) { | 279 | if (entry->data[j] == NULL) { |
280 | ERROR("Failed to allocate %s buffer\n", name); | 280 | ERROR("Failed to allocate %s buffer\n", name); |
281 | goto cleanup; | 281 | goto cleanup; |
@@ -314,10 +314,10 @@ int squashfs_copy_data(void *buffer, struct squashfs_cache_entry *entry, | |||
314 | return min(length, entry->length - offset); | 314 | return min(length, entry->length - offset); |
315 | 315 | ||
316 | while (offset < entry->length) { | 316 | while (offset < entry->length) { |
317 | void *buff = entry->data[offset / PAGE_CACHE_SIZE] | 317 | void *buff = entry->data[offset / PAGE_SIZE] |
318 | + (offset % PAGE_CACHE_SIZE); | 318 | + (offset % PAGE_SIZE); |
319 | int bytes = min_t(int, entry->length - offset, | 319 | int bytes = min_t(int, entry->length - offset, |
320 | PAGE_CACHE_SIZE - (offset % PAGE_CACHE_SIZE)); | 320 | PAGE_SIZE - (offset % PAGE_SIZE)); |
321 | 321 | ||
322 | if (bytes >= remaining) { | 322 | if (bytes >= remaining) { |
323 | memcpy(buffer, buff, remaining); | 323 | memcpy(buffer, buff, remaining); |
@@ -415,7 +415,7 @@ struct squashfs_cache_entry *squashfs_get_datablock(struct super_block *sb, | |||
415 | */ | 415 | */ |
416 | void *squashfs_read_table(struct super_block *sb, u64 block, int length) | 416 | void *squashfs_read_table(struct super_block *sb, u64 block, int length) |
417 | { | 417 | { |
418 | int pages = (length + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 418 | int pages = (length + PAGE_SIZE - 1) >> PAGE_SHIFT; |
419 | int i, res; | 419 | int i, res; |
420 | void *table, *buffer, **data; | 420 | void *table, *buffer, **data; |
421 | struct squashfs_page_actor *actor; | 421 | struct squashfs_page_actor *actor; |
@@ -436,7 +436,7 @@ void *squashfs_read_table(struct super_block *sb, u64 block, int length) | |||
436 | goto failed2; | 436 | goto failed2; |
437 | } | 437 | } |
438 | 438 | ||
439 | for (i = 0; i < pages; i++, buffer += PAGE_CACHE_SIZE) | 439 | for (i = 0; i < pages; i++, buffer += PAGE_SIZE) |
440 | data[i] = buffer; | 440 | data[i] = buffer; |
441 | 441 | ||
442 | res = squashfs_read_data(sb, block, length | | 442 | res = squashfs_read_data(sb, block, length | |