Author: zbyniu                       Date: Thu Nov 13 13:24:26 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- extracted from sqlzma3.3-457.tar.bz2 and ported for 3.4 @ 2.6.27

---- Files affected:
SOURCES:
   squashfs_lzma-sqlzma2k-3.3.patch (NONE -> 1.1)  (NEW), 
squashfs_lzma-sqlzma2u-3.3.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/squashfs_lzma-sqlzma2k-3.3.patch
diff -u /dev/null SOURCES/squashfs_lzma-sqlzma2k-3.3.patch:1.1
--- /dev/null   Thu Nov 13 14:24:27 2008
+++ SOURCES/squashfs_lzma-sqlzma2k-3.3.patch    Thu Nov 13 14:24:20 2008
@@ -0,0 +1,688 @@
+diff -purN linux-2.6.24/fs/squashfs/Makefile linux-2.6.24/fs/squashfs/Makefile
+--- linux-2.6.24/fs/squashfs/Makefile  2005-11-20 14:31:00.000000000 +0000
++++ linux-2.6.24/fs/squashfs/Makefile  2007-12-04 12:17:22.277418433 +0000
+@@ -2,6 +2,8 @@
+ # Makefile for the linux squashfs routines.
+ #
+ 
++-include /tmp/sqvars.mk
++
+ obj-$(CONFIG_SQUASHFS) += squashfs.o
+ squashfs-y += inode.o
+ squashfs-y += squashfs2_0.o
+diff -purN linux-2.6.24/fs/squashfs/inode.c linux-2.6.24/fs/squashfs/inode.c
+--- linux-2.6.24/fs/squashfs/inode.c   2007-11-08 19:21:23.000000000 +0000
++++ linux-2.6.24/fs/squashfs/inode.c   2007-12-04 12:19:14.129270334 +0000
+@@ -33,6 +33,28 @@
+ #include <linux/smp_lock.h>
+ 
+ #include "squashfs.h"
++#include "sqlzma.h"
++#include "sqmagic.h"
++  
++#undef KeepPreemptive
++#if defined(CONFIG_PREEMPT) && !defined(UnsquashNoPreempt)
++#define KeepPreemptive
++#endif
++
++struct sqlzma {
++#ifdef KeepPreemptive
++      struct mutex mtx;
++#endif
++      unsigned char read_data[SQUASHFS_FILE_MAX_SIZE];
++      struct sqlzma_un un;
++};
++static DEFINE_PER_CPU(struct sqlzma *, sqlzma);
++
++#define dpri(fmt, args...) /* printk("%s:%d: " fmt, __func__, __LINE__, 
##args) */
++#define dpri_un(un)   dpri("un{%d, {%d %p}, {%d %p}, {%d %p}}\n", \
++                           (un)->un_lzma, (un)->un_a[0].sz, 
(un)->un_a[0].buf, \
++                           (un)->un_a[1].sz, (un)->un_a[1].buf, \
++                           (un)->un_a[2].sz, (un)->un_a[2].buf)
+ 
+ static int squashfs_cached_blks;
+ 
+@@ -218,7 +240,8 @@ SQSH_EXTERN unsigned int squashfs_read_d
+               if (index < 0 || (index + 2) > sblk->bytes_used)
+                       goto read_failure;
+ 
+-              bh[0] = get_block_length(s, &cur_index, &offset, &c_byte);
++              bh[0] = get_block_length(s, (int *)&cur_index, (int *)&offset,
++                                       (int *)&c_byte);
+               if (bh[0] == NULL)
+                       goto read_failure;
+ 
+@@ -242,66 +265,75 @@ SQSH_EXTERN unsigned int squashfs_read_d
+       }
+ 
+       if (compressed) {
+-              int zlib_err = 0;
++              int zlib_err = Z_STREAM_END;
++              int rest, start;
++              enum {Src, Dst};
++              struct sized_buf sbuf[2];
++              struct sqlzma *percpu;
+ 
+               /*
+               * uncompress block
+               */
+ 
+-              mutex_lock(&msblk->read_data_mutex);
+-
+-              msblk->stream.next_out = buffer;
+-              msblk->stream.avail_out = srclength;
+-
+-              for (bytes = 0; k < b; k++) {
+-                      avail_bytes = min(c_byte - bytes, msblk->devblksize - 
offset);
+-
++              for (k = 0; k < b; k++) {
+                       wait_on_buffer(bh[k]);
+                       if (!buffer_uptodate(bh[k]))
+-                              goto release_mutex;
+-
+-                      msblk->stream.next_in = bh[k]->b_data + offset;
+-                      msblk->stream.avail_in = avail_bytes;
+-
+-                      if (k == 0) {
+-                              zlib_err = zlib_inflateInit(&msblk->stream);
+-                              if (zlib_err != Z_OK) {
+-                                      ERROR("zlib_inflateInit returned 
unexpected result 0x%x,"
+-                                              " srclength %d\n", zlib_err, 
srclength);
+-                                      goto release_mutex;
+-                              }
+-
+-                              if (avail_bytes == 0) {
+-                                      offset = 0;
+-                                      brelse(bh[k]);
+-                                      continue;
+-                              }
+-                      }
+-
+-                      zlib_err = zlib_inflate(&msblk->stream, Z_NO_FLUSH);
+-                      if (zlib_err != Z_OK && zlib_err != Z_STREAM_END) {
+-                              ERROR("zlib_inflate returned unexpected result 
0x%x,"
+-                                      " srclength %d, avail_in %d, avail_out 
%d\n", zlib_err,
+-                                      srclength, msblk->stream.avail_in, 
msblk->stream.avail_out);
+-                              goto release_mutex;
+-                      }
++                              goto block_release;
++              }
+ 
+-                      bytes += avail_bytes;
++              avail_bytes = 0;
++              for (k = 0; !avail_bytes && k < b; k++) {
++                      avail_bytes = msblk->devblksize - offset;
++                      if (c_byte < avail_bytes)
++                              avail_bytes = c_byte;
++                      if (avail_bytes)
++                              break;
+                       offset = 0;
+                       brelse(bh[k]);
+               }
++              bytes = 0;
++              if (!avail_bytes)
++                      goto block_release; // nothing to be process
+ 
+-              if (zlib_err != Z_STREAM_END)
+-                      goto release_mutex;
+-
+-              zlib_err = zlib_inflateEnd(&msblk->stream);
+-              if (zlib_err != Z_OK) {
+-                      ERROR("zlib_inflateEnd returned unexpected result 0x%x,"
+-                              " srclength %d\n", zlib_err, srclength);
++              start = k;
++              /* it disables preemption */
++              percpu = get_cpu_var(sqlzma);
++#ifdef KeepPreemptive
++              put_cpu_var(sqlzma);
++              mutex_lock(&percpu->mtx);
++#endif
++
++              for (; k < b; k++) {
++                      memcpy(percpu->read_data + bytes, bh[k]->b_data + 
offset,
++                             avail_bytes);
++                      bytes += avail_bytes;
++                      offset = 0;
++                      brelse(bh[k]);
++                      avail_bytes = msblk->devblksize - offset;
++                      rest = c_byte - bytes;
++                      if (rest < avail_bytes)
++                              avail_bytes = rest;
++              }
++
++              sbuf[Src].buf = percpu->read_data;
++              sbuf[Src].sz = bytes;
++              sbuf[Dst].buf = buffer;
++              sbuf[Dst].sz = srclength;
++              dpri_un(&percpu->un);
++              dpri("src %d %p, dst %d %p\n", sbuf[Src].sz, sbuf[Src].buf,
++                   sbuf[Dst].sz, sbuf[Dst].buf);
++              zlib_err = sqlzma_un(&percpu->un, sbuf + Src, sbuf + Dst);
++              bytes = percpu->un.un_reslen;
++
++#ifdef KeepPreemptive
++              mutex_unlock(&percpu->mtx);
++#else
++              put_cpu_var(sqlzma);
++#endif
++              if (unlikely(zlib_err)) {
++                      dpri("zlib_err %d\n", zlib_err);
+                       goto release_mutex;
+               }
+-              bytes = msblk->stream.total_out;
+-              mutex_unlock(&msblk->read_data_mutex);
+       } else {
+               int i;
+ 
+@@ -329,7 +361,7 @@ SQSH_EXTERN unsigned int squashfs_read_d
+       return bytes;
+ 
+ release_mutex:
+-      mutex_unlock(&msblk->read_data_mutex);
++      //mutex_unlock(&msblk->read_data_mutex);
+ 
+ block_release:
+       for (; k < b; k++)
+@@ -470,12 +502,14 @@ static int get_fragment_location(struct 
+               struct squashfs_fragment_entry sfragment_entry;
+ 
+               if (!squashfs_get_cached_block(s, &sfragment_entry, 
start_block, offset,
+-                                       sizeof(sfragment_entry), &start_block, 
&offset))
++                                       sizeof(sfragment_entry), &start_block,
++                                             (unsigned int *)&offset))
+                       goto out;
+               SQUASHFS_SWAP_FRAGMENT_ENTRY(&fragment_entry, &sfragment_entry);
+       } else
+               if (!squashfs_get_cached_block(s, &fragment_entry, start_block, 
offset,
+-                                       sizeof(fragment_entry), &start_block, 
&offset))
++                                       sizeof(fragment_entry), &start_block,
++                                             (unsigned int *)&offset))
+                       goto out;
+ 
+       *fragment_start_block = fragment_entry.start_block;
+@@ -615,11 +649,11 @@ static squashfs_inode_t squashfs_inode_l
+               squashfs_inode_t sinode;
+ 
+               if (!squashfs_get_cached_block(s, &sinode, start, offset,
+-                                      sizeof(sinode), &start, &offset))
++                                      sizeof(sinode), &start, (unsigned int 
*)&offset))
+                       goto out;
+               SQUASHFS_SWAP_INODE_T((&inode), &sinode);
+       } else if (!squashfs_get_cached_block(s, &inode, start, offset,
+-                                      sizeof(inode), &start, &offset))
++                                      sizeof(inode), &start, (unsigned int 
*)&offset))
+                       goto out;
+ 
+       TRACE("squashfs_inode_lookup, inode = 0x%llx\n", inode);
+@@ -1088,11 +1122,13 @@ static int squashfs_fill_super(struct su
+ {
+       struct squashfs_sb_info *msblk;
+       struct squashfs_super_block *sblk;
++      int err;
+       char b[BDEVNAME_SIZE];
+       struct inode *root;
+ 
+       TRACE("Entered squashfs_fill_superblock\n");
+ 
++      err = -ENOMEM;
+       s->s_fs_info = kzalloc(sizeof(struct squashfs_sb_info), GFP_KERNEL);
+       if (s->s_fs_info == NULL) {
+               ERROR("Failed to allocate superblock\n");
+@@ -1101,17 +1136,12 @@ static int squashfs_fill_super(struct su
+       }
+       msblk = s->s_fs_info;
+ 
+-      msblk->stream.workspace = vmalloc(zlib_inflate_workspacesize());
+-      if (msblk->stream.workspace == NULL) {
+-              ERROR("Failed to allocate zlib workspace\n");
+-              goto failure;
+-      }
+       sblk = &msblk->sblk;
+       
+       msblk->devblksize = sb_min_blocksize(s, BLOCK_SIZE);
+       msblk->devblksize_log2 = ffz(~msblk->devblksize);
+ 
+-      mutex_init(&msblk->read_data_mutex);
++      //mutex_init(&msblk->read_data_mutex);
+       mutex_init(&msblk->read_page_mutex);
+       mutex_init(&msblk->block_cache_mutex);
+       mutex_init(&msblk->fragment_mutex);
+@@ -1123,6 +1153,7 @@ static int squashfs_fill_super(struct su
+       /* sblk->bytes_used is checked in squashfs_read_data to ensure reads 
are not
+        * beyond filesystem end.  As we're using squashfs_read_data to read 
sblk here,
+        * first set sblk->bytes_used to a useful value */
++      err = -EINVAL;
+       sblk->bytes_used = sizeof(struct squashfs_super_block);
+       if (!squashfs_read_data(s, (char *) sblk, SQUASHFS_START,
+                                       sizeof(struct squashfs_super_block) |
+@@ -1132,21 +1163,35 @@ static int squashfs_fill_super(struct su
+       }
+ 
+       /* Check it is a SQUASHFS superblock */
+-      if ((s->s_magic = sblk->s_magic) != SQUASHFS_MAGIC) {
+-              if (sblk->s_magic == SQUASHFS_MAGIC_SWAP) {
+-                      struct squashfs_super_block ssblk;
+-
+-                      WARNING("Mounting a different endian SQUASHFS 
filesystem on %s\n",
+-                              bdevname(s->s_bdev, b));
+-
+-                      SQUASHFS_SWAP_SUPER_BLOCK(&ssblk, sblk);
+-                      memcpy(sblk, &ssblk, sizeof(struct 
squashfs_super_block));
+-                      msblk->swap = 1;
+-              } else  {
+-                      SERROR("Can't find a SQUASHFS superblock on %s\n",
+-                                                      bdevname(s->s_bdev, b));
+-                      goto failed_mount;
+-              }
++      s->s_magic = sblk->s_magic;
++      msblk->swap = 0;
++      dpri("magic 0x%x\n", sblk->s_magic);
++      switch (sblk->s_magic) {
++              struct squashfs_super_block ssblk;
++
++      case SQUASHFS_MAGIC_SWAP:
++              /*FALLTHROUGH*/
++      case SQUASHFS_MAGIC_LZMA_SWAP:
++              WARNING("Mounting a different endian SQUASHFS "
++                      "filesystem on %s\n", bdevname(s->s_bdev, b));
++
++              SQUASHFS_SWAP_SUPER_BLOCK(&ssblk, sblk);
++              memcpy(sblk, &ssblk, sizeof(struct squashfs_super_block));
++              msblk->swap = 1;
++              /*FALLTHROUGH*/
++      case SQUASHFS_MAGIC:
++      case SQUASHFS_MAGIC_LZMA:
++              break;
++      default:
++              SERROR("Can't find a SQUASHFS superblock on %s\n",
++                     bdevname(s->s_bdev, b));
++              goto failed_mount;
++      }
++
++      {
++              struct sqlzma *p;
++              dpri("block_size %d\n", sblk->block_size);
++              BUG_ON(sblk->block_size > sizeof(p->read_data));
+       }
+ 
+       /* Check the MAJOR & MINOR versions */
+@@ -1190,6 +1235,7 @@ static int squashfs_fill_super(struct su
+               goto failed_mount;
+ 
+       /* Allocate read_page block */
++      err = -ENOMEM;
+       msblk->read_page = vmalloc(sblk->block_size);
+       if (msblk->read_page == NULL) {
+               ERROR("Failed to allocate read_page block\n");
+@@ -1205,19 +1251,30 @@ static int squashfs_fill_super(struct su
+       }
+       msblk->guid = msblk->uid + sblk->no_uids;
+    
++      dpri("swap %d\n", msblk->swap);
++      err = -EINVAL;
+       if (msblk->swap) {
+-              unsigned int suid[sblk->no_uids + sblk->no_guids];
++              unsigned int *suid;
++
++              err = -ENOMEM;
++              suid = kmalloc(sizeof(*suid) * (sblk->no_uids + sblk->no_guids),
++                             GFP_KERNEL);
++              if (unlikely(!suid))
++                      goto failed_mount;
+ 
+-              if (!squashfs_read_data(s, (char *) &suid, sblk->uid_start,
++              err = -EINVAL;
++              if (!squashfs_read_data(s, (char *)suid, sblk->uid_start,
+                                       ((sblk->no_uids + sblk->no_guids) *
+                                        sizeof(unsigned int)) |
+                                       SQUASHFS_COMPRESSED_BIT_BLOCK, NULL, 
(sblk->no_uids + sblk->no_guids) * sizeof(unsigned int))) {
+                       ERROR("unable to read uid/gid table\n");
++                      kfree(suid);
+                       goto failed_mount;
+               }
+ 
+               SQUASHFS_SWAP_DATA(msblk->uid, suid, (sblk->no_uids +
+                       sblk->no_guids), (sizeof(unsigned int) * 8));
++              kfree(suid);
+       } else
+               if (!squashfs_read_data(s, (char *) msblk->uid, sblk->uid_start,
+                                       ((sblk->no_uids + sblk->no_guids) *
+@@ -1231,6 +1288,7 @@ static int squashfs_fill_super(struct su
+       if (sblk->s_major == 1 && squashfs_1_0_supported(msblk))
+               goto allocate_root;
+ 
++      err = -ENOMEM;
+       msblk->fragment_cache = squashfs_cache_init("fragment",
+               SQUASHFS_CACHED_FRAGMENTS, sblk->block_size, 1);
+       if (msblk->fragment_cache == NULL)
+@@ -1260,9 +1318,12 @@ static int squashfs_fill_super(struct su
+       s->s_export_op = &squashfs_export_ops;
+ 
+ allocate_root:
++      dpri("alloate_root\n");
+       root = new_inode(s);
+-      if ((msblk->read_inode)(root, sblk->root_inode) == 0)
++      if ((msblk->read_inode)(root, sblk->root_inode) == 0) {
++              iput(root);
+               goto failed_mount;
++      }
+       insert_inode_hash(root);
+ 
+       s->s_root = d_alloc_root(root);
+@@ -1283,13 +1344,10 @@ failed_mount:
+       vfree(msblk->read_page);
+       kfree(msblk->block_cache);
+       kfree(msblk->fragment_index_2);
+-      vfree(msblk->stream.workspace);
+       kfree(s->s_fs_info);
+       s->s_fs_info = NULL;
+-      return -EINVAL;
+-
+-failure:
+-      return -ENOMEM;
++ failure:
++      return err;
+ }
+ 
+ 
+@@ -1300,7 +1358,7 @@ static int squashfs_statfs(struct dentry
+ 
+       TRACE("Entered squashfs_statfs\n");
+ 
+-      buf->f_type = SQUASHFS_MAGIC;
++      buf->f_type = sblk->s_magic;
+       buf->f_bsize = sblk->block_size;
+       buf->f_blocks = ((sblk->bytes_used - 1) >> sblk->block_log) + 1;
+       buf->f_bfree = buf->f_bavail = 0;
+@@ -1327,7 +1385,8 @@ static int squashfs_symlink_readpage(str
+ 
+       for (length = 0; length < index; length += bytes) {
+               bytes = squashfs_get_cached_block(inode->i_sb, NULL, block,
+-                              offset, PAGE_CACHE_SIZE, &block, &offset);
++                              offset, PAGE_CACHE_SIZE, &block,
++                                                (unsigned int *)&offset);
+               if (bytes == 0) {
+                       ERROR("Unable to read symbolic link [%llx:%x]\n", 
block, offset);
+                       goto skip_read;
+@@ -1343,7 +1402,7 @@ static int squashfs_symlink_readpage(str
+       avail_bytes = min_t(int, i_size_read(inode) - length, PAGE_CACHE_SIZE);
+ 
+       bytes = squashfs_get_cached_block(inode->i_sb, pageaddr, block, offset,
+-              avail_bytes, &block, &offset);
++              avail_bytes, &block, (unsigned int *)&offset);
+       if (bytes == 0)
+               ERROR("Unable to read symbolic link [%llx:%x]\n", block, 
offset);
+ 
+@@ -1462,18 +1521,24 @@ static int read_block_index(struct super
+       int block = 0;
+       
+       if (msblk->swap) {
+-              char sblock_list[blocks << 2];
++              char *sblock_list;
++
++              sblock_list = kmalloc(blocks << 2, GFP_KERNEL);
++              if (unlikely(!sblock_list))
++                      goto failure;
+ 
+               if (!squashfs_get_cached_block(s, sblock_list, *start_block,
+-                              *offset, blocks << 2, start_block, offset)) {
++                              *offset, blocks << 2, start_block, (unsigned 
int *)offset)) {
+                       ERROR("Fail reading block list [%llx:%x]\n", 
*start_block, *offset);
++                      kfree(sblock_list);
+                       goto failure;
+               }
+               SQUASHFS_SWAP_INTS(((unsigned int *)block_list),
+                               ((unsigned int *)sblock_list), blocks);
++              kfree(sblock_list);
+       } else {
+               if (!squashfs_get_cached_block(s, block_list, *start_block,
+-                              *offset, blocks << 2, start_block, offset)) {
++                              *offset, blocks << 2, start_block, (unsigned 
int *)offset)) {
+                       ERROR("Fail reading block list [%llx:%x]\n", 
*start_block, *offset);
+                       goto failure;
+               }
+@@ -1889,7 +1954,8 @@ static int squashfs_readdir(struct file 
+               file->f_pos += size;
+       }
+ 
+-      length = get_dir_index_using_offset(i->i_sb, &next_block, &next_offset,
++      length = get_dir_index_using_offset(i->i_sb, &next_block,
++                                          (unsigned int *)&next_offset,
+                               SQUASHFS_I(i)->u.s2.directory_index_start,
+                               SQUASHFS_I(i)->u.s2.directory_index_offset,
+                               SQUASHFS_I(i)->u.s2.directory_index_count, 
file->f_pos);
+@@ -1900,14 +1966,16 @@ static int squashfs_readdir(struct file 
+                       struct squashfs_dir_header sdirh;
+                       
+                       if (!squashfs_get_cached_block(i->i_sb, &sdirh, 
next_block,
+-                                       next_offset, sizeof(sdirh), 
&next_block, &next_offset))
++                                       next_offset, sizeof(sdirh), 
&next_block,
++                                                     (unsigned int 
*)&next_offset))
+                               goto failed_read;
+ 
+                       length += sizeof(sdirh);
+                       SQUASHFS_SWAP_DIR_HEADER(&dirh, &sdirh);
+               } else {
+                       if (!squashfs_get_cached_block(i->i_sb, &dirh, 
next_block,
+-                                      next_offset, sizeof(dirh), &next_block, 
&next_offset))
++                                      next_offset, sizeof(dirh), &next_block,
++                                                     (unsigned int 
*)&next_offset))
+                               goto failed_read;
+ 
+                       length += sizeof(dirh);
+@@ -1918,21 +1986,24 @@ static int squashfs_readdir(struct file 
+                       if (msblk->swap) {
+                               struct squashfs_dir_entry sdire;
+                               if (!squashfs_get_cached_block(i->i_sb, &sdire, 
next_block,
+-                                              next_offset, sizeof(sdire), 
&next_block, &next_offset))
++                                              next_offset, sizeof(sdire), 
&next_block,
++                                                             (unsigned int 
*)&next_offset))
+                                       goto failed_read;
+                               
+                               length += sizeof(sdire);
+                               SQUASHFS_SWAP_DIR_ENTRY(dire, &sdire);
+                       } else {
+                               if (!squashfs_get_cached_block(i->i_sb, dire, 
next_block,
+-                                              next_offset, sizeof(*dire), 
&next_block, &next_offset))
++                                              next_offset, sizeof(*dire), 
&next_block,
++                                                             (unsigned int 
*)&next_offset))
+                                       goto failed_read;
+ 
+                               length += sizeof(*dire);
+                       }
+ 
+                       if (!squashfs_get_cached_block(i->i_sb, dire->name, 
next_block,
+-                                              next_offset, dire->size + 1, 
&next_block, &next_offset))
++                                              next_offset, dire->size + 1, 
&next_block,
++                                                     (unsigned int 
*)&next_offset))
+                               goto failed_read;
+ 
+                       length += dire->size + 1;
+@@ -1996,7 +2067,7 @@ static struct dentry *squashfs_lookup(st
+       if (len > SQUASHFS_NAME_LEN)
+               goto exit_lookup;
+ 
+-      length = get_dir_index_using_name(i->i_sb, &next_block, &next_offset,
++      length = get_dir_index_using_name(i->i_sb, &next_block, (unsigned int 
*)&next_offset,
+                               SQUASHFS_I(i)->u.s2.directory_index_start,
+                               SQUASHFS_I(i)->u.s2.directory_index_offset,
+                               SQUASHFS_I(i)->u.s2.directory_index_count, 
name, len);
+@@ -2006,14 +2077,16 @@ static struct dentry *squashfs_lookup(st
+               if (msblk->swap) {
+                       struct squashfs_dir_header sdirh;
+                       if (!squashfs_get_cached_block(i->i_sb, &sdirh, 
next_block,
+-                                       next_offset, sizeof(sdirh), 
&next_block, &next_offset))
++                                       next_offset, sizeof(sdirh), 
&next_block,
++                                                     (unsigned int 
*)&next_offset))
+                               goto failed_read;
+ 
+                       length += sizeof(sdirh);
+                       SQUASHFS_SWAP_DIR_HEADER(&dirh, &sdirh);
+               } else {
+                       if (!squashfs_get_cached_block(i->i_sb, &dirh, 
next_block,
+-                                      next_offset, sizeof(dirh), &next_block, 
&next_offset))
++                                      next_offset, sizeof(dirh), &next_block,
++                                                     (unsigned int 
*)&next_offset))
+                               goto failed_read;
+ 
+                       length += sizeof(dirh);
+@@ -2024,21 +2097,24 @@ static struct dentry *squashfs_lookup(st
+                       if (msblk->swap) {
+                               struct squashfs_dir_entry sdire;
+                               if (!squashfs_get_cached_block(i->i_sb, &sdire, 
next_block,
+-                                              next_offset, sizeof(sdire), 
&next_block, &next_offset))
++                                              next_offset, sizeof(sdire), 
&next_block,
++                                                             (unsigned int 
*)&next_offset))
+                                       goto failed_read;
+                               
+                               length += sizeof(sdire);
+                               SQUASHFS_SWAP_DIR_ENTRY(dire, &sdire);
+                       } else {
+                               if (!squashfs_get_cached_block(i->i_sb, dire, 
next_block,
+-                                              next_offset, sizeof(*dire), 
&next_block, &next_offset))
++                                              next_offset, sizeof(*dire), 
&next_block,
++                                                             (unsigned int 
*)&next_offset))
+                                       goto failed_read;
+ 
+                               length += sizeof(*dire);
+                       }
+ 
+                       if (!squashfs_get_cached_block(i->i_sb, dire->name, 
next_block,
+-                                      next_offset, dire->size + 1, 
&next_block, &next_offset))
++                                      next_offset, dire->size + 1, 
&next_block,
++                                                     (unsigned int 
*)&next_offset))
+                               goto failed_read;
+ 
+                       length += dire->size + 1;
+@@ -2102,7 +2178,6 @@ static void squashfs_put_super(struct su
+               kfree(sbi->fragment_index);
+               kfree(sbi->fragment_index_2);
+               kfree(sbi->meta_index);
+-              vfree(sbi->stream.workspace);
+               kfree(s->s_fs_info);
+               s->s_fs_info = NULL;
+       }
+@@ -2116,19 +2191,63 @@ static int squashfs_get_sb(struct file_s
+                               mnt);
+ }
+ 
++static void free_sqlzma(void)
++{
++      int cpu;
++      struct sqlzma *p;
++
++      for_each_online_cpu(cpu) {
++              p = per_cpu(sqlzma, cpu);
++              if (p) {
++#ifdef KeepPreemptive
++                      mutex_destroy(&p->mtx);
++#endif
++                      sqlzma_fin(&p->un);
++                      kfree(p);
++              }
++      }
++}
+ 
+ static int __init init_squashfs_fs(void)
+ {
++      struct sqlzma *p;
++      int cpu;
+       int err = init_inodecache();
+       if (err)
<<Diff was trimmed, longer than 597 lines>>
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to