diff options
Diffstat (limited to 'fs/squashfs')
-rw-r--r-- | fs/squashfs/block.c | 18 | ||||
-rw-r--r-- | fs/squashfs/cache.c | 4 | ||||
-rw-r--r-- | fs/squashfs/inode.c | 6 | ||||
-rw-r--r-- | fs/squashfs/squashfs.h | 2 | ||||
-rw-r--r-- | fs/squashfs/super.c | 2 |
5 files changed, 15 insertions, 17 deletions
diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c index c837dfc2b3c6..2a7960310349 100644 --- a/fs/squashfs/block.c +++ b/fs/squashfs/block.c | |||
@@ -80,7 +80,7 @@ static struct buffer_head *get_block_length(struct super_block *sb, | |||
80 | * generated a larger block - this does occasionally happen with zlib). | 80 | * generated a larger block - this does occasionally happen with zlib). |
81 | */ | 81 | */ |
82 | int squashfs_read_data(struct super_block *sb, void **buffer, u64 index, | 82 | int squashfs_read_data(struct super_block *sb, void **buffer, u64 index, |
83 | int length, u64 *next_index, int srclength) | 83 | int length, u64 *next_index, int srclength, int pages) |
84 | { | 84 | { |
85 | struct squashfs_sb_info *msblk = sb->s_fs_info; | 85 | struct squashfs_sb_info *msblk = sb->s_fs_info; |
86 | struct buffer_head **bh; | 86 | struct buffer_head **bh; |
@@ -184,7 +184,7 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index, | |||
184 | offset = 0; | 184 | offset = 0; |
185 | } | 185 | } |
186 | 186 | ||
187 | if (msblk->stream.avail_out == 0) { | 187 | if (msblk->stream.avail_out == 0 && page < pages) { |
188 | msblk->stream.next_out = buffer[page++]; | 188 | msblk->stream.next_out = buffer[page++]; |
189 | msblk->stream.avail_out = PAGE_CACHE_SIZE; | 189 | msblk->stream.avail_out = PAGE_CACHE_SIZE; |
190 | } | 190 | } |
@@ -201,25 +201,20 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index, | |||
201 | zlib_init = 1; | 201 | zlib_init = 1; |
202 | } | 202 | } |
203 | 203 | ||
204 | zlib_err = zlib_inflate(&msblk->stream, Z_NO_FLUSH); | 204 | zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH); |
205 | 205 | ||
206 | if (msblk->stream.avail_in == 0 && k < b) | 206 | if (msblk->stream.avail_in == 0 && k < b) |
207 | put_bh(bh[k++]); | 207 | put_bh(bh[k++]); |
208 | } while (zlib_err == Z_OK); | 208 | } while (zlib_err == Z_OK); |
209 | 209 | ||
210 | if (zlib_err != Z_STREAM_END) { | 210 | if (zlib_err != Z_STREAM_END) { |
211 | ERROR("zlib_inflate returned unexpected result" | 211 | ERROR("zlib_inflate error, data probably corrupt\n"); |
212 | " 0x%x, srclength %d, avail_in %d," | ||
213 | " avail_out %d\n", zlib_err, srclength, | ||
214 | msblk->stream.avail_in, | ||
215 | msblk->stream.avail_out); | ||
216 | goto release_mutex; | 212 | goto release_mutex; |
217 | } | 213 | } |
218 | 214 | ||
219 | zlib_err = zlib_inflateEnd(&msblk->stream); | 215 | zlib_err = zlib_inflateEnd(&msblk->stream); |
220 | if (zlib_err != Z_OK) { | 216 | if (zlib_err != Z_OK) { |
221 | ERROR("zlib_inflateEnd returned unexpected result 0x%x," | 217 | ERROR("zlib_inflate error, data probably corrupt\n"); |
222 | " srclength %d\n", zlib_err, srclength); | ||
223 | goto release_mutex; | 218 | goto release_mutex; |
224 | } | 219 | } |
225 | length = msblk->stream.total_out; | 220 | length = msblk->stream.total_out; |
@@ -268,7 +263,8 @@ block_release: | |||
268 | put_bh(bh[k]); | 263 | put_bh(bh[k]); |
269 | 264 | ||
270 | read_failure: | 265 | read_failure: |
271 | ERROR("sb_bread failed reading block 0x%llx\n", cur_index); | 266 | ERROR("squashfs_read_data failed to read block 0x%llx\n", |
267 | (unsigned long long) index); | ||
272 | kfree(bh); | 268 | kfree(bh); |
273 | return -EIO; | 269 | return -EIO; |
274 | } | 270 | } |
diff --git a/fs/squashfs/cache.c b/fs/squashfs/cache.c index f29eda16d25e..1c4739e33af6 100644 --- a/fs/squashfs/cache.c +++ b/fs/squashfs/cache.c | |||
@@ -119,7 +119,7 @@ struct squashfs_cache_entry *squashfs_cache_get(struct super_block *sb, | |||
119 | 119 | ||
120 | entry->length = squashfs_read_data(sb, entry->data, | 120 | entry->length = squashfs_read_data(sb, entry->data, |
121 | block, length, &entry->next_index, | 121 | block, length, &entry->next_index, |
122 | cache->block_size); | 122 | cache->block_size, cache->pages); |
123 | 123 | ||
124 | spin_lock(&cache->lock); | 124 | spin_lock(&cache->lock); |
125 | 125 | ||
@@ -406,7 +406,7 @@ int squashfs_read_table(struct super_block *sb, void *buffer, u64 block, | |||
406 | for (i = 0; i < pages; i++, buffer += PAGE_CACHE_SIZE) | 406 | for (i = 0; i < pages; i++, buffer += PAGE_CACHE_SIZE) |
407 | data[i] = buffer; | 407 | data[i] = buffer; |
408 | res = squashfs_read_data(sb, data, block, length | | 408 | res = squashfs_read_data(sb, data, block, length | |
409 | SQUASHFS_COMPRESSED_BIT_BLOCK, NULL, length); | 409 | SQUASHFS_COMPRESSED_BIT_BLOCK, NULL, length, pages); |
410 | kfree(data); | 410 | kfree(data); |
411 | return res; | 411 | return res; |
412 | } | 412 | } |
diff --git a/fs/squashfs/inode.c b/fs/squashfs/inode.c index 7a63398bb855..9101dbde39ec 100644 --- a/fs/squashfs/inode.c +++ b/fs/squashfs/inode.c | |||
@@ -133,7 +133,8 @@ int squashfs_read_inode(struct inode *inode, long long ino) | |||
133 | type = le16_to_cpu(sqshb_ino->inode_type); | 133 | type = le16_to_cpu(sqshb_ino->inode_type); |
134 | switch (type) { | 134 | switch (type) { |
135 | case SQUASHFS_REG_TYPE: { | 135 | case SQUASHFS_REG_TYPE: { |
136 | unsigned int frag_offset, frag_size, frag; | 136 | unsigned int frag_offset, frag; |
137 | int frag_size; | ||
137 | u64 frag_blk; | 138 | u64 frag_blk; |
138 | struct squashfs_reg_inode *sqsh_ino = &squashfs_ino.reg; | 139 | struct squashfs_reg_inode *sqsh_ino = &squashfs_ino.reg; |
139 | 140 | ||
@@ -175,7 +176,8 @@ int squashfs_read_inode(struct inode *inode, long long ino) | |||
175 | break; | 176 | break; |
176 | } | 177 | } |
177 | case SQUASHFS_LREG_TYPE: { | 178 | case SQUASHFS_LREG_TYPE: { |
178 | unsigned int frag_offset, frag_size, frag; | 179 | unsigned int frag_offset, frag; |
180 | int frag_size; | ||
179 | u64 frag_blk; | 181 | u64 frag_blk; |
180 | struct squashfs_lreg_inode *sqsh_ino = &squashfs_ino.lreg; | 182 | struct squashfs_lreg_inode *sqsh_ino = &squashfs_ino.lreg; |
181 | 183 | ||
diff --git a/fs/squashfs/squashfs.h b/fs/squashfs/squashfs.h index 6b2515d027d5..0e9feb6adf7e 100644 --- a/fs/squashfs/squashfs.h +++ b/fs/squashfs/squashfs.h | |||
@@ -34,7 +34,7 @@ static inline struct squashfs_inode_info *squashfs_i(struct inode *inode) | |||
34 | 34 | ||
35 | /* block.c */ | 35 | /* block.c */ |
36 | extern int squashfs_read_data(struct super_block *, void **, u64, int, u64 *, | 36 | extern int squashfs_read_data(struct super_block *, void **, u64, int, u64 *, |
37 | int); | 37 | int, int); |
38 | 38 | ||
39 | /* cache.c */ | 39 | /* cache.c */ |
40 | extern struct squashfs_cache *squashfs_cache_init(char *, int, int); | 40 | extern struct squashfs_cache *squashfs_cache_init(char *, int, int); |
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c index 071df5b5b491..681ec0d83799 100644 --- a/fs/squashfs/super.c +++ b/fs/squashfs/super.c | |||
@@ -389,7 +389,7 @@ static int __init init_squashfs_fs(void) | |||
389 | return err; | 389 | return err; |
390 | } | 390 | } |
391 | 391 | ||
392 | printk(KERN_INFO "squashfs: version 4.0 (2009/01/03) " | 392 | printk(KERN_INFO "squashfs: version 4.0 (2009/01/31) " |
393 | "Phillip Lougher\n"); | 393 | "Phillip Lougher\n"); |
394 | 394 | ||
395 | return 0; | 395 | return 0; |