SOURCES: kernel-desktop-squashfs.patch - up to 3.2-r2

czarny czarny at pld-linux.org
Fri Aug 3 02:24:40 CEST 2007


Author: czarny                       Date: Fri Aug  3 00:24:40 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- up to 3.2-r2

---- Files affected:
SOURCES:
   kernel-desktop-squashfs.patch (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: SOURCES/kernel-desktop-squashfs.patch
diff -u SOURCES/kernel-desktop-squashfs.patch:1.4 SOURCES/kernel-desktop-squashfs.patch:1.5
--- SOURCES/kernel-desktop-squashfs.patch:1.4	Sun Nov 19 02:41:22 2006
+++ SOURCES/kernel-desktop-squashfs.patch	Fri Aug  3 02:24:34 2007
@@ -1,15 +1,15 @@
-diff --new-file -urp linux-2.6.8.1/fs/Kconfig linux-2.6.8.1-squashfs3.1/fs/Kconfig
---- linux-2.6.8.1/fs/Kconfig	2004-08-14 11:55:33.000000000 +0100
-+++ linux-2.6.8.1-squashfs3.1/fs/Kconfig	2006-08-20 01:16:58.000000000 +0100
-@@ -1231,6 +1231,71 @@ config CRAMFS
+diff -x .gitignore -Nurp linux-2.6.20/fs/Kconfig linux-2.6.20-squashfs3.2-r2/fs/Kconfig
+--- linux-2.6.20/fs/Kconfig	2006-12-25 01:13:12.000000000 +0000
++++ linux-2.6.20-squashfs3.2-r2/fs/Kconfig	2007-01-16 02:06:03.000000000 +0000
+@@ -1404,6 +1404,71 @@ config CRAMFS
  
  	  If unsure, say N.
  
 +config SQUASHFS
-+	tristate "SquashFS 3.1 - Squashed file system support"
++	tristate "SquashFS 3.2 - Squashed file system support"
 +	select ZLIB_INFLATE
 +	help
-+	  Saying Y here includes support for SquashFS 3.1 (a Compressed Read-Only File
++	  Saying Y here includes support for SquashFS 3.2 (a Compressed Read-Only File
 +	  System).  Squashfs is a highly compressed read-only filesystem for Linux.
 +	  It uses zlib compression to compress both files, inodes and directories.
 +	  Inodes in the system are very small and all blocks are packed to minimise
@@ -72,26 +72,26 @@
 +
  config VXFS_FS
  	tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
- 	help
-diff --new-file -urp linux-2.6.8.1/fs/Makefile linux-2.6.8.1-squashfs3.1/fs/Makefile
---- linux-2.6.8.1/fs/Makefile	2004-08-14 11:55:33.000000000 +0100
-+++ linux-2.6.8.1-squashfs3.1/fs/Makefile	2006-08-11 09:34:50.000000000 +0100
-@@ -50,6 +50,7 @@ obj-$(CONFIG_EXT3_FS)		+= ext3/ # Before
- obj-$(CONFIG_JBD)		+= jbd/
+ 	depends on BLOCK
+diff -x .gitignore -Nurp linux-2.6.20/fs/Makefile linux-2.6.20-squashfs3.2-r2/fs/Makefile
+--- linux-2.6.20/fs/Makefile	2006-12-25 01:13:12.000000000 +0000
++++ linux-2.6.20-squashfs3.2-r2/fs/Makefile	2007-01-16 02:06:03.000000000 +0000
+@@ -68,6 +68,7 @@ obj-$(CONFIG_JBD)		+= jbd/
+ obj-$(CONFIG_JBD2)		+= jbd2/
  obj-$(CONFIG_EXT2_FS)		+= ext2/
  obj-$(CONFIG_CRAMFS)		+= cramfs/
 +obj-$(CONFIG_SQUASHFS)		+= squashfs/
  obj-$(CONFIG_RAMFS)		+= ramfs/
  obj-$(CONFIG_HUGETLBFS)		+= hugetlbfs/
  obj-$(CONFIG_CODA_FS)		+= coda/
-diff --new-file -urp linux-2.6.8.1/fs/squashfs/inode.c linux-2.6.8.1-squashfs3.1/fs/squashfs/inode.c
---- linux-2.6.8.1/fs/squashfs/inode.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.8.1-squashfs3.1/fs/squashfs/inode.c	2006-08-20 01:16:58.000000000 +0100
-@@ -0,0 +1,2155 @@
+diff -x .gitignore -Nurp linux-2.6.20/fs/squashfs/inode.c linux-2.6.20-squashfs3.2-r2/fs/squashfs/inode.c
+--- linux-2.6.20/fs/squashfs/inode.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.20-squashfs3.2-r2/fs/squashfs/inode.c	2007-01-16 02:28:36.000000000 +0000
+@@ -0,0 +1,2329 @@
 +/*
 + * Squashfs - a compressed read only filesystem for Linux
 + *
-+ * Copyright (c) 2002, 2003, 2004, 2005, 2006
++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007
 + * Phillip Lougher <phillip at lougher.org.uk>
 + *
 + * This program is free software; you can redistribute it and/or
@@ -111,47 +111,40 @@
 + * inode.c
 + */
 +
-+#include <linux/types.h>
 +#include <linux/squashfs_fs.h>
 +#include <linux/module.h>
-+#include <linux/errno.h>
-+#include <linux/slab.h>
 +#include <linux/zlib.h>
 +#include <linux/fs.h>
-+#include <linux/smp_lock.h>
-+#include <linux/slab.h>
 +#include <linux/squashfs_fs_sb.h>
 +#include <linux/squashfs_fs_i.h>
 +#include <linux/buffer_head.h>
 +#include <linux/vfs.h>
-+#include <linux/init.h>
-+#include <linux/dcache.h>
-+#include <linux/wait.h>
-+#include <linux/blkdev.h>
 +#include <linux/vmalloc.h>
-+#include <asm/uaccess.h>
-+#include <asm/semaphore.h>
++#include <linux/smp_lock.h>
 +
 +#include "squashfs.h"
 +
-+static void squashfs_put_super(struct super_block *);
++static void vfs_read_inode(struct inode *i);
++static struct dentry *squashfs_get_parent(struct dentry *child);
++static int squashfs_read_inode(struct inode *i, squashfs_inode_t inode);
 +static int squashfs_statfs(struct dentry *, struct kstatfs *);
 +static int squashfs_symlink_readpage(struct file *file, struct page *page);
++static long long read_blocklist(struct inode *inode, int index,
++				int readahead_blks, char *block_list,
++				unsigned short **block_p, unsigned int *bsize);
 +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 int squashfs_remount(struct super_block *s, int *flags, char *data);
++static void squashfs_put_super(struct super_block *);
++static int squashfs_get_sb(struct file_system_type *,int, const char *, void *,
++				struct vfsmount *);
 +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 int squashfs_get_sb(struct file_system_type *, int,
-+				const char *, void *, struct vfsmount *);
 +
 +static struct file_system_type squashfs_fs_type = {
 +	.owner = THIS_MODULE,
@@ -161,30 +154,43 @@
 +	.fs_flags = FS_REQUIRES_DEV
 +};
 +
-+static unsigned char squashfs_filetype_table[] = {
++static const unsigned char squashfs_filetype_table[] = {
 +	DT_UNKNOWN, DT_DIR, DT_REG, DT_LNK, DT_BLK, DT_CHR, DT_FIFO, DT_SOCK
 +};
 +
-+static struct super_operations squashfs_ops = {
++static struct super_operations squashfs_super_ops = {
 +	.alloc_inode = squashfs_alloc_inode,
 +	.destroy_inode = squashfs_destroy_inode,
 +	.statfs = squashfs_statfs,
 +	.put_super = squashfs_put_super,
++	.remount_fs = squashfs_remount
 +};
 +
-+SQSH_EXTERN struct address_space_operations squashfs_symlink_aops = {
++static struct super_operations squashfs_export_super_ops = {
++	.alloc_inode = squashfs_alloc_inode,
++	.destroy_inode = squashfs_destroy_inode,
++	.statfs = squashfs_statfs,
++	.put_super = squashfs_put_super,
++	.read_inode = vfs_read_inode
++};
++
++static struct export_operations squashfs_export_ops = {
++	.get_parent = squashfs_get_parent
++};
++
++SQSH_EXTERN const struct address_space_operations squashfs_symlink_aops = {
 +	.readpage = squashfs_symlink_readpage
 +};
 +
-+SQSH_EXTERN struct address_space_operations squashfs_aops = {
++SQSH_EXTERN const struct address_space_operations squashfs_aops = {
 +	.readpage = squashfs_readpage
 +};
 +
-+SQSH_EXTERN struct address_space_operations squashfs_aops_4K = {
++SQSH_EXTERN const struct address_space_operations squashfs_aops_4K = {
 +	.readpage = squashfs_readpage4K
 +};
 +
-+static struct file_operations squashfs_dir_ops = {
++static const struct file_operations squashfs_dir_ops = {
 +	.read = generic_read_dir,
 +	.readdir = squashfs_readdir
 +};
@@ -263,26 +269,28 @@
 +
 +SQSH_EXTERN unsigned int squashfs_read_data(struct super_block *s, char *buffer,
 +			long long index, unsigned int length,
-+			long long *next_index)
++			long long *next_index, int srclength)
 +{
 +	struct squashfs_sb_info *msblk = s->s_fs_info;
++	struct squashfs_super_block *sblk = &msblk->sblk;
 +	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;
++	int bytes, avail_bytes, b = 0, k = 0;
 +	unsigned int compressed;
 +	unsigned int c_byte = length;
 +
 +	if (c_byte) {
 +		bytes = msblk->devblksize - offset;
 +		compressed = SQUASHFS_COMPRESSED_BLOCK(c_byte);
-+		c_buffer = compressed ? msblk->read_data : buffer;
 +		c_byte = SQUASHFS_COMPRESSED_SIZE_BLOCK(c_byte);
 +
-+		TRACE("Block @ 0x%llx, %scompressed size %d\n", index, compressed
-+					? "" : "un", (unsigned int) c_byte);
++		TRACE("Block @ 0x%llx, %scompressed size %d, src size %d\n", index, compressed
++					? "" : "un", (unsigned int) c_byte, srclength);
++
++		if (c_byte > srclength || index < 0 || (index + c_byte) > sblk->bytes_used)
++			goto read_failure;
 +
 +		if (!(bh[0] = sb_getblk(s, cur_index)))
 +			goto block_release;
@@ -294,18 +302,23 @@
 +		}
 +		ll_rw_block(READ, b, bh);
 +	} else {
++		if (index < 0 || (index + 2) > sblk->bytes_used)
++			goto read_failure;
++
 +		if (!(bh[0] = get_block_length(s, &cur_index, &offset,
 +								&c_byte)))
 +			goto read_failure;
 +
 +		bytes = msblk->devblksize - offset;
 +		compressed = SQUASHFS_COMPRESSED(c_byte);
-+		c_buffer = compressed ? msblk->read_data : buffer;
 +		c_byte = SQUASHFS_COMPRESSED_SIZE(c_byte);
 +
 +		TRACE("Block @ 0x%llx, %scompressed size %d\n", index, compressed
 +					? "" : "un", (unsigned int) c_byte);
 +
++		if (c_byte > srclength || (index + c_byte) > sblk->bytes_used)
++			goto read_failure;
++
 +		for (b = 1; bytes < c_byte; b++) {
 +			if (!(bh[b] = sb_getblk(s, ++cur_index)))
 +				goto block_release;
@@ -314,44 +327,85 @@
 +		ll_rw_block(READ, b - 1, bh + 1);
 +	}
 +
-+	if (compressed)
-+		down(&msblk->read_data_mutex);
++	if (compressed) {
++		int zlib_err = 0;
++
++		/*
++	 	* uncompress block
++	 	*/
++
++		mutex_lock(&msblk->read_data_mutex);
++
++		msblk->stream.next_out = buffer;
++		msblk->stream.avail_out = srclength;
 +
-+	for (bytes = 0, k = 0; k < b; k++) {
-+		avail_bytes = (c_byte - bytes) > (msblk->devblksize - offset) ?
++		for (bytes = 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;
-+		memcpy(c_buffer + bytes, bh[k]->b_data + offset, avail_bytes);
-+		bytes += avail_bytes;
-+		offset = 0;
-+		brelse(bh[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;
++				}
 +
-+	/*
-+	 * uncompress block
-+	 */
-+	if (compressed) {
-+		int zlib_err;
++				if (avail_bytes == 0) {
++					offset = 0;
++					brelse(bh[k]);
++					continue;
++				}
++			}
 +
-+		msblk->stream.next_in = c_buffer;
-+		msblk->stream.avail_in = c_byte;
-+		msblk->stream.next_out = buffer;
-+		msblk->stream.avail_out = msblk->read_size;
++			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;
++			}
 +
-+		if (((zlib_err = zlib_inflateInit(&msblk->stream)) != Z_OK) ||
-+				((zlib_err = zlib_inflate(&msblk->stream, Z_FINISH))
-+				 != Z_STREAM_END) || ((zlib_err =
-+				zlib_inflateEnd(&msblk->stream)) != Z_OK)) {
-+			ERROR("zlib_fs returned unexpected result 0x%x\n",
-+				zlib_err);
-+			bytes = 0;
-+		} else
-+			bytes = msblk->stream.total_out;
-+		
-+		up(&msblk->read_data_mutex);
++			bytes += avail_bytes;
++			offset = 0;
++			brelse(bh[k]);
++		}
++
++		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);
++			goto release_mutex;
++		}
++		bytes = msblk->stream.total_out;
++		mutex_unlock(&msblk->read_data_mutex);
++	} else {
++		int i;
++
++		for(i = 0; i < b; i++) {
++			wait_on_buffer(bh[i]);
++			if(!buffer_uptodate(bh[i]))
++				goto block_release;
++		}
++
++		for (bytes = 0; k < b; k++) {
++			avail_bytes = (c_byte - bytes) > (msblk->devblksize - offset) ?
++					msblk->devblksize - offset :
++					c_byte - bytes;
++			memcpy(buffer + bytes, bh[k]->b_data + offset, avail_bytes);
++			bytes += avail_bytes;
++			offset = 0;
++			brelse(bh[k]);
++		}
 +	}
 +
 +	if (next_index)
@@ -360,9 +414,12 @@
 +				 ? 3 : 2));
 +	return bytes;
 +
++release_mutex:
++	mutex_unlock(&msblk->read_data_mutex);
++
 +block_release:
-+	while (--b >= 0)
-+		brelse(bh[b]);
++	for (; k < b; k++)
++		brelse(bh[k]);
 +
 +read_failure:
 +	ERROR("sb_bread failed reading block 0x%x\n", cur_index);
@@ -386,7 +443,7 @@
 +			if (msblk->block_cache[i].block == block)
 +				break; 
 +		
-+		down(&msblk->block_cache_mutex);
++		mutex_lock(&msblk->block_cache_mutex);
 +
 +		if (i == SQUASHFS_CACHED_BLKS) {
 +			/* read inode header block */
@@ -403,7 +460,7 @@
 +				init_waitqueue_entry(&wait, current);
 +				add_wait_queue(&msblk->waitq, &wait);
 +				set_current_state(TASK_UNINTERRUPTIBLE);
-+ 				up(&msblk->block_cache_mutex);
++ 				mutex_unlock(&msblk->block_cache_mutex);
 +				schedule();
 +				set_current_state(TASK_RUNNING);
 +				remove_wait_queue(&msblk->waitq, &wait);
@@ -418,24 +475,28 @@
 +						GFP_KERNEL))) {
 +					ERROR("Failed to allocate cache"
 +							"block\n");
-+					up(&msblk->block_cache_mutex);
++					mutex_unlock(&msblk->block_cache_mutex);
 +					goto out;
 +				}
 +			}
 +	
 +			msblk->block_cache[i].block = SQUASHFS_USED_BLK;
-+			up(&msblk->block_cache_mutex);
++			mutex_unlock(&msblk->block_cache_mutex);
 +
-+			if (!(msblk->block_cache[i].length =
-+						squashfs_read_data(s,
-+						msblk->block_cache[i].data,
-+						block, 0, &next_index))) {
++			msblk->block_cache[i].length = squashfs_read_data(s,
++				msblk->block_cache[i].data, block, 0, &next_index, SQUASHFS_METADATA_SIZE);
++			if (msblk->block_cache[i].length == 0) {
 +				ERROR("Unable to read cache block [%llx:%x]\n",
 +						block, offset);
++				mutex_lock(&msblk->block_cache_mutex);
++				msblk->block_cache[i].block = SQUASHFS_INVALID_BLK;
++				kfree(msblk->block_cache[i].data);
++				wake_up(&msblk->waitq);
++				mutex_unlock(&msblk->block_cache_mutex);
 +				goto out;
 +			}
 +
-+			down(&msblk->block_cache_mutex);
++			mutex_lock(&msblk->block_cache_mutex);
 +			wake_up(&msblk->waitq);
 +			msblk->block_cache[i].block = block;
 +			msblk->block_cache[i].next_index = next_index;
@@ -443,11 +504,16 @@
 +		}
 +
 +		if (msblk->block_cache[i].block != block) {
-+			up(&msblk->block_cache_mutex);
++			mutex_unlock(&msblk->block_cache_mutex);
 +			continue;
 +		}
 +
-+		if ((bytes = msblk->block_cache[i].length - offset) >= length) {
++		bytes = msblk->block_cache[i].length - offset;
++
++		if (bytes < 1) {
++			mutex_unlock(&msblk->block_cache_mutex);
++			goto out;
++		} else if (bytes >= length) {
 +			if (buffer)
 +				memcpy(buffer, msblk->block_cache[i].data +
 +						offset, length);
@@ -458,7 +524,7 @@
 +				*next_block = block;
 +				*next_offset = offset + length;
 +			}
-+			up(&msblk->block_cache_mutex);
++			mutex_unlock(&msblk->block_cache_mutex);
 +			goto finish;
 +		} else {
 +			if (buffer) {
@@ -467,7 +533,7 @@
 +				buffer += bytes;
 +			}
 +			block = msblk->block_cache[i].next_index;
-+			up(&msblk->block_cache_mutex);
++			mutex_unlock(&msblk->block_cache_mutex);
 +			length -= bytes;
 +			offset = 0;
 +		}
@@ -519,10 +585,10 @@
 +SQSH_EXTERN void release_cached_fragment(struct squashfs_sb_info *msblk, struct
 +					squashfs_fragment_cache *fragment)
 +{
-+	down(&msblk->fragment_mutex);
++	mutex_lock(&msblk->fragment_mutex);
 +	fragment->locked --;
 +	wake_up(&msblk->fragment_wait_queue);
-+	up(&msblk->fragment_mutex);
++	mutex_unlock(&msblk->fragment_mutex);
 +}
 +
 +
@@ -532,9 +598,10 @@
 +{
 +	int i, n;
 +	struct squashfs_sb_info *msblk = s->s_fs_info;
++	struct squashfs_super_block *sblk = &msblk->sblk;
 +
 +	while ( 1 ) {
-+		down(&msblk->fragment_mutex);
++		mutex_lock(&msblk->fragment_mutex);
 +
 +		for (i = 0; i < SQUASHFS_CACHED_FRAGMENTS &&
 +				msblk->fragment[i].block != start_block; i++);
@@ -552,7 +619,7 @@
 +				add_wait_queue(&msblk->fragment_wait_queue,
 +									&wait);
 +				set_current_state(TASK_UNINTERRUPTIBLE);
-+				up(&msblk->fragment_mutex);
++				mutex_unlock(&msblk->fragment_mutex);
 +				schedule();
 +				set_current_state(TASK_RUNNING);
 +				remove_wait_queue(&msblk->fragment_wait_queue,
@@ -567,32 +634,35 @@
 +						(SQUASHFS_FILE_MAX_SIZE))) {
 +					ERROR("Failed to allocate fragment "
 +							"cache block\n");
-+					up(&msblk->fragment_mutex);
++					mutex_unlock(&msblk->fragment_mutex);
 +					goto out;
 +				}
 +
 +			msblk->fragment[i].block = SQUASHFS_INVALID_BLK;
 +			msblk->fragment[i].locked = 1;
-+			up(&msblk->fragment_mutex);
++			mutex_unlock(&msblk->fragment_mutex);
 +
 +			if (!(msblk->fragment[i].length = squashfs_read_data(s,
 +						msblk->fragment[i].data,
-+						start_block, length, NULL))) {
++						start_block, length, NULL, sblk->block_size))) {
 +				ERROR("Unable to read fragment cache block "
 +							"[%llx]\n", start_block);
 +				msblk->fragment[i].locked = 0;
++				smp_mb();
 +				goto out;
 +			}
 +
++			mutex_lock(&msblk->fragment_mutex);
 +			msblk->fragment[i].block = start_block;
 +			TRACE("New fragment %d, start block %lld, locked %d\n",
 +						i, msblk->fragment[i].block,
 +						msblk->fragment[i].locked);
++			mutex_unlock(&msblk->fragment_mutex);
 +			break;
 +		}
 +
 +		msblk->fragment[i].locked++;
-+		up(&msblk->fragment_mutex);
++		mutex_unlock(&msblk->fragment_mutex);
 +		TRACE("Got fragment %d, start block %lld, locked %d\n", i,
 +						msblk->fragment[i].block,
 +						msblk->fragment[i].locked);
@@ -606,33 +676,105 @@
 +}
 +
 +
-+static struct inode *squashfs_new_inode(struct super_block *s,
++static void squashfs_new_inode(struct squashfs_sb_info *msblk, struct inode *i,
 +		struct squashfs_base_inode_header *inodeb)
 +{
++	i->i_ino = inodeb->inode_number;
++	i->i_mtime.tv_sec = inodeb->mtime;
++	i->i_atime.tv_sec = inodeb->mtime;
++	i->i_ctime.tv_sec = inodeb->mtime;
++	i->i_uid = msblk->uid[inodeb->uid];
++	i->i_mode = inodeb->mode;
++	i->i_size = 0;
++	if (inodeb->guid == SQUASHFS_GUIDS)
++		i->i_gid = i->i_uid;
++	else
++		i->i_gid = msblk->guid[inodeb->guid];
++}
++
++
++static squashfs_inode_t squashfs_inode_lookup(struct super_block *s, int ino)
++{
 +	struct squashfs_sb_info *msblk = s->s_fs_info;
-+	struct inode *i = new_inode(s);
++	long long start = msblk->inode_lookup_table[SQUASHFS_LOOKUP_BLOCK(ino - 1)];
++	int offset = SQUASHFS_LOOKUP_BLOCK_OFFSET(ino - 1);
++	squashfs_inode_t inode;
 +
-+	if (i) {
-+		i->i_ino = inodeb->inode_number;
-+		i->i_mtime.tv_sec = inodeb->mtime;
-+		i->i_atime.tv_sec = inodeb->mtime;
-+		i->i_ctime.tv_sec = inodeb->mtime;
-+		i->i_uid = msblk->uid[inodeb->uid];
-+		i->i_mode = inodeb->mode;
-+		i->i_size = 0;
-+		if (inodeb->guid == SQUASHFS_GUIDS)
-+			i->i_gid = i->i_uid;
-+		else
-+			i->i_gid = msblk->guid[inodeb->guid];
++	TRACE("Entered squashfs_inode_lookup, inode_number = %d\n", ino);
++
++	if (msblk->swap) {
++		squashfs_inode_t sinode;
++
++		if (!squashfs_get_cached_block(s, (char *) &sinode, start, offset,
++					sizeof(sinode), &start, &offset))
++			goto out;
++		SQUASHFS_SWAP_INODE_T((&inode), &sinode);
++	} else if (!squashfs_get_cached_block(s, (char *) &inode, start, offset,
++					sizeof(inode), &start, &offset))
++			goto out;
++
++	TRACE("squashfs_inode_lookup, inode = 0x%llx\n", inode);
++
++	return inode;
++
++out:
++	return SQUASHFS_INVALID_BLK;
++}
++	
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/kernel-desktop-squashfs.patch?r1=1.4&r2=1.5&f=u



More information about the pld-cvs-commit mailing list