packages: kernel-bare-vserver/linux-2.6.27-squashfs.patch - backport of squ...

hawk hawk at pld-linux.org
Sat Jun 20 17:58:30 CEST 2009


Author: hawk                         Date: Sat Jun 20 15:58:30 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- backport of squashfs from 2.6.30 for 2.6.27.x

---- Files affected:
packages/kernel-bare-vserver:
   linux-2.6.27-squashfs.patch (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: packages/kernel-bare-vserver/linux-2.6.27-squashfs.patch
diff -u packages/kernel-bare-vserver/linux-2.6.27-squashfs.patch:1.1 packages/kernel-bare-vserver/linux-2.6.27-squashfs.patch:1.2
--- packages/kernel-bare-vserver/linux-2.6.27-squashfs.patch:1.1	Tue Nov  4 09:42:26 2008
+++ packages/kernel-bare-vserver/linux-2.6.27-squashfs.patch	Sat Jun 20 17:58:24 2009
@@ -1,67 +1,19 @@
-diff -x .gitignore -Nurp linux-2.6.27-rc4/fs/Kconfig linux-2.6.27-rc4-squashfs3.4/fs/Kconfig
---- linux-2.6.27-rc4/fs/Kconfig	2008-08-11 15:20:41.000000000 +0100
-+++ linux-2.6.27-rc4-squashfs3.4/fs/Kconfig	2008-08-19 18:31:56.000000000 +0100
-@@ -1348,6 +1348,56 @@ config CRAMFS
+diff -urN linux-2.6.27.orig/fs/Kconfig linux-2.6.27/fs/Kconfig
+--- linux-2.6.27.orig/fs/Kconfig	2009-06-20 17:45:39.408210188 +0200
++++ linux-2.6.27/fs/Kconfig	2009-06-20 17:49:39.818046568 +0200
+@@ -1348,6 +1348,8 @@
  
  	  If unsure, say N.
  
-+config SQUASHFS
-+	tristate "SquashFS 3.4 - Squashed file system support"
-+	select ZLIB_INFLATE
-+	help
-+	  Saying Y here includes support for SquashFS 3.4 (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 data overhead. Block sizes
-+	  greater than 4K are supported up to a maximum of 1 Mbytes (default
-+	  block size 128K).  SquashFS 3.3 supports 64 bit filesystems and files
-+	  (larger than 4GB), full uid/gid information, hard links and timestamps.  
-+
-+	  Squashfs is intended for general read-only filesystem use, for
-+	  archival use (i.e. in cases where a .tar.gz file may be used), and in
-+	  embedded systems where low overhead is needed.  Further information
-+	  and filesystem tools are available from http://squashfs.sourceforge.net.
-+
-+	  If you want to compile this as a module ( = code which can be
-+	  inserted in and removed from the running kernel whenever you want),
-+	  say M here and read <file:Documentation/modules.txt>.  The module
-+	  will be called squashfs.  Note that the root file system (the one
-+	  containing the directory /) cannot be compiled as a module.
-+
-+	  If unsure, say N.
-+
-+config SQUASHFS_EMBEDDED
-+
-+	bool "Additional option for memory-constrained systems" 
-+	depends on SQUASHFS
-+	default n
-+	help
-+	  Saying Y here allows you to specify cache size.
-+
-+	  If unsure, say N.
-+
-+config SQUASHFS_FRAGMENT_CACHE_SIZE
-+	int "Number of fragments cached" if SQUASHFS_EMBEDDED
-+	depends on SQUASHFS
-+	default "3"
-+	help
-+	  By default SquashFS caches the last 3 fragments read from
-+	  the filesystem.  Increasing this amount may mean SquashFS
-+	  has to re-read fragments less often from disk, at the expense
-+	  of extra system memory.  Decreasing this amount will mean
-+	  SquashFS uses less memory at the expense of extra reads from disk.
-+
-+	  Note there must be at least one cached fragment.  Anything
-+	  much more than three will probably not make much difference.
++source "fs/squashfs/Kconfig"
 +
  config VXFS_FS
  	tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
  	depends on BLOCK
-diff -x .gitignore -Nurp linux-2.6.27-rc4/fs/Makefile linux-2.6.27-rc4-squashfs3.4/fs/Makefile
---- linux-2.6.27-rc4/fs/Makefile	2008-08-11 15:20:41.000000000 +0100
-+++ linux-2.6.27-rc4-squashfs3.4/fs/Makefile	2008-08-19 18:31:56.000000000 +0100
-@@ -74,6 +74,7 @@ obj-$(CONFIG_JBD)		+= jbd/
+diff -urN linux-2.6.27.orig/fs/Makefile linux-2.6.27/fs/Makefile
+--- linux-2.6.27.orig/fs/Makefile	2009-06-20 17:45:39.408210188 +0200
++++ linux-2.6.27/fs/Makefile	2009-06-20 17:49:39.818046568 +0200
+@@ -74,6 +74,7 @@
  obj-$(CONFIG_JBD2)		+= jbd2/
  obj-$(CONFIG_EXT2_FS)		+= ext2/
  obj-$(CONFIG_CRAMFS)		+= cramfs/
@@ -69,10 +21,10 @@
  obj-y				+= ramfs/
  obj-$(CONFIG_HUGETLBFS)		+= hugetlbfs/
  obj-$(CONFIG_CODA_FS)		+= coda/
-diff -x .gitignore -Nurp linux-2.6.27-rc4/fs/squashfs/inode.c linux-2.6.27-rc4-squashfs3.4/fs/squashfs/inode.c
---- linux-2.6.27-rc4/fs/squashfs/inode.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.27-rc4-squashfs3.4/fs/squashfs/inode.c	2008-08-26 08:25:23.000000000 +0100
-@@ -0,0 +1,2173 @@
+diff -urN linux-2.6.27.orig/fs/squashfs/block.c linux-2.6.27/fs/squashfs/block.c
+--- linux-2.6.27.orig/fs/squashfs/block.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27/fs/squashfs/block.c	2009-06-10 05:05:27.000000000 +0200
+@@ -0,0 +1,270 @@
 +/*
 + * Squashfs - a compressed read only filesystem for Linux
 + *
@@ -91,218 +43,135 @@
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
-+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 + *
-+ * inode.c
++ * block.c
++ */
++
++/*
++ * This file implements the low-level routines to read and decompress
++ * datablocks and metadata blocks.
 + */
 +
-+#include <linux/squashfs_fs.h>
-+#include <linux/module.h>
-+#include <linux/zlib.h>
 +#include <linux/fs.h>
-+#include <linux/squashfs_fs_sb.h>
-+#include <linux/squashfs_fs_i.h>
-+#include <linux/buffer_head.h>
 +#include <linux/vfs.h>
-+#include <linux/vmalloc.h>
-+#include <linux/spinlock.h>
-+#include <linux/smp_lock.h>
-+#include <linux/exportfs.h>
++#include <linux/slab.h>
++#include <linux/mutex.h>
++#include <linux/string.h>
++#include <linux/buffer_head.h>
++#include <linux/zlib.h>
 +
++#include "squashfs_fs.h"
++#include "squashfs_fs_sb.h"
++#include "squashfs_fs_i.h"
 +#include "squashfs.h"
 +
-+static struct dentry *squashfs_fh_to_dentry(struct super_block *s,
-+		struct fid *fid, int fh_len, int fh_type);
-+static struct dentry *squashfs_fh_to_parent(struct super_block *s,
-+		struct fid *fid, int fh_len, int fh_type);
-+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_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 file_system_type squashfs_fs_type = {
-+	.owner = THIS_MODULE,
-+	.name = "squashfs",
-+	.get_sb = squashfs_get_sb,
-+	.kill_sb = kill_block_super,
-+	.fs_flags = FS_REQUIRES_DEV
-+};
-+
-+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_super_ops = {
-+	.alloc_inode = squashfs_alloc_inode,
-+	.destroy_inode = squashfs_destroy_inode,
-+	.statfs = squashfs_statfs,
-+	.put_super = squashfs_put_super,
-+	.remount_fs = squashfs_remount
-+};
-+
-+static struct export_operations squashfs_export_ops = {
-+	.fh_to_dentry = squashfs_fh_to_dentry,
-+	.fh_to_parent = squashfs_fh_to_parent,
-+	.get_parent = squashfs_get_parent
-+};
-+
-+SQSH_EXTERN const struct address_space_operations squashfs_symlink_aops = {
-+	.readpage = squashfs_symlink_readpage
-+};
-+
-+SQSH_EXTERN const struct address_space_operations squashfs_aops = {
-+	.readpage = squashfs_readpage
-+};
-+
-+static const struct file_operations squashfs_dir_ops = {
-+	.read = generic_read_dir,
-+	.readdir = squashfs_readdir
-+};
-+
-+SQSH_EXTERN struct inode_operations squashfs_dir_inode_ops = {
-+	.lookup = squashfs_lookup
-+};
-+
-+
-+static struct buffer_head *get_block_length(struct super_block *s,
-+				int *cur_index, int *offset, int *c_byte)
++/*
++ * Read the metadata block length, this is stored in the first two
++ * bytes of the metadata block.
++ */
++static struct buffer_head *get_block_length(struct super_block *sb,
++			u64 *cur_index, int *offset, int *length)
 +{
-+	struct squashfs_sb_info *msblk = s->s_fs_info;
-+	unsigned short temp;
++	struct squashfs_sb_info *msblk = sb->s_fs_info;
 +	struct buffer_head *bh;
 +
-+	if (!(bh = sb_bread(s, *cur_index)))
-+		goto out;
++	bh = sb_bread(sb, *cur_index);
++	if (bh == NULL)
++		return NULL;
 +
 +	if (msblk->devblksize - *offset == 1) {
-+		if (msblk->swap)
-+			((unsigned char *) &temp)[1] = *((unsigned char *)
-+				(bh->b_data + *offset));
-+		else
-+			((unsigned char *) &temp)[0] = *((unsigned char *)
-+				(bh->b_data + *offset));
-+		brelse(bh);
-+		if (!(bh = sb_bread(s, ++(*cur_index))))
-+			goto out;
-+		if (msblk->swap)
-+			((unsigned char *) &temp)[0] = *((unsigned char *)
-+				bh->b_data); 
-+		else
-+			((unsigned char *) &temp)[1] = *((unsigned char *)
-+				bh->b_data); 
-+		*c_byte = temp;
++		*length = (unsigned char) bh->b_data[*offset];
++		put_bh(bh);
++		bh = sb_bread(sb, ++(*cur_index));
++		if (bh == NULL)
++			return NULL;
++		*length |= (unsigned char) bh->b_data[0] << 8;
 +		*offset = 1;
 +	} else {
-+		if (msblk->swap) {
-+			((unsigned char *) &temp)[1] = *((unsigned char *)
-+				(bh->b_data + *offset));
-+			((unsigned char *) &temp)[0] = *((unsigned char *)
-+				(bh->b_data + *offset + 1)); 
-+		} else {
-+			((unsigned char *) &temp)[0] = *((unsigned char *)
-+				(bh->b_data + *offset));
-+			((unsigned char *) &temp)[1] = *((unsigned char *)
-+				(bh->b_data + *offset + 1)); 
-+		}
-+		*c_byte = temp;
++		*length = (unsigned char) bh->b_data[*offset] |
++			(unsigned char) bh->b_data[*offset + 1] << 8;
 +		*offset += 2;
 +	}
 +
-+	if (SQUASHFS_CHECK_DATA(msblk->sblk.flags)) {
-+		if (*offset == msblk->devblksize) {
-+			brelse(bh);
-+			if (!(bh = sb_bread(s, ++(*cur_index))))
-+				goto out;
-+			*offset = 0;
-+		}
-+		if (*((unsigned char *) (bh->b_data + *offset)) !=
-+						SQUASHFS_MARKER_BYTE) {
-+			ERROR("Metadata block marker corrupt @ %x\n",
-+						*cur_index);
-+			brelse(bh);
-+			goto out;
-+		}
-+		(*offset)++;
-+	}
 +	return bh;
-+
-+out:
-+	return NULL;
 +}
 +
 +
-+SQSH_EXTERN unsigned int squashfs_read_data(struct super_block *s, char *buffer,
-+			long long index, unsigned int length,
-+			long long *next_index, int srclength)
++/*
++ * Read and decompress a metadata block or datablock.  Length is non-zero
++ * if a datablock is being read (the size is stored elsewhere in the
++ * filesystem), otherwise the length is obtained from the first two bytes of
++ * the metadata block.  A bit in the length field indicates if the block
++ * is stored uncompressed in the filesystem (usually because compression
++ * generated a larger block - this does occasionally happen with zlib).
++ */
++int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
++			int length, u64 *next_index, int srclength, int pages)
 +{
-+	struct squashfs_sb_info *msblk = s->s_fs_info;
-+	struct squashfs_super_block *sblk = &msblk->sblk;
++	struct squashfs_sb_info *msblk = sb->s_fs_info;
 +	struct buffer_head **bh;
-+	unsigned int offset = index & ((1 << msblk->devblksize_log2) - 1);
-+	unsigned int cur_index = index >> msblk->devblksize_log2;
-+	int bytes, avail_bytes, b = 0, k = 0;
-+	unsigned int compressed;
-+	unsigned int c_byte = length;
++	int offset = index & ((1 << msblk->devblksize_log2) - 1);
++	u64 cur_index = index >> msblk->devblksize_log2;
++	int bytes, compressed, b = 0, k = 0, page = 0, avail;
 +
-+	bh = kmalloc(((sblk->block_size >> msblk->devblksize_log2) + 1) *
-+								sizeof(struct buffer_head *), GFP_KERNEL);
++
++	bh = kcalloc((msblk->block_size >> msblk->devblksize_log2) + 1,
++				sizeof(*bh), GFP_KERNEL);
 +	if (bh == NULL)
-+		goto read_failure;
++		return -ENOMEM;
 +
-+	if (c_byte) {
++	if (length) {
++		/*
++		 * Datablock.
++		 */
 +		bytes = -offset;
-+		compressed = SQUASHFS_COMPRESSED_BLOCK(c_byte);
-+		c_byte = SQUASHFS_COMPRESSED_SIZE_BLOCK(c_byte);
++		compressed = SQUASHFS_COMPRESSED_BLOCK(length);
++		length = SQUASHFS_COMPRESSED_SIZE_BLOCK(length);
++		if (next_index)
++			*next_index = index + length;
 +
-+		TRACE("Block @ 0x%llx, %scompressed size %d, src size %d\n", index,
-+					compressed ? "" : "un", (unsigned int) c_byte, srclength);
++		TRACE("Block @ 0x%llx, %scompressed size %d, src size %d\n",
++			index, compressed ? "" : "un", length, srclength);
 +
-+		if (c_byte > srclength || index < 0 || (index + c_byte) > sblk->bytes_used)
++		if (length < 0 || length > srclength ||
++				(index + length) > msblk->bytes_used)
 +			goto read_failure;
 +
-+		for (b = 0; bytes < (int) c_byte; b++, cur_index++) {
-+			bh[b] = sb_getblk(s, cur_index);
++		for (b = 0; bytes < length; b++, cur_index++) {
++			bh[b] = sb_getblk(sb, cur_index);
 +			if (bh[b] == NULL)
 +				goto block_release;
 +			bytes += msblk->devblksize;
 +		}
 +		ll_rw_block(READ, b, bh);
 +	} else {
-+		if (index < 0 || (index + 2) > sblk->bytes_used)
++		/*
++		 * Metadata block.
++		 */
++		if ((index + 2) > msblk->bytes_used)
 +			goto read_failure;
 +
-+		bh[0] = get_block_length(s, &cur_index, &offset, &c_byte);
++		bh[0] = get_block_length(sb, &cur_index, &offset, &length);
 +		if (bh[0] == NULL)
 +			goto read_failure;
 +		b = 1;
 +
 +		bytes = msblk->devblksize - offset;
-+		compressed = SQUASHFS_COMPRESSED(c_byte);
-+		c_byte = SQUASHFS_COMPRESSED_SIZE(c_byte);
++		compressed = SQUASHFS_COMPRESSED(length);
++		length = SQUASHFS_COMPRESSED_SIZE(length);
++		if (next_index)
++			*next_index = index + length + 2;
 +
-+		TRACE("Block @ 0x%llx, %scompressed size %d\n", index, compressed
-+					? "" : "un", (unsigned int) c_byte);
++		TRACE("Block @ 0x%llx, %scompressed size %d\n", index,
++				compressed ? "" : "un", length);
 +
-+		if (c_byte > srclength || (index + c_byte) > sblk->bytes_used)
++		if (length < 0 || length > srclength ||
++					(index + length) > msblk->bytes_used)
 +			goto block_release;
 +
-+		for (; bytes < c_byte; b++) {
-+			bh[b] = sb_getblk(s, ++cur_index);
++		for (; bytes < length; b++) {
++			bh[b] = sb_getblk(sb, ++cur_index);
 +			if (bh[b] == NULL)
 +				goto block_release;
 +			bytes += msblk->devblksize;
@@ -311,108 +180,192 @@
 +	}
 +
 +	if (compressed) {
-+		int zlib_err = 0;
++		int zlib_err = 0, zlib_init = 0;
 +
 +		/*
-+	 	* uncompress block
-+	 	*/
++		 * Uncompress block.
++		 */
 +
 +		mutex_lock(&msblk->read_data_mutex);
 +
-+		msblk->stream.next_out = buffer;
-+		msblk->stream.avail_out = srclength;
++		msblk->stream.avail_out = 0;
++		msblk->stream.avail_in = 0;
 +
-+		for (bytes = 0; k < b; k++) {
-+			avail_bytes = min(c_byte - bytes, msblk->devblksize - offset);
++		bytes = length;
++		do {
++			if (msblk->stream.avail_in == 0 && k < b) {
++				avail = min(bytes, msblk->devblksize - offset);
++				bytes -= avail;
++				wait_on_buffer(bh[k]);
++				if (!buffer_uptodate(bh[k]))
++					goto release_mutex;
++
++				if (avail == 0) {
++					offset = 0;
++					put_bh(bh[k++]);
++					continue;
++				}
 +
-+			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;
++				offset = 0;
++			}
 +
-+			msblk->stream.next_in = bh[k]->b_data + offset;
-+			msblk->stream.avail_in = avail_bytes;
++			if (msblk->stream.avail_out == 0 && page < pages) {
++				msblk->stream.next_out = buffer[page++];
++				msblk->stream.avail_out = PAGE_CACHE_SIZE;
++			}
 +
-+			if (k == 0) {
++			if (!zlib_init) {
 +				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);
++					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_init = 1;
 +			}
 +
-+			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;
-+			}
++			zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH);
 +
-+			bytes += avail_bytes;
-+			offset = 0;
-+			brelse(bh[k]);
-+		}
++			if (msblk->stream.avail_in == 0 && k < b)
++				put_bh(bh[k++]);
++		} while (zlib_err == Z_OK);
 +
-+		if (zlib_err != Z_STREAM_END)
++		if (zlib_err != Z_STREAM_END) {
++			ERROR("zlib_inflate error, data probably corrupt\n");
 +			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);
++			ERROR("zlib_inflate error, data probably corrupt\n");
 +			goto release_mutex;
 +		}
-+		bytes = msblk->stream.total_out;
++		length = msblk->stream.total_out;
 +		mutex_unlock(&msblk->read_data_mutex);
 +	} else {
-+		int i;
++		/*
++		 * Block is uncompressed.
++		 */
++		int i, in, pg_offset = 0;
 +
-+		for(i = 0; i < b; 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 = min(c_byte - bytes, msblk->devblksize - offset);
-+
-+			memcpy(buffer + bytes, bh[k]->b_data + offset, avail_bytes);
-+			bytes += avail_bytes;
++		for (bytes = length; k < b; k++) {
++			in = min(bytes, msblk->devblksize - offset);
++			bytes -= in;
++			while (in) {
++				if (pg_offset == PAGE_CACHE_SIZE) {
++					page++;
++					pg_offset = 0;
++				}
++				avail = min_t(int, in, PAGE_CACHE_SIZE -
++						pg_offset);
++				memcpy(buffer[page] + pg_offset,
++						bh[k]->b_data + offset, avail);
++				in -= avail;
++				pg_offset += avail;
++				offset += avail;
++			}
 +			offset = 0;
-+			brelse(bh[k]);
++			put_bh(bh[k]);
 +		}
 +	}
 +
-+	if (next_index)
-+		*next_index = index + c_byte + (length ? 0 :
-+				(SQUASHFS_CHECK_DATA(msblk->sblk.flags) ? 3 : 2));
-+
 +	kfree(bh);
-+	return bytes;
++	return length;
 +
 +release_mutex:
 +	mutex_unlock(&msblk->read_data_mutex);
 +
 +block_release:
 +	for (; k < b; k++)
-+		brelse(bh[k]);
++		put_bh(bh[k]);
 +
 +read_failure:
-+	ERROR("sb_bread failed reading block 0x%x\n", cur_index);
++	ERROR("squashfs_read_data failed to read block 0x%llx\n",
++					(unsigned long long) index);
 +	kfree(bh);
-+	return 0;
++	return -EIO;
 +}
+diff -urN linux-2.6.27.orig/fs/squashfs/cache.c linux-2.6.27/fs/squashfs/cache.c
+--- linux-2.6.27.orig/fs/squashfs/cache.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.27/fs/squashfs/cache.c	2009-06-10 05:05:27.000000000 +0200
+@@ -0,0 +1,413 @@
++/*
++ * Squashfs - a compressed read only filesystem for Linux
++ *
++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008
++ * Phillip Lougher <phillip at lougher.demon.co.uk>
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2,
++ * or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
++ *
++ * cache.c
++ */
++
++/*
++ * Blocks in Squashfs are compressed.  To avoid repeatedly decompressing
++ * recently accessed data Squashfs uses two small metadata and fragment caches.
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel-bare-vserver/linux-2.6.27-squashfs.patch?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list