Skip to content

Commit

Permalink
Squashfs: Optimized uncompressed buffer loop
Browse files Browse the repository at this point in the history
Merged the two for loops. We might get a little gain by overlapping
wait_on_bh and the memcpy operations.

Signed-off-by: Manish Sharma <manishrma@gmail.com>
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
  • Loading branch information
Manish Sharma authored and Phillip Lougher committed Sep 4, 2013
1 parent 28d7b56 commit e012526
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions fs/squashfs/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,14 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
/*
* Block is uncompressed.
*/
int i, in, pg_offset = 0;

for (i = 0; i < b; i++) {
wait_on_buffer(bh[i]);
if (!buffer_uptodate(bh[i]))
goto block_release;
}
int in, pg_offset = 0;

for (bytes = length; k < b; k++) {
in = min(bytes, msblk->devblksize - offset);
bytes -= in;
wait_on_buffer(bh[k]);
if (!buffer_uptodate(bh[k]))
goto block_release;
while (in) {
if (pg_offset == PAGE_CACHE_SIZE) {
page++;
Expand Down

0 comments on commit e012526

Please sign in to comment.