Skip to contentSkip to conversation

Port SquashFS to 2.6 (take 2)

PATCH New [email protected] 1 participant 1 message Jul 20, 2003

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Port SquashFS to 2.6 (take 2)

This is the second round of the port. I have fixed the following, based on suggestions from the list, since the initial patch:

- A couple of character buffers allocated on the stack in the original 2.4 code are allocated with kmalloc(GFP_KERNEL) now.

- A bit more readable Kconfig help message has been added.

----------------------------------------------------------------

The following is a straight port of Phillip Lougher's SquashFS
(http://squashfs.sf.net). The port is based on squashfs 1.2 for 2.4.20.

The patch is on top of, and tested with, 2.6.0-test1-ac2. It applies cleanly on vanilla 2.6.0-test1 (since -ac2 is mostly bugfixes, there is not much point testing with vanilla, though).

There are four things that are different from the 2.4 version (is there a "notes on porting filesystems from 2.4 to 2.6" document somewhere, btw?):

- Hooks in init/do_mounts.c to mount things in initramfs seems to have removed (there is no mention of CRAMFS there anymore), so that part of the patch has been removed.

- 2.6 vfs calls dir_ops.readdir without BKL held, and expected to do that itself if needed. The attached port mimics what cramfs/inode.c does differently between 2.4 and 2.6.

- struct super_block in 2.6 vfs has removed the embedded union for filesystem private data. Filesystems are expected to use void *s_fs_info member in it to hang private data in kmalloc'ed memory if needed. The attached port again mimics what cramfs/inode.c does differently between 2.4 and 2.6.

- struct inode in 2.6 vfs has removed the embedded union for filesystem private data. Filesystems with private data now define its own xxx_inode_info struct that embeds struct inode. IOW, containment has become inside out. The attached port defines alloc_inode (and corresponding destroy_inode) members in the super_operations struct, mimicking what ext3/super.c does differently between 2.4 and 2.6.

----------------------------------------------------------------

 fs/Kconfig                     |   20 
 fs/Makefile                    |    1 
 fs/squashfs/Makefile           |    8 
 fs/squashfs/inode.c            | 1045 +++++++++++++++++++++++++++++++++++++++++
 include/linux/squashfs_fs.h    |  304 +++++++++++
 include/linux/squashfs_fs_sb.h |   41 +
 lib/Kconfig                    |    4 
 7 files changed, 1421 insertions(+), 2 deletions(-)
fs/Kconfig +20 -0
diff -Naur linux-2.6.0-test1-ac2/fs/Kconfig linux-2.6.0-test1-ac2-sfs/fs/Kconfig
@@ -1114,6 +1114,26 @@
 
 	  If unsure, say N.
 
+config SQUASHFS
+	tristate "Squashfs file system support"
+	help
+	  Saying Y here includes support for Squashfs.  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 32K.
+
+	  See <http://squashfs.sourceforge.net/> for further information.
+
+	  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 VXFS_FS
 	tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
 	help
fs/Makefile +1 -0
diff -Naur linux-2.6.0-test1-ac2/fs/Makefile linux-2.6.0-test1-ac2-sfs/fs/Makefile
@@ -53,6 +53,7 @@
 obj-$(CONFIG_JBD)		+= jbd/
 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/
fs/squashfs/Makefile +8 -0
diff -Naur linux-2.6.0-test1-ac2/fs/squashfs/Makefile linux-2.6.0-test1-ac2-sfs/fs/squashfs/Makefile
@@ -0,0 +1,8 @@
+#
+# Makefile for the linux squashfs routines.
+#
+
+obj-$(CONFIG_SQUASHFS) += squashfs.o
+
+squashfs-objs := inode.o
+
fs/squashfs/inode.c +1045 -0

1,045 lines not on this page · raw message

include/linux/squashfs_fs.h +304 -0

304 lines not on this page · raw message

include/linux/squashfs_fs_sb.h +41 -0

41 lines not on this page · raw message

lib/Kconfig +2 -2
diff -Naur linux-2.6.0-test1-ac2/lib/Kconfig linux-2.6.0-test1-ac2-sfs/lib/Kconfig
@@ -17,8 +17,8 @@
 #
 config ZLIB_INFLATE
 	tristate
-	default y if CRAMFS=y || PPP_DEFLATE=y || JFFS2_FS=y || ZISOFS_FS=y || BINFMT_ZFLAT=y || CRYPTO_DEFLATE=y
-	default m if CRAMFS=m || PPP_DEFLATE=m || JFFS2_FS=m || ZISOFS_FS=m || BINFMT_ZFLAT=m || CRYPTO_DEFLATE=m
+	default y if CRAMFS=y || SQUASHFS=y || PPP_DEFLATE=y || JFFS2_FS=y || ZISOFS_FS=y || BINFMT_ZFLAT=y || CRYPTO_DEFLATE=y
+	default m if CRAMFS=m || SQUASHFS=m || PPP_DEFLATE=m || JFFS2_FS=m || ZISOFS_FS=m || BINFMT_ZFLAT=m || CRYPTO_DEFLATE=m
 
 config ZLIB_DEFLATE
 	tristate