GSoC idea: implement HFS Plus Journal
Subsystems (2)
Hi Naohiro,
I noticed Netgear recently released an implementation of HFS Plus Journal. Please check WNDRMAC-V1.0.0.18_gpl_src/linux/ directory of ftp://downloads.netgear.com/files/GPL/WNDRMAC-V1.0.0.18_gpl_src.tar.bz2.zip
Attached please find the HFS-related patch when diffing with tag v2.6.15. Maybe Netgear's implementation can help you implement HFS Plus Journal read/write support on Linux.
Cheers,
changcs
---
fs/Kconfig | 71 +++++ fs/hfsplus/Makefile | 3 +- fs/hfsplus/extents.c | 32 ++ fs/hfsplus/hfsplus_fs.h | 92 ++++++- fs/hfsplus/hfsplus_raw.h | 53 ++++ fs/hfsplus/inode.c | 49 +++ fs/hfsplus/journal.c | 775 ++++++++++++++++++++++++++++++++++++++++++++++ fs/hfsplus/super.c | 87 +++++- 8 files changed, 1158 insertions(+), 4 deletions(-)
fs/Kconfig +71 -0
@@ -921,6 +921,12 @@ config HFSPLUS_FS data forks and creator codes, but it also has several UNIX style features such as file ownership and permissions. +config HFSPLUS_JOURNAL + bool "HFSPLUS journal support" + depends on HFSPLUS_FS + help + Enabling journal support in HFSPlus file system. + config BEFS_FS tristate "BeOS file system (BeFS) support (read only) (EXPERIMENTAL)" depends on EXPERIMENTAL
@@ -1151,6 +1157,71 @@ config CRAMFS If unsure, say N. +config SQUASHFS + tristate "SquashFS 3.0 - Squashed file system support" + select ZLIB_INFLATE + help + Saying Y here includes support for SquashFS 3.0 (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 64K. + SquashFS 3.0 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 options for memory-constrained systems" + depends on SQUASHFS + default n + help + Saying Y here allows you to specify cache sizes and how Squashfs + allocates memory. This is only intended for memory constrained + systems. + + 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. + +config SQUASHFS_VMALLOC + bool "Use Vmalloc rather than Kmalloc" if SQUASHFS_EMBEDDED + depends on SQUASHFS + default n + help + By default SquashFS uses kmalloc to obtain fragment cache memory. + Kmalloc memory is the standard kernel allocator, but it can fail + on memory constrained systems. Because of the way Vmalloc works, + Vmalloc can succeed when kmalloc fails. Specifying this option + will make SquashFS always use Vmalloc to allocate the + fragment cache memory. + + If unsure, say N. + config VXFS_FS tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)" help
fs/hfsplus/Makefile +1 -2
@@ -5,5 +5,4 @@ obj-$(CONFIG_HFSPLUS_FS) += hfsplus.o hfsplus-objs := super.o options.o inode.o ioctl.o extents.o catalog.o dir.o btree.o \ - bnode.o brec.o bfind.o tables.o unicode.o wrapper.o bitmap.o part_tbl.o - + bnode.o brec.o bfind.o tables.o unicode.o wrapper.o bitmap.o part_tbl.o journal.o
fs/hfsplus/extents.c +32 -0
@@ -504,3 +504,35 @@ out:inode_set_bytes (inode,HFSPLUS_I (inode).fs_blocks << sb->s_blocksize_bits);mark_inode_dirty (inode); } + +#ifdef CONFIG_HFSPLUS_JOURNAL +int hfsplus_journaled_get_block (struct page *page) +{ +struct inode *const inode = page->mapping->host; +struct super_block *const sb = inode->i_sb; +u32 ablock, res; +sector_t iblock; +s32 block_num =-1 ; + + iblock = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits); + ablock = iblock >>HFSPLUS_SB (sb).fs_shift; +if (ablock <HFSPLUS_I (inode).first_blocks) { + block_num =hfsplus_ext_find_block (HFSPLUS_I (inode).first_extents, ablock); + } +else { +down (&HFSPLUS_I (inode).extents_lock); + res =hfsplus_ext_read_extent (inode, ablock); +if (!res) { +down (&HFSPLUS_I (inode).extents_lock); + block_num =hfsplus_ext_find_block (HFSPLUS_I (inode).cached_extents, ablock - +HFSPLUS_I (inode).cached_start); +up (&HFSPLUS_I (inode).extents_lock); + }else { +up (&HFSPLUS_I (inode).extents_lock); + } +up (&HFSPLUS_I (inode).extents_lock); + } + +return block_num; +} +#endif /* CONFIG_HFSPLUS_JOURNAL */
fs/hfsplus/hfsplus_fs.h +91 -1
126 lines not on this page · raw message
fs/hfsplus/hfsplus_raw.h +53 -0
70 lines not on this page · raw message
fs/hfsplus/inode.c +49 -0
64 lines not on this page · raw message
fs/hfsplus/journal.c new file +775 -0
775 lines not on this page · raw message
fs/hfsplus/super.c +86 -1
187 lines not on this page · raw message
Quoted 26 lines · On Thu, Mar 24, 2011 at 16:29:22, [email protected] (Naohiro) writes:
Hi,
I'd like to take part in Google Summer of Code [0][1] with some Linux Kernel related works.
I have MacBookPro booting both MacOSX and Linux. Now Linux can write the filesystem safely only when HFS Plus journal is off. My life would be more better if Linux have complete HFS Plus filesystem read/write support.
So I'm thinking of implementing HFS Plus Journal support on Linux. I've searched and found a technote about HFS Plus format describe its Journal [2].
To prepare and write my application form, I'd like to hear some comments or suggestion about this idea: something like difficulty (too easy, too hard, moderate, ...), some suggested articles and so on.
I have some patches applied for the kernel before so I have basic knowledge of Linux kernel development.
Regards,
Naohiro
[0] http://code.google.com/soc/
[1] http://www.linuxfoundation.org/collaborate/workgroups/gsoc/google-summer-code-2011
[2] http://developer.apple.com/library/mac/technotes/tn/tn1150.html#Journal