Squashfs: Refactor decompressor interface and code
[pandora-kernel.git] / fs / squashfs / lzo_wrapper.c
index 00f4dfc..75c3b57 100644 (file)
@@ -37,7 +37,7 @@ struct squashfs_lzo {
        void    *output;
 };
 
-static void *lzo_init(struct squashfs_sb_info *msblk, void *buff, int len)
+static void *lzo_init(struct squashfs_sb_info *msblk, void *buff)
 {
        int block_size = max_t(int, msblk->block_size, SQUASHFS_METADATA_SIZE);
 
@@ -74,22 +74,16 @@ static void lzo_free(void *strm)
 }
 
 
-static int lzo_uncompress(struct squashfs_sb_info *msblk, void **buffer,
-       struct buffer_head **bh, int b, int offset, int length, int srclength,
-       int pages)
+static int lzo_uncompress(struct squashfs_sb_info *msblk, void *strm,
+       void **buffer, struct buffer_head **bh, int b, int offset, int length,
+       int srclength, int pages)
 {
-       struct squashfs_lzo *stream = msblk->stream;
+       struct squashfs_lzo *stream = strm;
        void *buff = stream->input;
        int avail, i, bytes = length, res;
        size_t out_len = srclength;
 
-       mutex_lock(&msblk->read_data_mutex);
-
        for (i = 0; i < b; i++) {
-               wait_on_buffer(bh[i]);
-               if (!buffer_uptodate(bh[i]))
-                       goto block_release;
-
                avail = min(bytes, msblk->devblksize - offset);
                memcpy(buff, bh[i]->b_data + offset, avail);
                buff += avail;
@@ -111,17 +105,9 @@ static int lzo_uncompress(struct squashfs_sb_info *msblk, void **buffer,
                bytes -= avail;
        }
 
-       mutex_unlock(&msblk->read_data_mutex);
        return res;
 
-block_release:
-       for (; i < b; i++)
-               put_bh(bh[i]);
-
 failed:
-       mutex_unlock(&msblk->read_data_mutex);
-
-       ERROR("lzo decompression failed, data probably corrupt\n");
        return -EIO;
 }