SOURCES: squashfs_lzma-module.patch - updated to 3.0, not tested yet
sparky
sparky at pld-linux.org
Sat Mar 18 21:52:00 CET 2006
Author: sparky Date: Sat Mar 18 20:52:00 2006 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- updated to 3.0, not tested yet
---- Files affected:
SOURCES:
squashfs_lzma-module.patch (1.1 -> 1.2)
---- Diffs:
================================================================
Index: SOURCES/squashfs_lzma-module.patch
diff -u SOURCES/squashfs_lzma-module.patch:1.1 SOURCES/squashfs_lzma-module.patch:1.2
--- SOURCES/squashfs_lzma-module.patch:1.1 Fri Dec 9 23:15:28 2005
+++ SOURCES/squashfs_lzma-module.patch Sat Mar 18 21:51:55 2006
@@ -1,11 +1,12 @@
-diff -Nur /dev/null squashfs/inode.c
---- /dev/null 1970-01-01 01:00:00.000000000 +0100
-+++ squashfs/inode.c 2005-12-09 20:41:33.000000000 +0100
-@@ -0,0 +1,1844 @@
+diff -Nur empty/inode.c squashfs/inode.c
+--- squashfs/inode.c 1970-01-01 01:00:00.000000000 +0100
++++ squashfs/inode.c 2006-03-18 21:07:50.000000000 +0100
+@@ -0,0 +1,2164 @@
+/*
+ * Squashfs - a compressed read only filesystem for Linux
+ *
-+ * Copyright (c) 2002, 2003, 2004, 2005 Phillip Lougher <phillip at lougher.demon.co.uk>
++ * Copyright (c) 2002, 2003, 2004, 2005, 2006
++ * Phillip Lougher <phillip at lougher.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
@@ -25,8 +26,6 @@
+ */
+
+#define SQUASHFS_LZMA
-+
-+#define SQUASHFS_1_0_COMPATIBILITY
+
+#include <linux/types.h>
+#include "squashfs_fs.h"
@@ -42,29 +41,18 @@
+#include <linux/vfs.h>
+#include <linux/init.h>
+#include <linux/dcache.h>
-+#include <asm/uaccess.h>
+#include <linux/wait.h>
-+#include <asm/semaphore.h>
-+
+#ifdef SQUASHFS_LZMA
-+#include "LzmaWrapper.h"
++# include "LzmaWrapper.h"
+#else
-+#include <linux/zlib.h>
++# include <linux/zlib.h>
+#endif
-+
+#include <linux/blkdev.h>
+#include <linux/vmalloc.h>
++#include <asm/uaccess.h>
++#include <asm/semaphore.h>
+
-+#ifdef SQUASHFS_TRACE
-+#define TRACE(s, args...) printk(KERN_NOTICE "SQUASHFS: "s, ## args)
-+#else
-+#define TRACE(s, args...) {}
-+#endif
-+
-+#define ERROR(s, args...) printk(KERN_ERR "SQUASHFS error: "s, ## args)
-+
-+#define SERROR(s, args...) if(!silent) printk(KERN_ERR "SQUASHFS error: "s, ## args)
-+#define WARNING(s, args...) printk(KERN_WARNING "SQUASHFS: "s, ## args)
++#include "squashfs.h"
+
+static void squashfs_put_super(struct super_block *);
+static int squashfs_statfs(struct super_block *, struct kstatfs *);
@@ -72,30 +60,19 @@
+static int squashfs_readpage(struct file *file, struct page *page);
+static int squashfs_readpage4K(struct file *file, struct page *page);
+static int squashfs_readdir(struct file *, void *, filldir_t);
-+static struct dentry *squashfs_lookup(struct inode *, struct dentry *, struct nameidata *);
-+static unsigned int read_data(struct super_block *s, char *buffer,
-+ unsigned int index, unsigned int length, unsigned int *next_index);
-+static int squashfs_get_cached_block(struct super_block *s, char *buffer,
-+ unsigned int block, unsigned int offset, int length,
-+ unsigned int *next_block, unsigned int *next_offset);
-+static struct inode *squashfs_iget(struct super_block *s, squashfs_inode inode);
-+static unsigned int read_blocklist(struct inode *inode, int index, int readahead_blks,
-+ char *block_list, unsigned short **block_p, unsigned int *bsize);
-+static void squashfs_put_super(struct super_block *s);
-+static struct super_block *squashfs_get_sb(struct file_system_type *, int, const char *, void *);
+static struct inode *squashfs_alloc_inode(struct super_block *sb);
+static void squashfs_destroy_inode(struct inode *inode);
+static int init_inodecache(void);
+static void destroy_inodecache(void);
++static struct dentry *squashfs_lookup(struct inode *, struct dentry *,
++ struct nameidata *);
++static struct inode *squashfs_iget(struct super_block *s, squashfs_inode_t inode);
++static long long read_blocklist(struct inode *inode, int index,
++ int readahead_blks, char *block_list,
++ unsigned short **block_p, unsigned int *bsize);
++static struct super_block *squashfs_get_sb(struct file_system_type *, int,
++ const char *, void *);
+
-+#ifdef SQUASHFS_1_0_COMPATIBILITY
-+static int squashfs_readpage_lessthan4K(struct file *file, struct page *page);
-+static struct inode *squashfs_iget_1(struct super_block *s, squashfs_inode inode);
-+static unsigned int read_blocklist_1(struct inode *inode, int index, int readahead_blks,
-+ char *block_list, unsigned short **block_p, unsigned int *bsize);
-+#endif
-+
-+DECLARE_MUTEX(read_data_mutex);
+
+#ifdef SQUASHFS_LZMA
+static char *lzma_data;
@@ -109,7 +86,7 @@
+ .get_sb = squashfs_get_sb,
+ .kill_sb = kill_block_super,
+ .fs_flags = FS_REQUIRES_DEV
-+ };
++};
+
+static unsigned char squashfs_filetype_table[] = {
+ DT_UNKNOWN, DT_DIR, DT_REG, DT_LNK, DT_BLK, DT_CHR, DT_FIFO, DT_SOCK
@@ -122,44 +99,32 @@
+ .put_super = squashfs_put_super,
+};
+
-+static struct address_space_operations squashfs_symlink_aops = {
++SQSH_EXTERN struct address_space_operations squashfs_symlink_aops = {
+ .readpage = squashfs_symlink_readpage
+};
+
-+static struct address_space_operations squashfs_aops = {
++SQSH_EXTERN struct address_space_operations squashfs_aops = {
+ .readpage = squashfs_readpage
+};
+
-+static struct address_space_operations squashfs_aops_4K = {
++SQSH_EXTERN struct address_space_operations squashfs_aops_4K = {
+ .readpage = squashfs_readpage4K
+};
+
-+#ifdef SQUASHFS_1_0_COMPATIBILITY
-+static struct address_space_operations squashfs_aops_lessthan4K = {
-+ .readpage = squashfs_readpage_lessthan4K
-+};
-+#endif
-+
+static struct file_operations squashfs_dir_ops = {
+ .read = generic_read_dir,
+ .readdir = squashfs_readdir
+};
+
-+static struct inode_operations squashfs_dir_inode_ops = {
++SQSH_EXTERN struct inode_operations squashfs_dir_inode_ops = {
+ .lookup = squashfs_lookup
+};
+
+
-+static inline struct squashfs_inode_info *SQUASHFS_I(struct inode *inode)
-+{
-+ return list_entry(inode, struct squashfs_inode_info, vfs_inode);
-+}
-+
-+
+static struct buffer_head *get_block_length(struct super_block *s,
+ int *cur_index, int *offset, int *c_byte)
+{
-+ squashfs_sb_info *msblk = s->s_fs_info;
++ struct squashfs_sb_info *msblk = s->s_fs_info;
+ unsigned short temp;
+ struct buffer_head *bh;
+
@@ -200,7 +165,7 @@
+ *offset += 2;
+ }
+
-+ if (SQUASHFS_CHECK_DATA(msblk->sBlk.flags)) {
++ if (SQUASHFS_CHECK_DATA(msblk->sblk.flags)) {
+ if (*offset == msblk->devblksize) {
+ brelse(bh);
+ if (!(bh = sb_bread(s, ++(*cur_index))))
@@ -223,58 +188,66 @@
+}
+
+
-+static unsigned int read_data(struct super_block *s, char *buffer,
-+ unsigned int index, unsigned int length, unsigned int *next_index)
-+{
-+ squashfs_sb_info *msBlk = (squashfs_sb_info *)s->s_fs_info;
-+ struct buffer_head *bh[((SQUASHFS_FILE_MAX_SIZE - 1) >> msBlk->devblksize_log2) + 2];
-+ unsigned int offset = index & ((1 << msBlk->devblksize_log2) - 1);
-+ unsigned int cur_index = index >> msBlk->devblksize_log2;
++SQSH_EXTERN unsigned int squashfs_read_data(struct super_block *s, char *buffer,
++ long long index, unsigned int length,
++ long long *next_index)
++{
++ struct squashfs_sb_info *msblk = s->s_fs_info;
++ struct buffer_head *bh[((SQUASHFS_FILE_MAX_SIZE - 1) >>
++ msblk->devblksize_log2) + 2];
++ unsigned int offset = index & ((1 << msblk->devblksize_log2) - 1);
++ unsigned int cur_index = index >> msblk->devblksize_log2;
+ int bytes, avail_bytes, b = 0, k;
+ char *c_buffer;
+ unsigned int compressed;
+ unsigned int c_byte = length;
+
-+ if(c_byte) {
-+ bytes = msBlk->devblksize - offset;
++ if (c_byte) {
++ bytes = msblk->devblksize - offset;
+ compressed = SQUASHFS_COMPRESSED_BLOCK(c_byte);
-+ c_buffer = compressed ? msBlk->read_data : buffer;
++ c_buffer = compressed ? msblk->read_data : buffer;
+ c_byte = SQUASHFS_COMPRESSED_SIZE_BLOCK(c_byte);
+
-+ TRACE("Block @ 0x%x, %scompressed size %d\n", index, compressed ? "" : "un", (unsigned int) c_byte);
++ TRACE("Block @ 0x%llx, %scompressed size %d\n", index, compressed
++ ? "" : "un", (unsigned int) c_byte);
+
-+ if(!(bh[0] = sb_getblk(s, cur_index)))
++ if (!(bh[0] = sb_getblk(s, cur_index)))
+ goto block_release;
-+ for(b = 1; bytes < c_byte; b++) {
-+ if(!(bh[b] = sb_getblk(s, ++cur_index)))
++
++ for (b = 1; bytes < c_byte; b++) {
++ if (!(bh[b] = sb_getblk(s, ++cur_index)))
+ goto block_release;
-+ bytes += msBlk->devblksize;
++ bytes += msblk->devblksize;
+ }
+ ll_rw_block(READ, b, bh);
+ } else {
-+ if(!(bh[0] = get_block_length(s, &cur_index, &offset, &c_byte)))
++ if (!(bh[0] = get_block_length(s, &cur_index, &offset,
++ &c_byte)))
+ goto read_failure;
+
-+ bytes = msBlk->devblksize - offset;
++ bytes = msblk->devblksize - offset;
+ compressed = SQUASHFS_COMPRESSED(c_byte);
-+ c_buffer = compressed ? msBlk->read_data : buffer;
++ c_buffer = compressed ? msblk->read_data : buffer;
+ c_byte = SQUASHFS_COMPRESSED_SIZE(c_byte);
+
-+ TRACE("Block @ 0x%x, %scompressed size %d\n", index, compressed ? "" : "un", (unsigned int) c_byte);
++ TRACE("Block @ 0x%llx, %scompressed size %d\n", index, compressed
++ ? "" : "un", (unsigned int) c_byte);
+
-+ for(b = 1; bytes < c_byte; b++) {
-+ if(!(bh[b] = sb_getblk(s, ++cur_index)))
++ for (b = 1; bytes < c_byte; b++) {
++ if (!(bh[b] = sb_getblk(s, ++cur_index)))
+ goto block_release;
-+ bytes += msBlk->devblksize;
++ bytes += msblk->devblksize;
+ }
+ ll_rw_block(READ, b - 1, bh + 1);
+ }
+
-+ if(compressed)
-+ down(&read_data_mutex);
++ if (compressed)
++ down(&msblk->read_data_mutex);
+
-+ for(bytes = 0, k = 0; k < b; k++) {
-+ avail_bytes = (c_byte - bytes) > (msBlk->devblksize - offset) ? msBlk->devblksize - offset : c_byte - bytes;
++ for (bytes = 0, k = 0; k < b; k++) {
++ avail_bytes = (c_byte - bytes) > (msblk->devblksize - offset) ?
++ msblk->devblksize - offset :
++ c_byte - bytes;
+ wait_on_buffer(bh[k]);
+ if (!buffer_uptodate(bh[k]))
+ goto block_release;
@@ -287,44 +260,48 @@
+ /*
+ * uncompress block
+ */
-+ if(compressed) {
++ if (compressed) {
+#ifdef SQUASHFS_LZMA
+ int out_size;
+ int lzma_err;
+ int i;
-+ out_size=msBlk->read_size;
-+
-+ if((lzma_err=lzma_inflate(c_buffer, c_byte, buffer, &out_size))){
++ out_size=msblk->read_size;
++
++ if ((lzma_err = lzma_inflate(c_buffer, c_byte, buffer, &out_size))) {
+ ERROR("lzma returned unexpected result 0x%x\n", lzma_err);
+ bytes = 0;
+ } else
+ bytes = out_size;
-+// printk("out size = %d, processed = %d\n", msBlk->read_size, out_size);
+#else
+ int zlib_err;
+
+ stream.next_in = c_buffer;
+ stream.avail_in = c_byte;
+ stream.next_out = buffer;
-+ stream.avail_out = msBlk->read_size;
-+ if(((zlib_err = zlib_inflateInit(&stream)) != Z_OK) ||
-+ ((zlib_err = zlib_inflate(&stream, Z_FINISH)) != Z_STREAM_END) ||
-+ ((zlib_err = zlib_inflateEnd(&stream)) != Z_OK)) {
-+ ERROR("zlib_fs returned unexpected result 0x%x\n", zlib_err);
++ stream.avail_out = msblk->read_size;
++
++ if (((zlib_err = zlib_inflateInit(&stream)) != Z_OK) ||
++ ((zlib_err = zlib_inflate(&stream, Z_FINISH))
++ != Z_STREAM_END) || ((zlib_err =
++ zlib_inflateEnd(&stream)) != Z_OK)) {
++ ERROR("zlib_fs returned unexpected result 0x%x\n",
++ zlib_err);
+ bytes = 0;
+ } else
+ bytes = stream.total_out;
+#endif
-+ up(&read_data_mutex);
++ up(&msblk->read_data_mutex);
+ }
+
-+ if(next_index)
-+ *next_index = index + c_byte + (length ? 0 : (SQUASHFS_CHECK_DATA(msBlk->sBlk.flags) ? 3 : 2));
-+
++ if (next_index)
++ *next_index = index + c_byte + (length ? 0 :
++ (SQUASHFS_CHECK_DATA(msblk->sblk.flags)
++ ? 3 : 2));
+ return bytes;
+
+block_release:
-+ while(--b >= 0) brelse(bh[b]);
++ while (--b >= 0)
++ brelse(bh[b]);
+
+read_failure:
+ ERROR("sb_bread failed reading block 0x%x\n", cur_index);
@@ -332,820 +309,886 @@
+}
+
+
-+static int squashfs_get_cached_block(struct super_block *s, char *buffer,
-+ unsigned int block, unsigned int offset, int length,
-+ unsigned int *next_block, unsigned int *next_offset)
++SQSH_EXTERN int squashfs_get_cached_block(struct super_block *s, char *buffer,
++ long long block, unsigned int offset,
++ int length, long long *next_block,
++ unsigned int *next_offset)
+{
-+ squashfs_sb_info *msBlk = (squashfs_sb_info *)s->s_fs_info;
++ struct squashfs_sb_info *msblk = s->s_fs_info;
+ int n, i, bytes, return_length = length;
-+ unsigned int next_index;
++ long long next_index;
+
-+ TRACE("Entered squashfs_get_cached_block [%x:%x]\n", block, offset);
++ TRACE("Entered squashfs_get_cached_block [%llx:%x]\n", block, offset);
+
-+ for(;;) {
-+ for(i = 0; i < SQUASHFS_CACHED_BLKS; i++)
-+ if(msBlk->block_cache[i].block == block)
++ while ( 1 ) {
++ for (i = 0; i < SQUASHFS_CACHED_BLKS; i++)
++ if (msblk->block_cache[i].block == block)
+ break;
+
-+ down(&msBlk->block_cache_mutex);
-+ if(i == SQUASHFS_CACHED_BLKS) {
++ down(&msblk->block_cache_mutex);
++
++ if (i == SQUASHFS_CACHED_BLKS) {
+ /* read inode header block */
-+ for(i = msBlk->next_cache, n = SQUASHFS_CACHED_BLKS; n ; n --, i = (i + 1) % SQUASHFS_CACHED_BLKS)
-+ if(msBlk->block_cache[i].block != SQUASHFS_USED_BLK)
++ for (i = msblk->next_cache, n = SQUASHFS_CACHED_BLKS;
++ n ; n --, i = (i + 1) %
++ SQUASHFS_CACHED_BLKS)
++ if (msblk->block_cache[i].block !=
++ SQUASHFS_USED_BLK)
+ break;
-+ if(n == 0) {
++
++ if (n == 0) {
+ wait_queue_t wait;
+
+ init_waitqueue_entry(&wait, current);
-+ add_wait_queue(&msBlk->waitq, &wait);
-+ up(&msBlk->block_cache_mutex);
++ add_wait_queue(&msblk->waitq, &wait);
+ set_current_state(TASK_UNINTERRUPTIBLE);
++ up(&msblk->block_cache_mutex);
+ schedule();
+ set_current_state(TASK_RUNNING);
-+ remove_wait_queue(&msBlk->waitq, &wait);
++ remove_wait_queue(&msblk->waitq, &wait);
+ continue;
+ }
-+ msBlk->next_cache = (i + 1) % SQUASHFS_CACHED_BLKS;
++ msblk->next_cache = (i + 1) % SQUASHFS_CACHED_BLKS;
+
-+ if(msBlk->block_cache[i].block == SQUASHFS_INVALID_BLK) {
-+ if(!(msBlk->block_cache[i].data = (unsigned char *)
-+ kmalloc(SQUASHFS_METADATA_SIZE, GFP_KERNEL))) {
-+ ERROR("Failed to allocate cache block\n");
-+ up(&msBlk->block_cache_mutex);
-+ return 0;
++ if (msblk->block_cache[i].block ==
++ SQUASHFS_INVALID_BLK) {
++ if (!(msblk->block_cache[i].data =
++ kmalloc(SQUASHFS_METADATA_SIZE,
++ GFP_KERNEL))) {
++ ERROR("Failed to allocate cache"
++ "block\n");
++ up(&msblk->block_cache_mutex);
++ goto out;
+ }
+ }
+
-+ msBlk->block_cache[i].block = SQUASHFS_USED_BLK;
-+ up(&msBlk->block_cache_mutex);
-+ if(!(msBlk->block_cache[i].length = read_data(s, msBlk->block_cache[i].data, block, 0,
-+ &next_index))) {
-+ ERROR("Unable to read cache block [%x:%x]\n", block, offset);
-+ return 0;
++ msblk->block_cache[i].block = SQUASHFS_USED_BLK;
++ up(&msblk->block_cache_mutex);
++
++ if (!(msblk->block_cache[i].length =
++ squashfs_read_data(s,
++ msblk->block_cache[i].data,
++ block, 0, &next_index))) {
++ ERROR("Unable to read cache block [%llx:%x]\n",
++ block, offset);
++ goto out;
+ }
-+ down(&msBlk->block_cache_mutex);
-+ wake_up(&msBlk->waitq);
-+ msBlk->block_cache[i].block = block;
-+ msBlk->block_cache[i].next_index = next_index;
-+ TRACE("Read cache block [%x:%x]\n", block, offset);
++
++ down(&msblk->block_cache_mutex);
++ wake_up(&msblk->waitq);
++ msblk->block_cache[i].block = block;
++ msblk->block_cache[i].next_index = next_index;
++ TRACE("Read cache block [%llx:%x]\n", block, offset);
+ }
+
-+ if(msBlk->block_cache[i].block != block) {
-+ up(&msBlk->block_cache_mutex);
++ if (msblk->block_cache[i].block != block) {
++ up(&msblk->block_cache_mutex);
+ continue;
+ }
+
-+ if((bytes = msBlk->block_cache[i].length - offset) >= length) {
-+ if(buffer)
-+ memcpy(buffer, msBlk->block_cache[i].data + offset, length);
-+ if(msBlk->block_cache[i].length - offset == length) {
-+ *next_block = msBlk->block_cache[i].next_index;
++ if ((bytes = msblk->block_cache[i].length - offset) >= length) {
++ if (buffer)
++ memcpy(buffer, msblk->block_cache[i].data +
++ offset, length);
++ if (msblk->block_cache[i].length - offset == length) {
++ *next_block = msblk->block_cache[i].next_index;
+ *next_offset = 0;
+ } else {
+ *next_block = block;
+ *next_offset = offset + length;
+ }
-+
-+ up(&msBlk->block_cache_mutex);
-+ return return_length;
++ up(&msblk->block_cache_mutex);
++ goto finish;
+ } else {
-+ if(buffer) {
-+ memcpy(buffer, msBlk->block_cache[i].data + offset, bytes);
++ if (buffer) {
++ memcpy(buffer, msblk->block_cache[i].data +
++ offset, bytes);
+ buffer += bytes;
+ }
-+ block = msBlk->block_cache[i].next_index;
-+ up(&msBlk->block_cache_mutex);
++ block = msblk->block_cache[i].next_index;
++ up(&msblk->block_cache_mutex);
+ length -= bytes;
+ offset = 0;
+ }
+ }
++
++finish:
++ return return_length;
++out:
++ return 0;
+}
+
+
-+static int get_fragment_location(struct super_block *s, unsigned int fragment, unsigned int *fragment_start_block, unsigned int *fragment_size)
-+{
-+ squashfs_sb_info *msBlk = (squashfs_sb_info *)s->s_fs_info;
-+ unsigned int start_block = msBlk->fragment_index[SQUASHFS_FRAGMENT_INDEX(fragment)];
++static int get_fragment_location(struct super_block *s, unsigned int fragment,
++ long long *fragment_start_block,
++ unsigned int *fragment_size)
++{
++ struct squashfs_sb_info *msblk = s->s_fs_info;
++ long long start_block =
++ msblk->fragment_index[SQUASHFS_FRAGMENT_INDEX(fragment)];
+ int offset = SQUASHFS_FRAGMENT_INDEX_OFFSET(fragment);
-+ squashfs_fragment_entry fragment_entry;
++ struct squashfs_fragment_entry fragment_entry;
+
-+ if(msBlk->swap) {
-+ squashfs_fragment_entry sfragment_entry;
++ if (msblk->swap) {
++ struct squashfs_fragment_entry sfragment_entry;
+
-+ if(!squashfs_get_cached_block(s, (char *) &sfragment_entry, start_block, offset,
-+ sizeof(sfragment_entry), &start_block, &offset))
-+ return 0;
++ if (!squashfs_get_cached_block(s, (char *) &sfragment_entry,
++ start_block, offset,
++ sizeof(sfragment_entry), &start_block,
++ &offset))
++ goto out;
+ SQUASHFS_SWAP_FRAGMENT_ENTRY(&fragment_entry, &sfragment_entry);
+ } else
-+ if(!squashfs_get_cached_block(s, (char *) &fragment_entry, start_block, offset,
-+ sizeof(fragment_entry), &start_block, &offset))
-+ return 0;
++ if (!squashfs_get_cached_block(s, (char *) &fragment_entry,
++ start_block, offset,
++ sizeof(fragment_entry), &start_block,
++ &offset))
++ goto out;
+
+ *fragment_start_block = fragment_entry.start_block;
+ *fragment_size = fragment_entry.size;
+
+ return 1;
++
++out:
++ return 0;
+}
+
+
-+void release_cached_fragment(squashfs_sb_info *msBlk, struct squashfs_fragment_cache *fragment)
++SQSH_EXTERN void release_cached_fragment(struct squashfs_sb_info *msblk, struct
++ squashfs_fragment_cache *fragment)
+{
-+ down(&msBlk->fragment_mutex);
++ down(&msblk->fragment_mutex);
+ fragment->locked --;
-+ wake_up(&msBlk->fragment_wait_queue);
-+ up(&msBlk->fragment_mutex);
++ wake_up(&msblk->fragment_wait_queue);
++ up(&msblk->fragment_mutex);
+}
+
+
-+struct squashfs_fragment_cache *get_cached_fragment(struct super_block *s, unsigned int start_block, int length)
++SQSH_EXTERN struct squashfs_fragment_cache *get_cached_fragment(struct super_block
++ *s, long long start_block,
++ int length)
+{
+ int i, n;
-+ squashfs_sb_info *msBlk = (squashfs_sb_info *)s->s_fs_info;
++ struct squashfs_sb_info *msblk = s->s_fs_info;
++
++ while ( 1 ) {
++ down(&msblk->fragment_mutex);
+
-+ for(;;) {
-+ down(&msBlk->fragment_mutex);
-+ for(i = 0; i < SQUASHFS_CACHED_FRAGMENTS && msBlk->fragment[i].block != start_block; i++);
-+ if(i == SQUASHFS_CACHED_FRAGMENTS) {
-+ for(i = msBlk->next_fragment, n = SQUASHFS_CACHED_FRAGMENTS;
-+ n && msBlk->fragment[i].locked; n--, i = (i + 1) % SQUASHFS_CACHED_FRAGMENTS);
++ for (i = 0; i < SQUASHFS_CACHED_FRAGMENTS &&
++ msblk->fragment[i].block != start_block; i++);
+
-+ if(n == 0) {
++ if (i == SQUASHFS_CACHED_FRAGMENTS) {
++ for (i = msblk->next_fragment, n =
++ SQUASHFS_CACHED_FRAGMENTS; n &&
++ msblk->fragment[i].locked; n--, i = (i + 1) %
++ SQUASHFS_CACHED_FRAGMENTS);
++
++ if (n == 0) {
+ wait_queue_t wait;
+
+ init_waitqueue_entry(&wait, current);
-+ add_wait_queue(&msBlk->fragment_wait_queue, &wait);
-+ up(&msBlk->fragment_mutex);
++ add_wait_queue(&msblk->fragment_wait_queue,
++ &wait);
+ set_current_state(TASK_UNINTERRUPTIBLE);
++ up(&msblk->fragment_mutex);
+ schedule();
+ set_current_state(TASK_RUNNING);
<<Diff was trimmed, longer than 597 lines>>
---- CVS-web:
http://cvs.pld-linux.org/SOURCES/squashfs_lzma-module.patch?r1=1.1&r2=1.2&f=u
More information about the pld-cvs-commit
mailing list