-From: Artem Bityutskiy <dedekind@yandex.ru>
-
-This patch adds new operation to struct super_operations - sync_inodes,
-generic implementaion and changes fs-writeback.c:sync_sb_inodes() to call
-filesystem's sync_inodes if it is defined or generic implementaion otherwise.
-This new operation allows filesystem to decide itself what to flush.
-
-Reiser4 flushes dirty pages on basic of atoms, not of inodes. sync_sb_inodes
-used to call address space flushing method (writepages) for every dirty inode.
- For reiser4 it caused having to commit atoms unnecessarily often. This
-turned into substantial slowdown. Having this method helped to fix that
-problem.
-
-akpm: this patch needs to be chnaged to remove the `sb' arg.
-
-Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/fs-writeback.c | 5 ++++-
- include/linux/fs.h | 2 ++
- 2 files changed, 6 insertions(+), 1 deletion(-)
-
-diff -puN fs/fs-writeback.c~reiser4-vfs-add-super_operationssync_inodes-2 fs/fs-writeback.c
---- a/fs/fs-writeback.c~reiser4-vfs-add-super_operationssync_inodes-2
-+++ a/fs/fs-writeback.c
-@@ -1221,7 +1221,10 @@ EXPORT_SYMBOL(writeback_inodes_sb);
- */
- void sync_inodes_sb(struct super_block *sb)
- {
-- bdi_sync_writeback(sb->s_bdi, sb);
-+ if (sb->s_op->sync_inodes)
-+ sb->s_op->sync_inodes(sb, NULL);
-+ else
-+ bdi_sync_writeback(sb->s_bdi, sb);
- wait_sb_inodes(sb);
- }
- EXPORT_SYMBOL(sync_inodes_sb);
-diff -puN include/linux/fs.h~reiser4-vfs-add-super_operationssync_inodes-2 include/linux/fs.h
---- a/include/linux/fs.h~reiser4-vfs-add-super_operationssync_inodes-2
-+++ a/include/linux/fs.h
-@@ -1568,6 +1568,8 @@ struct super_operations {
- void (*clear_inode) (struct inode *);
- void (*umount_begin) (struct super_block *);
-
-+ void (*sync_inodes)(struct super_block *sb,
-+ struct writeback_control *wbc);
- int (*show_options)(struct seq_file *, struct vfsmount *);
- int (*show_stats)(struct seq_file *, struct vfsmount *);
- #ifdef CONFIG_QUOTA
-_
-From: Hans Reiser <reiser@namesys.com>
-
-Reiser4 is trying to add/remove pages to/from address space, so it needs
-add_to_page_cache_lru to be EXPORT_SYMBOL-ed.
-
-[bunk@stusta.de: unexport {,__}remove_from_page_cache]
-Signed-off-by: Adrian Bunk <bunk@stusta.de>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- mm/filemap.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff -puN mm/filemap.c~reiser4-export-remove_from_page_cache mm/filemap.c
---- a/mm/filemap.c~reiser4-export-remove_from_page_cache
-+++ a/mm/filemap.c
-@@ -779,6 +779,7 @@ repeat:
- rcu_read_unlock();
- return ret;
- }
-+EXPORT_SYMBOL(add_to_page_cache_lru);
-
- /**
- * find_get_pages_contig - gang contiguous pagecache lookup
-_
-From: Andrew Morton <akpm@linux-foundation.org>
-
-merge glitch
-
-Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- mm/filemap.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff -puN mm/filemap.c~reiser4-export-remove_from_page_cache-fix mm/filemap.c
---- a/mm/filemap.c~reiser4-export-remove_from_page_cache-fix
-+++ a/mm/filemap.c
-@@ -779,7 +779,6 @@ repeat:
- rcu_read_unlock();
- return ret;
- }
--EXPORT_SYMBOL(add_to_page_cache_lru);
-
- /**
- * find_get_pages_contig - gang contiguous pagecache lookup
-_
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- mm/filemap.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff -puN mm/filemap.c~reiser4-export-find_get_pages mm/filemap.c
---- a/mm/filemap.c~reiser4-export-find_get_pages
-+++ a/mm/filemap.c
-@@ -779,6 +779,7 @@ repeat:
- rcu_read_unlock();
- return ret;
- }
-+EXPORT_SYMBOL(find_get_pages);
-
- /**
- * find_get_pages_contig - gang contiguous pagecache lookup
-_
-From: Vladimir Saveliev <vs@namesys.com>
-
-This is the main reiserfs4 filesystem.
-
-Q&A wrt this patch:
-
-- A really short guide to how to get up and running with this filesystem.
-
- Reiser4 is a file system based on dancing tree algorithms, and
- is described at http://www.namesys.com. One should be able to get it
- up and running just like any of the other filesystems supported by
- Linux. Configure it to be compiled either builtin or as a module.
- Create reiser4 filesystem with mkfs.reiser4, mount and use it. More
- detailed info can be found at
- http://thebsh.namesys.com/snapshots/LATEST/READ.ME.
-
-- The direct URL which people use to obtain the mkfs tool for this
- filesystem. Also fsck and anything else.
-
- Reiser4 userland tools can be obtained at
- ftp://ftp.namesys.com/pub/reiser4progs.
- ftp://ftp.namesys.com/pub/reiser4progs/README contains detailed
- instructions on how to compile and install these tools. Also all
- reiser4 progs have man pages.
-
-- Any known shortcomings, caveats, etc.
-
- Reiser4 has been tested on i386 yet only. Quota support is
- not ready yet. Should be ready soon. Reiser4 was tested extensively,
- and we got to where the mailing list was not able to hit any bugs, but
- then we told people that, got an order of magnitude increase in users,
- and they are able to hit bugs that we are working on now.
-
- Reiser's Law of Software Engineering: Each order of magnitude
- increase in users finds more bugs, in a quantity equal to the previous
- order of magnitude increase in users. Success for software developers
- is measured by how long the frustration lasts.
-
- Only the very core functionality is working. Exotic plugins,
- an API for multiple operation transactions and accessing multiple
- small files in one syscall, compression, inheritance, all have been
- postponed until after the core functionality is shipped. The
- compression plugin needs a code review before anyone should use it.
-
-- A statement on compatibility with reiserfs3 filesytems.
-
- To upgrade from reiserfs V3 to V4, use tar, or sponsor us to
- write a convertfs.
-
-- Bear in mind that people will immediately benchmark this filesytem, and
- first impressions count. Now is your chance to communicate any tuning
- guidelines, mount options or whatever which you'd like people to understand
- BEFORE they start publishing benchmark info.
-
- Reiser4 is not tuned for fsync/sync/O_SYNC performance yet.
-
- If you see results that are much different from those at
- www.namesys.com/benchmarks.html, let us know. If you see performance
- characteristics that don't quite make sense, email
- reiserfs-list@namesys.com, such things are always of interest.
-
- reiser4 is not tuned for mmaping and dirtying more than
- physical ram like IOzone does. This is quite different in its code
- path from writing and dirtying more than physical ram. There are
- those who think that what IOZone does is rarely done by real programs,
- and therefor we should not bother to optimize what it does. All I
- know is, this month we are not optimized for it.
-
- Please consider its space savings when you benchmark it also.
-
-[michal.k.k.piotrowski@gmail.com: kill #include "linux/config.h"]
-[akpm@linux-foundation.org: reiser4_drop_page: don't call remove_from_page_cache]
-[bunk@stusta.de: fs/reiser4/: possible cleanups]
-Signed-off-by: Vladimir Saveliev <vs@namesys.com>
-Signed-off-by: Hans Reiser <reiser@namesys.com>
-Signed-off-by: Edward Shishkin <edward@namesys.com>
-DESC
-reiser4: fix for drop-unused-semaphores.patch
-EDESC
-From: Edward Shishkin <edward@namesys.com>
-
-Wait for tail conversion completion when acquiring exclusive access by
-. mmap_unix_file()
-. setattr_unix_file()
-. release_unix_file()
-Update comments.
-
-Signed-off-by: Edward Shishkin <edward@namesys.com>
-Cc Jonathan Briggs <jbriggs@esoft.com>
-DESC
-reiser4-slab-allocators-remove-slab_debug_initial-flag
-EDESC
-From: Andrew Morton <akpm@linux-foundation.org>
-
-Cc: Christoph Lameter <cl@linux-foundation.org>.com>
-DESC
-reiser4: use simple_prepare_write to zero page data
-EDESC
-From: Nate Diller <nate.diller@gmail.com>
-
-It's common for file systems to need to zero data on either side of a
-write, if a page is not Uptodate during prepare_write. It just so happens
-that simple_prepare_write() in libfs.c does exactly that, so we can avoid
-duplication and just call that function to zero page data.
-
-Signed-off-by: Nate Diller <nate.diller@gmail.com>
-Cc: Vladimir Saveliev <vs@namesys.com>
-Cc: Edward Shishkin <edward@namesys.com>
-DESC
-reiser4-fix
-EDESC
-From: Andrew Morton <akpm@linux-foundation.org>
-
-
-DESC
-reiser4: use zero_user_page
-EDESC
-From: Nate Diller <nate.diller@gmail.com>
-
-Use zero_user_page() instead of open-coding it.
-
-Signed-off-by: Nate Diller <nate.diller@gmail.com>
-Cc: Vladimir Saveliev <vs@namesys.com>
-Cc: Edward Shishkin <edward@namesys.com>
-DESC
-reiser4: remove typedefs
-EDESC
-From: Edward Shishkin <edward@namesys.com>
-
-. Reduce number of typedefs from 289 to 248
-. Remove unused file plugin/file/invert.c
-. Update comments
-
-DESC
-reiser4: fix write_extent
-EDESC
-From: Edward Shishkin <edward@namesys.com>
-
-Prepared-by Ignatich <ignatich@gmail.com>
-
-Fix reiser4_write_extent():
- 1) handling incomplete writes missed in reiser4-temp-fix.patch
- 2) bugs in the case of returned errors
-
-Signed-off-by: Edward Shishkin <edward@namesys.com>
-DESC
-reiser4 make sync_inodes non-void
-EDESC
-From: Edward Shishkin <edward@namesys.com>
-
-Make reiser4_sync_inodes non-void
-
-Signed-off-by: Edward Shishkin <edward@namesys.com>
-DESC
-Reiser4: Drop 'size' argument from bio_endio and bi_end_io
-EDESC
-From: Laurent Riffard <laurent.riffard@free.fr>
-
-Reiser4: Drop 'size' argument from bio_endio and bi_end_io
-
-This patch pushes into Reiser4 the changes introduced by
-commit 6712ecf8f648118c3363c142196418f89a510b90:
-
- As bi_end_io is only called once when the request is complete,
- the 'size' argument is now redundant. Remove it.
-
- Now there is no need for bio_endio to subtract the size completed
- from bi_size. So don't do that either.
-
- While we are at it, change bi_end_io to return void.
-
-Signed-off-by: Laurent Riffard <laurent.riffard@free.fr>
-Acked-by: Jens Axboe <jens.axboe@oracle.com>
-Acked-by: Edward Shishkin <edward@namesys.com>
-DESC
-mm: clean up and kernelify shrinker registration
-EDESC
-From: Rusty Russell <rusty@rustcorp.com.au>
-
-I can never remember what the function to register to receive VM pressure
-is called. I have to trace down from __alloc_pages() to find it.
-
-It's called "set_shrinker()", and it needs Your Help.
-
-1) Don't hide struct shrinker. It contains no magic.
-2) Don't allocate "struct shrinker". It's not helpful.
-3) Call them "register_shrinker" and "unregister_shrinker".
-4) Call the function "shrink" not "shrinker".
-5) Reduce the 17 lines of waffly comments to 13, but document it properly.
-
-The comment in reiser4 makes me a little queasy.
-
-Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-Cc: Vladimir Saveliev <vs@namesys.com>
-Acked-by: Edward Shishkin <edward@namesys.com>
-DESC
-reiser4: fix NULL dereference in __mnt_is_readonly in ftruncate()
-EDESC
-From: Dave Hansen <haveblue@us.ibm.com>
-
-Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
-Cc: Edward Shishkin <edward@namesys.com>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-reiser4: fix extent2tail
-EDESC
-From: Edward Shishkin <edward@namesys.com>
-
-Fixed bug in extent2tail conversion.
-
-Bug description:
-when converting partially converted file
-(with flag REISER4_PART_MIXED installed)
-reiser4_cut_tree() starts to cut old metatada
-from wrong offset. Result is data corruption.
-
-Signed-off-by: Edward Shishkin <edward@namesys.com>
-DESC
-reiser4: fix read_tail
-EDESC
-From: Edward Shishkin <edward@namesys.com>
-
-Update hint when reading tails
-
-Signed-off-by: Edward Shishkin <edward@namesys.com>
-DESC
-reiser4: fix unix-file readpages filler
-EDESC
-From: Edward Shishkin <edward@namesys.com>
-
-Protect page (via incrementing page count) from being reclaimed when looking
-for extent pointer in unix-file specific readpages filler.
-
-Signed-off-by: Edward Shishkin <edward@namesys.com>
-DESC
-reiser4: fix readpage_unix_file
-EDESC
-From: Edward Shishkin <edward@namesys.com>
-
-. If nominated (by VFS) page is out of file size, then fill it
- by zeros instead of returning -EINVAL (this prevents returning
- an unexpected error (-EINVAL) by some apps that don't check
- file size).
-
-. Check if the page became uptodate while it was being unlocked.
-
-Signed-off-by: Edward Shishkin <edward@namesys.com>
-Cc: Zan Lynx <zlynx@acm.org>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-reiser4: fix for new aops patches
-EDESC
-From: Nick Piggin <npiggin@suse.de>
-
-Cc: Vladimir Saveliev <vs@namesys.com>
-Cc: Edward Shishkin <edward@namesys.com>
-DESC
-reiser4: do not allocate struct file on stack
-EDESC
-From: Edward Shishkin <edward@namesys.com>
-
-Do not allocate struct file on stack, pass the persistent one instead.
-
-Signed-off-by: Edward Shishkin <edward@namesys.com>
-Tested-by: Zan Lynx <zlynx@acm.org>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-git-block-vs-reiser4
-EDESC
-From: Andrew Morton <akpm@linux-foundation.org>
-
-Hope this is right.
-
-Hope you know what you're doing ;)
-
-Cc: Vladimir Saveliev <vs@namesys.com>
-Cc: Edward Shishkin <edward@namesys.com>
-Cc: Jens Axboe <jens.axboe@oracle.com>
-DESC
-reiser4: cryptcompress misc fixups
-EDESC
-From: Edward Shishkin <edward@namesys.com>
-
-. Fix a race (reproducible by fsx + sync (1)) between
- checkin_page_cluster operations: serialize them via special per-inode
- checkin_mutex (usual i_mutex is not suitable for this purpose, as
- ->writepages() also calls checkin_page_cluster();
-
-. Add comments for checkin/checkout technique for synchronization of
- primary and secondary caches with proof of correctness;
-
-. Fix missed right neighbor when updating disk clusters by
- handle_pos_on_leaf() during squalloc (should use upper levels to get
- expected non-connected neighbor);
-
-. Resolve a race between read and truncate (when read finds partially
- truncated and, hence, unrecoverable disk cluster) via keeping a track of
- leftmost truncated disk clusters in cryptcompress-specific part of inode;
-
-. Introduce size translators and size modulators for
- common needs;
-
-. Update comments;
-
-. Rename badly sounding function names;
-
-. Fix coding style;
-
-. Add my part of credits.
-
-Signed-off-by: Edward Shishkin <edward@namesys.com>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-reiser4: cryptcompress misc fixups-2
-EDESC
-From: Edward Shishkin <edward@namesys.com>
-
-Check a file plugin id before manipulating with plugin-specific counter.
-
-Signed-off-by: Edward Shishkin <edward@namesys.com>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-fs/reiser4/plugin/: make 3 functions static
-EDESC
-From: Adrian Bunk <bunk@kernel.org>
-
-This patch makes the following needlessly global functions static:
-- file/cryptcompress.c: __put_page_cluster()
-- file/cryptcompress.c: put_hint_cluster()
-- item/ctail.c: ctail_read_disk_cluster()
-
-Signed-off-by: Adrian Bunk <bunk@kernel.org>
-Cc: Edward Shishkin <edward@namesys.com>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-reiser4: change error code base
-EDESC
-From: Edward Shishkin <edward@namesys.com>
-
-Change REISER4_ERROR_CODE_BASE to 10000 to not overlap real errnos
-
-Signed-off-by: Edward Shishkin <edward@namesys.com>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-reiser4: use lzo library functions
-EDESC
-From: Edward Shishkin <edward@namesys.com>
-
-. Convert Reiser4 to use lzo implementation in lib/lzo/ instead of
- including its own copy of minilzo;
-. Do not set zeros to workmem region.
-
-Signed-off-by: Edward Shishkin <edward@namesys.com>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-fs/reiser4/plugin/file/cryptcompress.c: kmalloc + memset conversion to kzalloc
-EDESC
-From: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
-
- fs/reiser4/plugin/file/cryptcompress.c | 101386 -> 101352 (-34 bytes)
- fs/reiser4/plugin/file/cryptcompress.o | 456784 -> 456644 (-140 bytes)
-
-Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
-Cc: Edward Shishkin <edward@namesys.com>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-reiser4: kmalloc + memset conversion to kzalloc
-EDESC
-From: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
-
-Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
-Cc: Edward Shishkin <edward@namesys.com>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-fs/reiser4/init_super.c: kmalloc + memset conversion to kzalloc
-EDESC
-From: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
-
- fs/reiser4/init_super.c | 19283 -> 19246 (-37 bytes)
- fs/reiser4/init_super.o | 155348 -> 155152 (-196 bytes)
-
-Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
-Cc: Edward Shishkin <edward@namesys.com>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-fs/reiser4/plugin/inode_ops_rename.c: kmalloc + memset conversion to kzalloc
-EDESC
-From: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
-
- fs/reiser4/plugin/inode_ops_rename.c | 28474 -> 28344 (-130 bytes)
- fs/reiser4/plugin/inode_ops_rename.o | 142600 -> 142476 (-124 bytes)
-
-Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
-Cc: Edward Shishkin <edward@namesys.com>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-fs/reiser4/ktxnmgrd.c: kmalloc + memset conversion to kzalloc
-EDESC
-From: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
-
- fs/reiser4/ktxnmgrd.c | 5314 -> 5277 (-37 bytes)
- fs/reiser4/ktxnmgrd.o | 131624 -> 131496 (-128 bytes)
-
-Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
-Cc: Edward Shishkin <edward@namesys.com>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-Use helpers to obtain task pid in printks
-EDESC
-From: Pavel Emelyanov <xemul@openvz.org>
-
-The task_struct->pid member is going to be deprecated, so start
-using the helpers (task_pid_nr/task_pid_vnr/task_pid_nr_ns) in
-the kernel.
-
-The first thing to start with is the pid, printed to dmesg - in
-this case we may safely use task_pid_nr(). Besides, printks produce
-more (much more) than a half of all the explicit pid usage.
-
-Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
-DESC
-Subject: [PATCH 1/2] remove asm/bitops.h includes
-EDESC
-From: Jiri Slaby <jirislaby@gmail.com>
-
-remove asm/bitops.h includes
-
-including asm/bitops directly may cause compile errors. don't include it
-and include linux/bitops instead. next patch will deny including asm header
-directly.
-
-Cc: Adrian Bunk <bunk@kernel.org>
-Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
-
----
-commit 3c05eef3d0a98065323d7d6d9a78e0985eba4b10
-tree cb9691832992f570b0363dd568f6fa3d2c81e3f5
-parent 132bb039c741d00f066e7501e3613d2d20bf0595
-author Jiri Slaby <jirislaby@gmail.com> Tue, 04 Sep 2007 21:01:35 +0200
-committer Jiri Slaby <jirislaby@gmail.com> Tue, 04 Sep 2007 21:01:35 +0200
-
-index 7ad84ea..32afaa3 100644
-DESC
-git-nfsd-broke-reiser4
-EDESC
-From: Andrew Morton <akpm@linux-foundation.org>
-
-fs/reiser4/export_ops.c: In function 'reiser4_decode_fh':
-fs/reiser4/export_ops.c:96: error: 'const struct export_operations' has no member named 'find_exported_dentry'
-fs/reiser4/export_ops.c:96: warning: type defaults to 'int' in declaration of 'fn'
-fs/reiser4/export_ops.c:98: error: 'const struct export_operations' has no member named 'find_exported_dentry'
-fs/reiser4/export_ops.c:99: warning: comparison between pointer and integer
-fs/reiser4/export_ops.c:101: error: called object 'fn' is not a function
-fs/reiser4/export_ops.c: At top level:
-fs/reiser4/export_ops.c:282: error: unknown field 'decode_fh' specified in initializer
-fs/reiser4/export_ops.c:282: warning: initialization from incompatible pointer type
-fs/reiser4/export_ops.c:284: error: unknown field 'get_dentry' specified in initializer
-fs/reiser4/export_ops.c:285: warning: excess elements in struct initializer
-fs/reiser4/export_ops.c:285: warning: (near initialization for 'reiser4_export_operations')
-
-help!
-
-Cc: J. Bruce Fields <bfields@citi.umich.edu>
-Cc: Edward Shishkin <edward@namesys.com>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-slab-api-remove-useless-ctor-parameter-and-reorder-parameters-vs-reiser4
-EDESC
-From: Andrew Morton <akpm@linux-foundation.org>
-
-Cc: Christoph Lameter <cl@linux-foundation.org>
-DESC
-reiser4 kgdb fix
-EDESC
-From: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
-
-fs/built-in.o: In function `reiser4_debugtrap':
-/root/kernels/linux-2.6.25-rc5/fs/reiser4/debug.c:295: undefined reference to `breakpoint'
-make: *** [.tmp_vmlinux1] Error 1
-
-This build failure has been introduced by reiser4.patch, i think the
-breakpoint() have been used instead of kgdb_breakpoint().
-
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-Reiser4 portion of zero_user cleanup patch
-EDESC
-From: Christoph Lameter <cl@linux-foundation.org>
-
-Reiser4 only exists in mm. So split this off.
-
-Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
-DESC
-reiser4: replace uid==0 check with capability
-EDESC
-From: "Serge E. Hallyn" <serue@us.ibm.com>
-
-Reiser4 gives root some reserved blocks. Replace the uid==0 check, which
-is not safe in the face of user namespaces, with a CAP_SYS_RESOURCE check,
-which seems appropriate.
-
-The per-uid and per-guid reservations appear unimplemented so I'm ignoring
-them.
-
-Signed-off-by: Serge Hallyn <serue@us.ibm.com>
-Acked-by: Edward Shishkin <edward.shishkin@gmail.com>
-Cc: "Vladimir V. Saveliev" <vs@namesys.com>
-DESC
-jens-fixed-reiser4
-EDESC
-From: Jens Axboe <jens.axboe@oracle.com>
-
-On Tue, Nov 06 2007, akpm@linux-foundation.org wrote:
->
-> The patch titled
-> jens-broke-reiser4
-> has been added to the -mm tree. Its filename is
-> jens-broke-reiser4.patch
->
-> *** Remember to use Documentation/SubmitChecklist when testing your code ***
->
-> See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
-> out what to do about this
->
-> ------------------------------------------------------
-> Subject: jens-broke-reiser4
-> From: Andrew Morton <akpm@linux-foundation.org>
->
-> fs/reiser4/plugin/file/cryptcompress.c: In function 'reiser4_deflate_cluster':
-> fs/reiser4/plugin/file/cryptcompress.c:1120: error: 'struct scatterlist' has no member named 'page'
-> fs/reiser4/plugin/file/cryptcompress.c:1124: error: 'struct scatterlist' has no member named 'page'
-> fs/reiser4/plugin/file/cryptcompress.c: In function 'reiser4_inflate_cluster':
-> fs/reiser4/plugin/file/cryptcompress.c:1184: error: 'struct scatterlist' has no member named 'page'
-> fs/reiser4/plugin/file/cryptcompress.c:1188: error: 'struct scatterlist' has no member named 'page'
->
-> Please send a fix against next -mm.
-
-Here's one for 2.6.23-mm1, should apply fine for you now.
-
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-reiser4: make methods supplied to vfs invariant
-EDESC
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Problem:
-hangs when writing to reiser4 partition exported via nfs
-(found by Roc Vallès Domènech <rvalles@es.gnu.org>).
-
-Bug:
-vfs (which is not aware of reiser4 plugin conversion) uses
-obsolete copy of @file->f_op, whereas old methods are not
-aware about new structures. It leads to memory corruption.
-
-Fixup:
-Prevent collisions with vfs:
-Make inode_ops, file_ops and a_ops supplied to vfs
-invariant with respect to plugin conversion.
-
-Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-reiser4: new export ops
-EDESC
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Adjust reiser4 for the new export ops.
-
-Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-reiser4: new export ops (update)
-EDESC
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-reiser4: new export_ops fixup
-EDESC
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Added missed reiser4_{init, exit}_context()
-
-Cc: Sven Muller <musv@gmx.de>
-DESC
-reiser4: specify splice file operations
-EDESC
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Specify splice_read, splice_write file operations for loopback
-functionality.
-
-Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
-Cc: Jens Axboe <jens.axboe@oracle.com>
-DESC
-reiser4: fix dummy ioctl_cryptcompress
-EDESC
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-. Problem: unexpected resolving to prompt when merging/updating
- stuff with python-based Gentoo manager (reported by
- rvalles <rvalles@es.gnu.org> and
- Dushan Tcholich <dusanc@gmail.com>).
-
- Bug: User application made wrong decision about file's nature
- based on returned value of ->ioctl() method for cryptcompress
- file plugin.
-
- Fix: make dummy ->ioctl() method for cryptcompress file plugin
- to return -EINVAL instead of zero.
-
-. Drop some redundant ifs.
-
-. Update comments. Add precise definition of FCS (file conversion set)
- that should be protected during file plugin conversion.
-
-Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-reiser4: granulate rw-serialization when accessing file conversion set
-EDESC
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Split common file plugin conversion procedure into
-. plugin scheduling part
-. plugin conversion part
-Move the last one to the plugin-independent file operation
-(reiser4_write_careful) with active protection of file
-conversion set (conv_sem held).
-
-Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-reiser4: fix disk cluster synchronization
-EDESC
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Problem:
-(2.6.24-rc3-mm2) BUG: unable to handle kernel NULL
-pointer dereference at virtual address 00000024
-EIP is at convert_ctail+0x14e/0x166
-
-Bug: When updating disk clusters convert_ctail()
-looks at inode which is already evicted from memory
-or reused for other needs.
-
-Fixup: Keep all needed file-specific info in
-convert_item_info before disk cluster update
-(when inode is pinned), then forget about inode.
-
-Cleanups in plugin/file/file_conversion.c
-
-Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-reiser4: use balance_dirty_pages_ratelimited_nr
-EDESC
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Use balance_dirty_pages_ratelimited_nr() instead of
-balance_dirty_pages_ratelimited() for all reiser4 page cluster operations.
-
-Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-reiser4: correct references to filemap_nopage()
-EDESC
-From: Nick Piggin <npiggin@suse.de>
-
-Correct old reiser4 references to filemap_nopage. No code change.
-
-Signed-off-by: Nick Piggin <npiggin@suse.de>
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-reiser4: fix null pointer dereference in reiser4_write_extent
-EDESC
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Problem:
-Oops when starting kde4:
-BUG: unable to handle kernel NULL pointer dereference
-at virtual address 0000000c
-printing eip: c025eba5 *pde = 00000000
-Oops: 0000 [#1] SMP
-last sysfs file: /devices/pci0000:00/0000:00:1e.0/0000:04:04.0/resource
-Modules linked in: thermal processor fan button
-
-Pid: 3705, comm: kwrite Not tainted (2.6.23-mm1 #8)
-EIP: 0060:[<c025eba5>] EFLAGS: 00010246 CPU: 0
-EIP is at update_extents+0x44/0x2e7
-
-Bug:
-Trying to look at not persistent struct file in the
-case of expanded truncate via sys_truncate64(path, length).
-
-The fixup:
-. Don't look at struct file at truncate_file_body();
-. Add an inode *inode argument to the following
- functions to handle the case of not persistent
- struct file.
- . reiser4_write_extent();
- . reiser4_write_tail();
- . reiser4_update_extents();
-Other changes:
-. Add missesd identifier in some asserts.
-. Comments cleanups.
-
-Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-reiser4: code cleanups
-EDESC
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Coding style fixups.
-
-Signed-off-by: Dushan Tcholich <dusanc@gmail.com>
-Signed-off-by: Bartosz Szreder <cfiend@talent.edu.pl>
-Acked-by: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-reiser4-tree_lock-fixes
-EDESC
-From: Andrew Morton <akpm@linux-foundation.org>
-
-Cc: Nick Piggin <nickpiggin@yahoo.com.au>
-DESC
-reiser4-tree_lock-fixes-fix
-EDESC
-From: Andrew Morton <akpm@linux-foundation.org>
-
-Cc: Nick Piggin <nickpiggin@yahoo.com.au>
-DESC
-reiser4: fix handling ENOSPC cryptcompress
-EDESC
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Problem:
-Processes fall into infinite loop
-when running in no-space-left-on-device situation.
-
-Fixup:
-Fixed leak of checkin_mutex in do_write_cryptcompress();
-
-DESC
-reiser4: fix handling ENOSPC unix_file
-EDESC
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Problem:
-Processes fall into infinite loop
-when running in no-space-left-on-device situation.
-
-Fixups:
-1. fixed leak of exclusive access in write_unix_file();
-2. fixed leak of inode's flag REISER4_PART_IN_CONV in tail2extent();
-DESC
-reiser4: fix kill_hook_internal
-EDESC
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Problem:
-Failed assertion (nikita-2754): child znode is not loaded
-when looking at its number of items in kill_hook_internal().
-Nobody cares about its loading.
-
-Fixup:
-Added missed zload/zrelse of the child.
-DESC
-reiser4-semaphore-fix
-EDESC
-From: Andrew Morton <akpm@linux-foundation.org>
-
-In file included from fs/reiser4/znode.h:23,
- from fs/reiser4/tree.h:14,
- from fs/reiser4/super.h:11,
- from fs/reiser4/debug.c:28:
-include/asm/semaphore.h:1:2: warning: #warning Use linux/semaphore.h, not asm/semaphore.h
-
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-slb-drop-kmem-cache-argument-from-constructor-reiser4
-EDESC
-From: Andrew Morton <akpm@linux-foundation.org>
-DESC
-reiser4-suid
-EDESC
-From: Andrew Morton <akpm@linux-foundation.org>
-DESC
-reiser4: compile warning cleanups
-EDESC
-From: "Ryan Hope" <rmh3093@gmail.com>
-
-Clean up some reiser4 compile warnings:
-
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-reiser4: use wake_up_process() instead of wake_up() when possible
-EDESC
-From: Ryan Hope <rmh3093@gmail.com>
-
-This was item #6 on the todo list for reiser4 inclusion in mainline:
-
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-DESC
-reiser4: track upstream changes
-EDESC
-From: Andrew Morton <akpm@linux-foundation.org>
-
-Hope it still works..
-
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- Documentation/Changes | 12
- Documentation/filesystems/reiser4.txt | 75
- fs/Kconfig | 1
- fs/Makefile | 1
- fs/reiser4/Kconfig | 34
- fs/reiser4/Makefile | 98
- fs/reiser4/README | 128
- fs/reiser4/as_ops.c | 376 +
- fs/reiser4/block_alloc.c | 1142 ++++
- fs/reiser4/block_alloc.h | 177
- fs/reiser4/blocknrset.c | 371 +
- fs/reiser4/carry.c | 1398 +++++
- fs/reiser4/carry.h | 445 +
- fs/reiser4/carry_ops.c | 2132 +++++++++
- fs/reiser4/carry_ops.h | 43
- fs/reiser4/context.c | 289 +
- fs/reiser4/context.h | 228
- fs/reiser4/coord.c | 928 +++
- fs/reiser4/coord.h | 399 +
- fs/reiser4/debug.c | 308 +
- fs/reiser4/debug.h | 351 +
- fs/reiser4/dformat.h | 71
- fs/reiser4/dscale.c | 192
- fs/reiser4/dscale.h | 28
- fs/reiser4/entd.c | 335 +
- fs/reiser4/entd.h | 90
- fs/reiser4/eottl.c | 510 ++
- fs/reiser4/estimate.c | 129
- fs/reiser4/export_ops.c | 328 +
- fs/reiser4/flush.c | 3703 +++++++++++++++
- fs/reiser4/flush.h | 300 +
- fs/reiser4/flush_queue.c | 678 ++
- fs/reiser4/forward.h | 256 +
- fs/reiser4/fsdata.c | 804 +++
- fs/reiser4/fsdata.h | 205
- fs/reiser4/init_super.c | 751 +++
- fs/reiser4/inode.c | 711 +++
- fs/reiser4/inode.h | 453 +
- fs/reiser4/ioctl.h | 41
- fs/reiser4/jnode.c | 1923 ++++++++
- fs/reiser4/jnode.h | 704 ++
- fs/reiser4/kassign.c | 677 ++
- fs/reiser4/kassign.h | 111
- fs/reiser4/key.c | 138
- fs/reiser4/key.h | 392 +
- fs/reiser4/ktxnmgrd.c | 215
- fs/reiser4/ktxnmgrd.h | 52
- fs/reiser4/lock.c | 1237 +++++
- fs/reiser4/lock.h | 250 +
- fs/reiser4/oid.c | 141
- fs/reiser4/page_cache.c | 714 +++
- fs/reiser4/page_cache.h | 68
- fs/reiser4/plugin/Makefile | 26
- fs/reiser4/plugin/cluster.c | 72
- fs/reiser4/plugin/cluster.h | 410 +
- fs/reiser4/plugin/compress/Makefile | 5
- fs/reiser4/plugin/compress/compress.c | 367 +
- fs/reiser4/plugin/compress/compress.h | 43
- fs/reiser4/plugin/compress/compress_mode.c | 162
- fs/reiser4/plugin/crypto/cipher.c | 37
- fs/reiser4/plugin/crypto/cipher.h | 55
- fs/reiser4/plugin/crypto/digest.c | 58
- fs/reiser4/plugin/dir/Makefile | 5
- fs/reiser4/plugin/dir/dir.h | 36
- fs/reiser4/plugin/dir/hashed_dir.c | 81
- fs/reiser4/plugin/dir/seekable_dir.c | 46
- fs/reiser4/plugin/dir_plugin_common.c | 873 +++
- fs/reiser4/plugin/disk_format/Makefile | 5
- fs/reiser4/plugin/disk_format/disk_format.c | 38
- fs/reiser4/plugin/disk_format/disk_format.h | 27
- fs/reiser4/plugin/disk_format/disk_format40.c | 655 ++
- fs/reiser4/plugin/disk_format/disk_format40.h | 109
- fs/reiser4/plugin/fibration.c | 175
- fs/reiser4/plugin/fibration.h | 37
- fs/reiser4/plugin/file/Makefile | 7
- fs/reiser4/plugin/file/cryptcompress.c | 3775 ++++++++++++++++
- fs/reiser4/plugin/file/cryptcompress.h | 616 ++
- fs/reiser4/plugin/file/file.c | 2728 +++++++++++
- fs/reiser4/plugin/file/file.h | 331 +
- fs/reiser4/plugin/file/file_conversion.c | 689 ++
- fs/reiser4/plugin/file/symfile.c | 87
- fs/reiser4/plugin/file/symlink.c | 95
- fs/reiser4/plugin/file/tail_conversion.c | 737 +++
- fs/reiser4/plugin/file_ops.c | 205
- fs/reiser4/plugin/file_ops_readdir.c | 658 ++
- fs/reiser4/plugin/file_plugin_common.c | 1011 ++++
- fs/reiser4/plugin/hash.c | 352 +
- fs/reiser4/plugin/inode_ops.c | 906 +++
- fs/reiser4/plugin/inode_ops_rename.c | 925 +++
- fs/reiser4/plugin/item/Makefile | 18
- fs/reiser4/plugin/item/acl.h | 66
- fs/reiser4/plugin/item/blackbox.c | 142
- fs/reiser4/plugin/item/blackbox.h | 33
- fs/reiser4/plugin/item/cde.c | 1008 ++++
- fs/reiser4/plugin/item/cde.h | 87
- fs/reiser4/plugin/item/ctail.c | 1613 ++++++
- fs/reiser4/plugin/item/ctail.h | 102
- fs/reiser4/plugin/item/extent.c | 197
- fs/reiser4/plugin/item/extent.h | 231
- fs/reiser4/plugin/item/extent_file_ops.c | 1450 ++++++
- fs/reiser4/plugin/item/extent_flush_ops.c | 1028 ++++
- fs/reiser4/plugin/item/extent_item_ops.c | 889 +++
- fs/reiser4/plugin/item/internal.c | 404 +
- fs/reiser4/plugin/item/internal.h | 57
- fs/reiser4/plugin/item/item.c | 719 +++
- fs/reiser4/plugin/item/item.h | 398 +
- fs/reiser4/plugin/item/sde.c | 190
- fs/reiser4/plugin/item/sde.h | 66
- fs/reiser4/plugin/item/static_stat.c | 1107 ++++
- fs/reiser4/plugin/item/static_stat.h | 224
- fs/reiser4/plugin/item/tail.c | 807 +++
- fs/reiser4/plugin/item/tail.h | 58
- fs/reiser4/plugin/node/Makefile | 5
- fs/reiser4/plugin/node/node.c | 131
- fs/reiser4/plugin/node/node.h | 272 +
- fs/reiser4/plugin/node/node40.c | 2924 ++++++++++++
- fs/reiser4/plugin/node/node40.h | 125
- fs/reiser4/plugin/object.c | 531 ++
- fs/reiser4/plugin/object.h | 120
- fs/reiser4/plugin/plugin.c | 560 ++
- fs/reiser4/plugin/plugin.h | 942 +++
- fs/reiser4/plugin/plugin_header.h | 157
- fs/reiser4/plugin/plugin_set.c | 380 +
- fs/reiser4/plugin/plugin_set.h | 78
- fs/reiser4/plugin/security/Makefile | 4
- fs/reiser4/plugin/security/perm.c | 33
- fs/reiser4/plugin/security/perm.h | 38
- fs/reiser4/plugin/space/Makefile | 4
- fs/reiser4/plugin/space/bitmap.c | 1585 ++++++
- fs/reiser4/plugin/space/bitmap.h | 47
- fs/reiser4/plugin/space/space_allocator.h | 80
- fs/reiser4/plugin/tail_policy.c | 113
- fs/reiser4/pool.c | 231
- fs/reiser4/pool.h | 57
- fs/reiser4/readahead.c | 140
- fs/reiser4/readahead.h | 52
- fs/reiser4/reiser4.h | 270 +
- fs/reiser4/safe_link.c | 354 +
- fs/reiser4/safe_link.h | 29
- fs/reiser4/seal.c | 218
- fs/reiser4/seal.h | 49
- fs/reiser4/search.c | 1612 ++++++
- fs/reiser4/status_flags.c | 174
- fs/reiser4/status_flags.h | 47
- fs/reiser4/super.c | 306 +
- fs/reiser4/super.h | 466 +
- fs/reiser4/super_ops.c | 725 +++
- fs/reiser4/tap.c | 376 +
- fs/reiser4/tap.h | 70
- fs/reiser4/tree.c | 1878 +++++++
- fs/reiser4/tree.h | 577 ++
- fs/reiser4/tree_mod.c | 386 +
- fs/reiser4/tree_mod.h | 29
- fs/reiser4/tree_walk.c | 927 +++
- fs/reiser4/tree_walk.h | 125
- fs/reiser4/txnmgr.c | 3164 +++++++++++++
- fs/reiser4/txnmgr.h | 701 ++
- fs/reiser4/type_safe_hash.h | 320 +
- fs/reiser4/vfs_ops.c | 259 +
- fs/reiser4/vfs_ops.h | 53
- fs/reiser4/wander.c | 1797 +++++++
- fs/reiser4/wander.h | 135
- fs/reiser4/writeout.h | 21
- fs/reiser4/znode.c | 1029 ++++
- fs/reiser4/znode.h | 434 +
- 165 files changed, 77621 insertions(+)
-
-diff -puN Documentation/Changes~reiser4 Documentation/Changes
---- a/Documentation/Changes~reiser4
-+++ a/Documentation/Changes
-@@ -36,6 +36,7 @@ o module-init-tools 0.9.10
+diff -urN linux-2.6.35.orig/Documentation/Changes linux-2.6.35/Documentation/Changes
+--- linux-2.6.35.orig/Documentation/Changes 2010-08-02 00:11:14.000000000 +0200
++++ linux-2.6.35/Documentation/Changes 2010-08-04 15:44:57.000000000 +0200
+@@ -36,6 +36,7 @@
o e2fsprogs 1.41.4 # e2fsck -V
o jfsutils 1.1.3 # fsck.jfs -V
o reiserfsprogs 3.6.3 # reiserfsck -V 2>&1|grep reiserfsprogs
o xfsprogs 2.6.0 # xfs_db -V
o squashfs-tools 4.0 # mksquashfs -version
o btrfs-progs 0.18 # btrfsck
-@@ -155,6 +156,13 @@ The reiserfsprogs package should be used
+@@ -157,6 +158,13 @@
versions of mkreiserfs, resize_reiserfs, debugreiserfs and
reiserfsck. These utils work on both i386 and alpha platforms.
Xfsprogs
--------
-@@ -343,6 +351,10 @@ Reiserfsprogs
+@@ -345,6 +353,10 @@
-------------
o <http://www.namesys.com/pub/reiserfsprogs/reiserfsprogs-3.6.3.tar.gz>
Xfsprogs
--------
o <ftp://oss.sgi.com/projects/xfs/download/>
-diff -puN /dev/null Documentation/filesystems/reiser4.txt
---- /dev/null
-+++ a/Documentation/filesystems/reiser4.txt
+diff -urN linux-2.6.35.orig/Documentation/filesystems/reiser4.txt linux-2.6.35/Documentation/filesystems/reiser4.txt
+--- linux-2.6.35.orig/Documentation/filesystems/reiser4.txt 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/Documentation/filesystems/reiser4.txt 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,75 @@
+Reiser4 filesystem
+==================
+dont_load_bitmap
+ Don't load all bitmap blocks at mount time, it is useful for
+ machines with tiny RAM and large disks.
-diff -puN fs/Kconfig~reiser4 fs/Kconfig
---- a/fs/Kconfig~reiser4
-+++ a/fs/Kconfig
-@@ -28,6 +28,7 @@ config FS_MBCACHE
+diff -urN linux-2.6.35.orig/fs/fs-writeback.c linux-2.6.35/fs/fs-writeback.c
+--- linux-2.6.35.orig/fs/fs-writeback.c 2010-08-02 00:11:14.000000000 +0200
++++ linux-2.6.35/fs/fs-writeback.c 2010-08-04 20:33:23.000000000 +0200
+@@ -461,8 +461,10 @@
+ * Return 1, if the caller writeback routine should be
+ * interrupted. Otherwise return 0.
+ */
+-static int writeback_sb_inodes(struct super_block *sb, struct bdi_writeback *wb,
+- struct writeback_control *wbc, bool only_this_sb)
++int generic_writeback_sb_inodes(struct super_block *sb,
++ struct bdi_writeback *wb,
++ struct writeback_control *wbc,
++ bool only_this_sb)
+ {
+ while (!list_empty(&wb->b_io)) {
+ long pages_skipped;
+@@ -544,7 +546,10 @@
+ requeue_io(inode);
+ continue;
+ }
+- ret = writeback_sb_inodes(sb, wb, wbc, false);
++ if (sb->s_op->writeback_inodes)
++ ret = sb->s_op->writeback_inodes(sb, wb, wbc, false);
++ else
++ ret = generic_writeback_sb_inodes(sb, wb, wbc, false);
+ drop_super(sb);
+
+ if (ret)
+@@ -553,6 +558,7 @@
+ spin_unlock(&inode_lock);
+ /* Leave any unwritten inodes on b_io */
+ }
++EXPORT_SYMBOL(writeback_inodes_wb);
+
+ static void __writeback_inodes_sb(struct super_block *sb,
+ struct bdi_writeback *wb, struct writeback_control *wbc)
+@@ -563,7 +569,7 @@
+ spin_lock(&inode_lock);
+ if (!wbc->for_kupdate || list_empty(&wb->b_io))
+ queue_io(wb, wbc->older_than_this);
+- writeback_sb_inodes(sb, wb, wbc, true);
++ generic_writeback_sb_inodes(sb, wb, wbc, true);
+ spin_unlock(&inode_lock);
+ }
+
+@@ -680,6 +686,32 @@
+
+ return wrote;
+ }
++EXPORT_SYMBOL(generic_writeback_sb_inodes);
++
++/*
++ * This function is for file systems which have their
++ * own means of periodical write-out of old data.
++ * NOTE: inode_lock should be hold.
++ *
++ * Skip a portion of b_io inodes which belong to @sb
++ * and go sequentially in reverse order.
++ */
++void writeback_skip_sb_inodes(struct super_block *sb,
++ struct bdi_writeback *wb)
++{
++ while (1) {
++ struct inode *inode;
++
++ if (list_empty(&wb->b_io))
++ break;
++ inode = list_entry(wb->b_io.prev, struct inode, i_list);
++ if (sb != inode->i_sb)
++ break;
++ redirty_tail(inode);
++ }
++}
++EXPORT_SYMBOL(writeback_skip_sb_inodes);
++
+
+ /*
+ * Return the next wb_writeback_work struct that hasn't been processed yet.
+@@ -1159,3 +1191,12 @@
+ return ret;
+ }
+ EXPORT_SYMBOL(sync_inode);
++/*
++ * Local variables:
++ * c-indentation-style: "K&R"
++ * mode-name: "LC"
++ * c-basic-offset: 8
++ * tab-width: 8
++ * fill-column: 79
++ * End:
++ */
+diff -urN linux-2.6.35.orig/fs/inode.c linux-2.6.35/fs/inode.c
+--- linux-2.6.35.orig/fs/inode.c 2010-08-02 00:11:14.000000000 +0200
++++ linux-2.6.35/fs/inode.c 2010-08-04 15:44:57.000000000 +0200
+@@ -84,6 +84,7 @@
+ * the i_state of an inode while it is in use..
+ */
+ DEFINE_SPINLOCK(inode_lock);
++EXPORT_SYMBOL_GPL(inode_lock);
+
+ /*
+ * iprune_sem provides exclusion between the kswapd or try_to_free_pages
+diff -urN linux-2.6.35.orig/fs/Kconfig linux-2.6.35/fs/Kconfig
+--- linux-2.6.35.orig/fs/Kconfig 2010-08-02 00:11:14.000000000 +0200
++++ linux-2.6.35/fs/Kconfig 2010-08-04 15:44:57.000000000 +0200
+@@ -27,6 +27,7 @@
+ default y if EXT4_FS=y && EXT4_FS_XATTR
default m if EXT2_FS_XATTR || EXT3_FS_XATTR || EXT4_FS_XATTR
- source "fs/reiserfs/Kconfig"
+source "fs/reiser4/Kconfig"
+ source "fs/reiserfs/Kconfig"
source "fs/jfs/Kconfig"
- config FS_POSIX_ACL
-diff -puN fs/Makefile~reiser4 fs/Makefile
---- a/fs/Makefile~reiser4
-+++ a/fs/Makefile
-@@ -65,6 +65,7 @@ obj-$(CONFIG_DLM) += dlm/
+diff -urN linux-2.6.35.orig/fs/Makefile linux-2.6.35/fs/Makefile
+--- linux-2.6.35.orig/fs/Makefile 2010-08-02 00:11:14.000000000 +0200
++++ linux-2.6.35/fs/Makefile 2010-08-04 15:44:57.000000000 +0200
+@@ -65,6 +65,7 @@
# Do not add any filesystems before this line
obj-$(CONFIG_FSCACHE) += fscache/
obj-$(CONFIG_REISERFS_FS) += reiserfs/
obj-$(CONFIG_EXT3_FS) += ext3/ # Before ext2 so root fs can be ext3
obj-$(CONFIG_EXT2_FS) += ext2/
# We place ext4 after ext2 so plain ext2 root fs's are mounted using ext2
-diff -puN /dev/null fs/reiser4/Kconfig
---- /dev/null
-+++ a/fs/reiser4/Kconfig
-@@ -0,0 +1,34 @@
-+config REISER4_FS
-+ tristate "Reiser4 (EXPERIMENTAL)"
-+ depends on EXPERIMENTAL
-+ select ZLIB_INFLATE
-+ select ZLIB_DEFLATE
-+ select LZO_COMPRESS
-+ select LZO_DECOMPRESS
-+ select CRYPTO
-+ help
-+ Reiser4 is a filesystem that performs all filesystem operations
-+ as atomic transactions, which means that it either performs a
-+ write, or it does not, and in the event of a crash it does not
-+ partially perform it or corrupt it.
-+
-+ It stores files in dancing trees, which are like balanced trees but
-+ faster. It packs small files together so that they share blocks
-+ without wasting space. This means you can use it to store really
-+ small files. It also means that it saves you disk space. It avoids
-+ hassling you with anachronisms like having a maximum number of
-+ inodes, and wasting space if you use less than that number.
-+
-+ Reiser4 is a distinct filesystem type from reiserfs (V3).
-+ It's therefore not possible to use reiserfs file systems
-+ with reiser4.
-+
-+ To learn more about reiser4, go to http://www.namesys.com
-+
-+config REISER4_DEBUG
-+ bool "Enable reiser4 debug mode"
-+ depends on REISER4_FS
-+ help
-+ Don't use this unless you are debugging reiser4.
-+
-+ If unsure, say N.
-diff -puN /dev/null fs/reiser4/Makefile
---- /dev/null
-+++ a/fs/reiser4/Makefile
-@@ -0,0 +1,98 @@
-+#
-+# reiser4/Makefile
-+#
-+
-+obj-$(CONFIG_REISER4_FS) += reiser4.o
-+
-+reiser4-y := \
-+ debug.o \
-+ jnode.o \
-+ znode.o \
-+ key.o \
-+ pool.o \
-+ tree_mod.o \
-+ estimate.o \
-+ carry.o \
-+ carry_ops.o \
-+ lock.o \
-+ tree.o \
-+ context.o \
-+ tap.o \
-+ coord.o \
-+ block_alloc.o \
-+ txnmgr.o \
-+ kassign.o \
-+ flush.o \
-+ wander.o \
-+ eottl.o \
-+ search.o \
-+ page_cache.o \
-+ seal.o \
-+ dscale.o \
-+ flush_queue.o \
-+ ktxnmgrd.o \
-+ blocknrset.o \
-+ super.o \
-+ super_ops.o \
-+ fsdata.o \
-+ export_ops.o \
-+ oid.o \
-+ tree_walk.o \
-+ inode.o \
-+ vfs_ops.o \
-+ as_ops.o \
-+ entd.o\
-+ readahead.o \
-+ status_flags.o \
-+ init_super.o \
-+ safe_link.o \
-+ \
-+ plugin/plugin.o \
-+ plugin/plugin_set.o \
-+ plugin/node/node.o \
-+ plugin/object.o \
-+ plugin/cluster.o \
-+ plugin/inode_ops.o \
-+ plugin/inode_ops_rename.o \
-+ plugin/file_ops.o \
-+ plugin/file_ops_readdir.o \
-+ plugin/file_plugin_common.o \
-+ plugin/file/file.o \
-+ plugin/file/tail_conversion.o \
-+ plugin/file/file_conversion.o \
-+ plugin/file/symlink.o \
-+ plugin/file/cryptcompress.o \
-+ plugin/dir_plugin_common.o \
-+ plugin/dir/hashed_dir.o \
-+ plugin/dir/seekable_dir.o \
-+ plugin/node/node40.o \
-+ \
-+ plugin/crypto/cipher.o \
-+ plugin/crypto/digest.o \
-+ \
-+ plugin/compress/compress.o \
-+ plugin/compress/compress_mode.o \
-+ \
-+ plugin/item/static_stat.o \
-+ plugin/item/sde.o \
-+ plugin/item/cde.o \
-+ plugin/item/blackbox.o \
-+ plugin/item/internal.o \
-+ plugin/item/tail.o \
-+ plugin/item/ctail.o \
-+ plugin/item/extent.o \
-+ plugin/item/extent_item_ops.o \
-+ plugin/item/extent_file_ops.o \
-+ plugin/item/extent_flush_ops.o \
-+ \
-+ plugin/hash.o \
-+ plugin/fibration.o \
-+ plugin/tail_policy.o \
-+ plugin/item/item.o \
-+ \
-+ plugin/security/perm.o \
-+ plugin/space/bitmap.o \
-+ \
-+ plugin/disk_format/disk_format40.o \
-+ plugin/disk_format/disk_format.o
-+
-diff -puN /dev/null fs/reiser4/README
---- /dev/null
-+++ a/fs/reiser4/README
-@@ -0,0 +1,128 @@
-+[LICENSING]
-+
-+Reiser4 is hereby licensed under the GNU General
-+Public License version 2.
-+
-+Source code files that contain the phrase "licensing governed by
-+reiser4/README" are "governed files" throughout this file. Governed
-+files are licensed under the GPL. The portions of them owned by Hans
-+Reiser, or authorized to be licensed by him, have been in the past,
-+and likely will be in the future, licensed to other parties under
-+other licenses. If you add your code to governed files, and don't
-+want it to be owned by Hans Reiser, put your copyright label on that
-+code so the poor blight and his customers can keep things straight.
-+All portions of governed files not labeled otherwise are owned by Hans
-+Reiser, and by adding your code to it, widely distributing it to
-+others or sending us a patch, and leaving the sentence in stating that
-+licensing is governed by the statement in this file, you accept this.
-+It will be a kindness if you identify whether Hans Reiser is allowed
-+to license code labeled as owned by you on your behalf other than
-+under the GPL, because he wants to know if it is okay to do so and put
-+a check in the mail to you (for non-trivial improvements) when he
-+makes his next sale. He makes no guarantees as to the amount if any,
-+though he feels motivated to motivate contributors, and you can surely
-+discuss this with him before or after contributing. You have the
-+right to decline to allow him to license your code contribution other
-+than under the GPL.
-+
-+Further licensing options are available for commercial and/or other
-+interests directly from Hans Reiser: reiser@namesys.com. If you interpret
-+the GPL as not allowing those additional licensing options, you read
-+it wrongly, and Richard Stallman agrees with me, when carefully read
-+you can see that those restrictions on additional terms do not apply
-+to the owner of the copyright, and my interpretation of this shall
-+govern for this license.
-+
-+[END LICENSING]
-+
-+Reiser4 is a file system based on dancing tree algorithms, and is
-+described at http://www.namesys.com
-+
-+mkfs.reiser4 and other utilities are on our webpage or wherever your
-+Linux provider put them. You really want to be running the latest
-+version off the website if you use fsck.
-+
-+Yes, if you update your reiser4 kernel module you do have to
-+recompile your kernel, most of the time. The errors you get will be
-+quite cryptic if your forget to do so.
-+
-+Hideous Commercial Pitch: Spread your development costs across other OS
-+vendors. Select from the best in the world, not the best in your
-+building, by buying from third party OS component suppliers. Leverage
-+the software component development power of the internet. Be the most
-+aggressive in taking advantage of the commercial possibilities of
-+decentralized internet development, and add value through your branded
-+integration that you sell as an operating system. Let your competitors
-+be the ones to compete against the entire internet by themselves. Be
-+hip, get with the new economic trend, before your competitors do. Send
-+email to reiser@namesys.com
-+
-+Hans Reiser was the primary architect of Reiser4, but a whole team
-+chipped their ideas in. He invested everything he had into Namesys
-+for 5.5 dark years of no money before Reiser3 finally started to work well
-+enough to bring in money. He owns the copyright.
-+
-+DARPA was the primary sponsor of Reiser4. DARPA does not endorse
-+Reiser4, it merely sponsors it. DARPA is, in solely Hans's personal
-+opinion, unique in its willingness to invest into things more
-+theoretical than the VC community can readily understand, and more
-+longterm than allows them to be sure that they will be the ones to
-+extract the economic benefits from. DARPA also integrated us into a
-+security community that transformed our security worldview.
-+
-+Vladimir Saveliev is our lead programmer, with us from the beginning,
-+and he worked long hours writing the cleanest code. This is why he is
-+now the lead programmer after years of commitment to our work. He
-+always made the effort to be the best he could be, and to make his
-+code the best that it could be. What resulted was quite remarkable. I
-+don't think that money can ever motivate someone to work the way he
-+did, he is one of the most selfless men I know.
-+
-+Alexander Lyamin was our sysadmin, and helped to educate us in
-+security issues. Moscow State University and IMT were very generous
-+in the internet access they provided us, and in lots of other little
-+ways that a generous institution can be.
-+
-+Alexander Zarochentcev (sometimes known as zam, or sasha), wrote the
-+locking code, the block allocator, and finished the flushing code.
-+His code is always crystal clean and well structured.
-+
-+Nikita Danilov wrote the core of the balancing code, the core of the
-+plugins code, and the directory code. He worked a steady pace of long
-+hours that produced a whole lot of well abstracted code. He is our
-+senior computer scientist.
-+
-+Vladimir Demidov wrote the parser. Writing an in kernel parser is
-+something very few persons have the skills for, and it is thanks to
-+him that we can say that the parser is really not so big compared to
-+various bits of our other code, and making a parser work in the kernel
-+was not so complicated as everyone would imagine mainly because it was
-+him doing it...
-+
-+Joshua McDonald wrote the transaction manager, and the flush code.
-+The flush code unexpectedly turned out be extremely hairy for reasons
-+you can read about on our web page, and he did a great job on an
-+extremely difficult task.
-+
-+Nina Reiser handled our accounting, government relations, and much
-+more.
-+
-+Ramon Reiser developed our website.
-+
-+Beverly Palmer drew our graphics.
-+
-+Vitaly Fertman developed librepair, userspace plugins repair code, fsck
-+and worked with Umka on developing libreiser4 and userspace plugins.
-+
-+Yury Umanets (aka Umka) developed libreiser4, userspace plugins and
-+userspace tools (reiser4progs).
-+
-+Oleg Drokin (aka Green) is the release manager who fixes everything.
-+It is so nice to have someone like that on the team. He (plus Chris
-+and Jeff) make it possible for the entire rest of the Namesys team to
-+focus on Reiser4, and he fixed a whole lot of Reiser4 bugs also. It
-+is just amazing to watch his talent for spotting bugs in action.
-+
-+Edward Shishkin wrote cryptcompress file plugin (which manages files
-+built of encrypted and(or) compressed bodies) and other plugins related
-+to transparent encryption and compression support.
-diff -puN /dev/null fs/reiser4/as_ops.c
---- /dev/null
-+++ a/fs/reiser4/as_ops.c
-@@ -0,0 +1,376 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/as_ops.c linux-2.6.35/fs/reiser4/as_ops.c
+--- linux-2.6.35.orig/fs/reiser4/as_ops.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/as_ops.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,337 @@
+/* Copyright 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+/* Interface to VFS. Reiser4 address_space_operations are defined here. */
+ assert("vs-1734", (page->mapping &&
+ page->mapping->host &&
+ reiser4_get_super_fake(page->mapping->host->i_sb) !=
-+ page->mapping->host
-+ && reiser4_get_cc_fake(page->mapping->host->i_sb) !=
-+ page->mapping->host
-+ && reiser4_get_bitmap_fake(page->mapping->host->i_sb) !=
++ page->mapping->host &&
++ reiser4_get_cc_fake(page->mapping->host->i_sb) !=
++ page->mapping->host &&
++ reiser4_get_bitmap_fake(page->mapping->host->i_sb) !=
+ page->mapping->host));
-+
-+ if (!TestSetPageDirty(page)) {
-+ struct address_space *mapping = page->mapping;
-+
-+ if (mapping) {
-+ spin_lock_irq(&mapping->tree_lock);
-+
-+ /* check for race with truncate */
-+ if (page->mapping) {
-+ assert("vs-1652", page->mapping == mapping);
-+ if (mapping_cap_account_dirty(mapping))
-+ inc_zone_page_state(page,
-+ NR_FILE_DIRTY);
-+ radix_tree_tag_set(&mapping->page_tree,
-+ page->index,
-+ PAGECACHE_TAG_REISER4_MOVED);
-+ }
-+ spin_unlock_irq(&mapping->tree_lock);
-+ __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
-+ }
-+ }
-+ return 0;
++ return __set_page_dirty_nobuffers(page);
+}
+
+/* ->invalidatepage method for reiser4 */
+ return inode_file_plugin(mapping->host)->writepages(mapping, wbc);
+}
+
-+int reiser4_prepare_write(struct file *file, struct page *page,
-+ unsigned from, unsigned to)
-+{
-+ return inode_file_plugin(file->f_dentry->d_inode)->prepare_write(file,
-+ page,
-+ from,
-+ to);
-+}
-+
-+int reiser4_commit_write(struct file *file, struct page *page,
-+ unsigned from, unsigned to)
-+{
-+ return inode_file_plugin(file->f_dentry->d_inode)->commit_write(file,
-+ page,
-+ from,
-+ to);
-+}
-+
+/* Make Linus happy.
+ Local variables:
+ c-indentation-style: "K&R"
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/block_alloc.c
---- /dev/null
-+++ a/fs/reiser4/block_alloc.c
+diff -urN linux-2.6.35.orig/fs/reiser4/block_alloc.c linux-2.6.35/fs/reiser4/block_alloc.c
+--- linux-2.6.35.orig/fs/reiser4/block_alloc.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/block_alloc.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,1142 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/block_alloc.h
---- /dev/null
-+++ a/fs/reiser4/block_alloc.h
+diff -urN linux-2.6.35.orig/fs/reiser4/block_alloc.h linux-2.6.35/fs/reiser4/block_alloc.h
+--- linux-2.6.35.orig/fs/reiser4/block_alloc.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/block_alloc.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,177 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/blocknrset.c
---- /dev/null
-+++ a/fs/reiser4/blocknrset.c
+diff -urN linux-2.6.35.orig/fs/reiser4/blocknrset.c linux-2.6.35/fs/reiser4/blocknrset.c
+--- linux-2.6.35.orig/fs/reiser4/blocknrset.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/blocknrset.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,371 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+reiser4/README */
+ * scroll-step: 1
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/carry.c
---- /dev/null
-+++ a/fs/reiser4/carry.c
+diff -urN linux-2.6.35.orig/fs/reiser4/carry.c linux-2.6.35/fs/reiser4/carry.c
+--- linux-2.6.35.orig/fs/reiser4/carry.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/carry.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,1398 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+ *
+ * This function itself only manages changes in carry structures and delegates
+ * all hard work (allocation of znode for new root, changes of parent and
-+ * sibling pointers to the reiser4_add_tree_root().
++ * sibling pointers) to the reiser4_add_tree_root().
+ *
+ * Locking: old tree root is locked by carry at this point. Fake znode is also
+ * locked.
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/carry.h
---- /dev/null
-+++ a/fs/reiser4/carry.h
+diff -urN linux-2.6.35.orig/fs/reiser4/carry.h linux-2.6.35/fs/reiser4/carry.h
+--- linux-2.6.35.orig/fs/reiser4/carry.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/carry.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,445 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/carry_ops.c
---- /dev/null
-+++ a/fs/reiser4/carry_ops.c
+diff -urN linux-2.6.35.orig/fs/reiser4/carry_ops.c linux-2.6.35/fs/reiser4/carry_ops.c
+--- linux-2.6.35.orig/fs/reiser4/carry_ops.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/carry_ops.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,2132 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+ left->free = 1;
+
+ flags = GN_TRY_LOCK;
-+ if (!op->u.insert.flags & COPI_LOAD_LEFT)
++ if (!(op->u.insert.flags & COPI_LOAD_LEFT))
+ flags |= GN_NO_ALLOC;
+
+ /* then, feeling lucky, peek left neighbor in the cache. */
+ read_unlock_tree(tree);
+
+ flags = GN_CAN_USE_UPPER_LEVELS;
-+ if (!op->u.insert.flags & COPI_LOAD_RIGHT)
++ if (!(op->u.insert.flags & COPI_LOAD_RIGHT))
+ flags = GN_NO_ALLOC;
+
+ /* then, try to lock right neighbor */
+ int bytes;
+
+ bytes = capped_height() * (0 + /* bnode should be added, but
-+ * its is private to bitmap.c,
++ * it is private to bitmap.c,
+ * skip for now. */
+ 2 * sizeof(jnode));
+ /* working and commit jnodes */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/carry_ops.h
---- /dev/null
-+++ a/fs/reiser4/carry_ops.h
+diff -urN linux-2.6.35.orig/fs/reiser4/carry_ops.h linux-2.6.35/fs/reiser4/carry_ops.h
+--- linux-2.6.35.orig/fs/reiser4/carry_ops.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/carry_ops.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,43 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/context.c
---- /dev/null
-+++ a/fs/reiser4/context.c
+diff -urN linux-2.6.35.orig/fs/reiser4/context.c linux-2.6.35/fs/reiser4/context.c
+--- linux-2.6.35.orig/fs/reiser4/context.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/context.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,289 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+#include "debug.h"
+#include "super.h"
+#include "context.h"
++#include "vfs_ops.h" /* for reiser4_throttle_write() */
+
-+#include <linux/writeback.h> /* balance_dirty_pages() */
++#include <linux/writeback.h> /* for current_is_pdflush() */
+#include <linux/hardirq.h>
+
+static void _reiser4_init_context(reiser4_context * context,
+ * because some important lock (like ->i_mutex on the parent directory) is
+ * held. To achieve this, ->nobalance flag can be set in the current context.
+ */
-+static void balance_dirty_pages_at(reiser4_context *context)
++static void reiser4_throttle_write_at(reiser4_context *context)
+{
+ reiser4_super_info_data *sbinfo = get_super_private(context->super);
+
+ if (sbinfo != NULL && sbinfo->fake != NULL &&
+ context->nr_marked_dirty != 0 &&
+ !(current->flags & PF_MEMALLOC) &&
-+ !current_is_pdflush())
-+ balance_dirty_pages_ratelimited(sbinfo->fake->i_mapping);
++ !current_is_flush_bd_task())
++ /* FIXME-EDWARD: throttle with nr_marked_dirty? */
++ reiser4_throttle_write(sbinfo->fake, 1);
+}
+
+/* release resources associated with context.
+ assert("nikita-3021", reiser4_schedulable());
+
+ if (context->nr_children == 0) {
-+ if (!context->nobalance) {
-+ reiser4_txn_restart(context);
-+ balance_dirty_pages_at(context);
-+ }
++ if (!context->nobalance)
++ reiser4_throttle_write_at(context);
+
+ /* if filesystem is mounted with -o sync or -o dirsync - commit
+ transaction. FIXME: TXNH_DONT_COMMIT is used to avoid
+ * scroll-step: 1
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/context.h
---- /dev/null
-+++ a/fs/reiser4/context.h
+diff -urN linux-2.6.35.orig/fs/reiser4/context.h linux-2.6.35/fs/reiser4/context.h
+--- linux-2.6.35.orig/fs/reiser4/context.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/context.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,228 @@
+/* Copyright 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ /* count non-trivial jnode_set_dirty() calls */
+ unsigned long nr_marked_dirty;
+
-+ /* reiser4_sync_inodes calls (via generic_sync_sb_inodes)
++ /* reiser4_writeback_inodes calls (via generic_writeback_sb_inodes)
+ * reiser4_writepages for each of dirty inodes. Reiser4_writepages
+ * captures pages. When number of pages captured in one
+ * reiser4_sync_inodes reaches some threshold - some atoms get
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/coord.c
---- /dev/null
-+++ a/fs/reiser4/coord.c
+diff -urN linux-2.6.35.orig/fs/reiser4/coord.c linux-2.6.35/fs/reiser4/coord.c
+--- linux-2.6.35.orig/fs/reiser4/coord.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/coord.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,928 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+
+ coord_clear_iplug(coord);
+
-+ if (node_is_empty(node))
++ if (node_is_empty(node)) {
+ coord_init_first_unit(coord, node);
-+ else if ((coord->between == AFTER_ITEM)
-+ || (coord->between == AFTER_UNIT))
++ } else if ((coord->between == AFTER_ITEM)
++ || (coord->between == AFTER_UNIT)) {
+ return;
-+ else if (coord->item_pos == coord_num_items(coord)
++ } else if (coord->item_pos == coord_num_items(coord)
+ && coord->between == BEFORE_ITEM) {
+ coord_dec_item_pos(coord);
+ coord->between = AFTER_ITEM;
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/coord.h
---- /dev/null
-+++ a/fs/reiser4/coord.h
+diff -urN linux-2.6.35.orig/fs/reiser4/coord.h linux-2.6.35/fs/reiser4/coord.h
+--- linux-2.6.35.orig/fs/reiser4/coord.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/coord.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,399 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/debug.c
---- /dev/null
-+++ a/fs/reiser4/debug.c
+diff -urN linux-2.6.35.orig/fs/reiser4/debug.c linux-2.6.35/fs/reiser4/debug.c
+--- linux-2.6.35.orig/fs/reiser4/debug.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/debug.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,308 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/debug.h
---- /dev/null
-+++ a/fs/reiser4/debug.h
+diff -urN linux-2.6.35.orig/fs/reiser4/debug.h linux-2.6.35/fs/reiser4/debug.h
+--- linux-2.6.35.orig/fs/reiser4/debug.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/debug.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,351 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+#define DCALL(lev, fun, reperr, label, format, ...) \
+({ \
+ fun(lev "reiser4[%.16s(%i)]: %s (%s:%i)[%s]:\n" format "\n" , \
-+ current->comm, task_pid_nr(current), __FUNCTION__, \
++ current->comm, current->pid, __FUNCTION__, \
+ __FILE__, __LINE__, label, ## __VA_ARGS__); \
+})
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/dformat.h
---- /dev/null
-+++ a/fs/reiser4/dformat.h
+diff -urN linux-2.6.35.orig/fs/reiser4/dformat.h linux-2.6.35/fs/reiser4/dformat.h
+--- linux-2.6.35.orig/fs/reiser4/dformat.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/dformat.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,71 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+ * fill-column: 79
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/dscale.c
---- /dev/null
-+++ a/fs/reiser4/dscale.c
+diff -urN linux-2.6.35.orig/fs/reiser4/dscale.c linux-2.6.35/fs/reiser4/dscale.c
+--- linux-2.6.35.orig/fs/reiser4/dscale.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/dscale.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,192 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/dscale.h
---- /dev/null
-+++ a/fs/reiser4/dscale.h
+diff -urN linux-2.6.35.orig/fs/reiser4/dscale.h linux-2.6.35/fs/reiser4/dscale.h
+--- linux-2.6.35.orig/fs/reiser4/dscale.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/dscale.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,28 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/entd.c
---- /dev/null
-+++ a/fs/reiser4/entd.c
-@@ -0,0 +1,335 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/entd.c linux-2.6.35/fs/reiser4/entd.c
+--- linux-2.6.35.orig/fs/reiser4/entd.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/entd.c 2010-08-04 16:58:38.000000000 +0200
+@@ -0,0 +1,337 @@
+/* Copyright 2003, 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+ rq->wbc->range_end = rq->wbc->range_start +
+ (ENTD_CAPTURE_APAGE_BURST << PAGE_CACHE_SHIFT);
+ tmp = rq->wbc->nr_to_write;
++
+ rq->mapping->a_ops->writepages(rq->mapping, rq->wbc);
+
+ if (rq->wbc->nr_to_write > 0) {
+ rq->wbc->range_start = 0;
+ rq->wbc->range_end = LLONG_MAX;
-+ generic_sync_sb_inodes(super, rq->wbc);
++ writeback_inodes_wb(&rq->mapping->backing_dev_info->wb,
++ rq->wbc);
+ }
+ rq->wbc->nr_to_write = ENTD_CAPTURE_APAGE_BURST;
-+ reiser4_writeout(super, rq->wbc);
+
++ reiser4_writeout(super, rq->wbc);
+ context_set_commit_async(&ctx);
+ reiser4_exit_context(&ctx);
+}
+ * page. Re-dirty page before unlocking so that if ent thread fails to
+ * write it - it will remain dirty
+ */
-+ reiser4_set_page_dirty_internal(page);
++ set_page_dirty_notag(page);
+
+ /*
+ * pin inode in memory, unlock page, entd_flush will iput. We can not
+ * fill-column: 79
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/entd.h
---- /dev/null
-+++ a/fs/reiser4/entd.h
+diff -urN linux-2.6.35.orig/fs/reiser4/entd.h linux-2.6.35/fs/reiser4/entd.h
+--- linux-2.6.35.orig/fs/reiser4/entd.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/entd.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,90 @@
+/* Copyright 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/eottl.c
---- /dev/null
-+++ a/fs/reiser4/eottl.c
+diff -urN linux-2.6.35.orig/fs/reiser4/eottl.c linux-2.6.35/fs/reiser4/eottl.c
+--- linux-2.6.35.orig/fs/reiser4/eottl.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/eottl.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,510 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+ * scroll-step: 1
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/estimate.c
---- /dev/null
-+++ a/fs/reiser4/estimate.c
+diff -urN linux-2.6.35.orig/fs/reiser4/estimate.c linux-2.6.35/fs/reiser4/estimate.c
+--- linux-2.6.35.orig/fs/reiser4/estimate.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/estimate.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,129 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/export_ops.c
---- /dev/null
-+++ a/fs/reiser4/export_ops.c
+diff -urN linux-2.6.35.orig/fs/reiser4/export_ops.c linux-2.6.35/fs/reiser4/export_ops.c
+--- linux-2.6.35.orig/fs/reiser4/export_ops.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/export_ops.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,328 @@
+/* Copyright 2005 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ * fill-column: 79
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/flush.c
---- /dev/null
-+++ a/fs/reiser4/flush.c
+diff -urN linux-2.6.35.orig/fs/reiser4/flush.c linux-2.6.35/fs/reiser4/flush.c
+--- linux-2.6.35.orig/fs/reiser4/flush.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/flush.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,3703 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+ LocalWords: preceder
+ End:
+*/
-diff -puN /dev/null fs/reiser4/flush.h
---- /dev/null
-+++ a/fs/reiser4/flush.h
+diff -urN linux-2.6.35.orig/fs/reiser4/flush.h linux-2.6.35/fs/reiser4/flush.h
+--- linux-2.6.35.orig/fs/reiser4/flush.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/flush.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,300 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ LocalWords: preceder
+ End:
+*/
-diff -puN /dev/null fs/reiser4/flush_queue.c
---- /dev/null
-+++ a/fs/reiser4/flush_queue.c
+diff -urN linux-2.6.35.orig/fs/reiser4/flush_queue.c linux-2.6.35/fs/reiser4/flush_queue.c
+--- linux-2.6.35.orig/fs/reiser4/flush_queue.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/flush_queue.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,678 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+ * scroll-step: 1
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/forward.h
---- /dev/null
-+++ a/fs/reiser4/forward.h
+diff -urN linux-2.6.35.orig/fs/reiser4/forward.h linux-2.6.35/fs/reiser4/forward.h
+--- linux-2.6.35.orig/fs/reiser4/forward.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/forward.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,256 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+ RIGHT_SIDE
+} sideof;
+
-+#define round_up(value, order) \
++#define reiser4_round_up(value, order) \
+ ((typeof(value))(((long) (value) + (order) - 1U) & \
-+ ~((order) - 1)))
++ ~((order) - 1)))
+
+/* values returned by squalloc_right_neighbor and its auxiliary functions */
+typedef enum {
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/fsdata.c
---- /dev/null
-+++ a/fs/reiser4/fsdata.c
+diff -urN linux-2.6.35.orig/fs/reiser4/fsdata.c linux-2.6.35/fs/reiser4/fsdata.c
+--- linux-2.6.35.orig/fs/reiser4/fsdata.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/fsdata.c 2010-08-04 20:21:08.000000000 +0200
@@ -0,0 +1,804 @@
+/* Copyright 2001, 2002, 2003, 2004, 2005 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ * Shrinks d_cursor_cache. Scan LRU list of unused cursors, freeing requested
+ * number. Return number of still freeable cursors.
+ */
-+static int d_cursor_shrink(int nr, gfp_t mask)
++static int d_cursor_shrink(struct shrinker *shrink, int nr, gfp_t mask)
+{
+ if (nr != 0) {
+ dir_cursor *scan;
+ * fill-column: 79
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/fsdata.h
---- /dev/null
-+++ a/fs/reiser4/fsdata.h
+diff -urN linux-2.6.35.orig/fs/reiser4/fsdata.h linux-2.6.35/fs/reiser4/fsdata.h
+--- linux-2.6.35.orig/fs/reiser4/fsdata.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/fsdata.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,205 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ * fill-column: 120
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/init_super.c
---- /dev/null
-+++ a/fs/reiser4/init_super.c
-@@ -0,0 +1,751 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/init_super.c linux-2.6.35/fs/reiser4/init_super.c
+--- linux-2.6.35.orig/fs/reiser4/init_super.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/init_super.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,761 @@
+/* Copyright by Hans Reiser, 2003 */
+
+#include "super.h"
+
+#define MAX_NR_OPTIONS (30)
+
-+/**
-+ * reiser4_init_super_data - initialize reiser4 private super block
-+ * @super: super block to initialize
-+ * @opt_string: list of reiser4 mount options
-+ *
-+ * Sets various reiser4 parameters to default values. Parses mount options and
-+ * overwrites default settings.
-+ */
-+int reiser4_init_super_data(struct super_block *super, char *opt_string)
-+{
-+ int result;
-+ struct opt_desc *opts, *p;
-+ reiser4_super_info_data *sbinfo = get_super_private(super);
-+
-+ /* initialize super, export, dentry operations */
-+ sbinfo->ops.super = reiser4_super_operations;
-+ sbinfo->ops.export = reiser4_export_operations;
-+ sbinfo->ops.dentry = reiser4_dentry_operations;
-+ super->s_op = &sbinfo->ops.super;
-+ super->s_export_op = &sbinfo->ops.export;
-+
-+ /* initialize transaction manager parameters to default values */
-+ sbinfo->tmgr.atom_max_size = totalram_pages / 4;
-+ sbinfo->tmgr.atom_max_age = REISER4_ATOM_MAX_AGE / HZ;
-+ sbinfo->tmgr.atom_min_size = 256;
-+ sbinfo->tmgr.atom_max_flushers = ATOM_MAX_FLUSHERS;
-+
-+ /* initialize cbk cache parameter */
-+ sbinfo->tree.cbk_cache.nr_slots = CBK_CACHE_SLOTS;
-+
-+ /* initialize flush parameters */
-+ sbinfo->flush.relocate_threshold = FLUSH_RELOCATE_THRESHOLD;
-+ sbinfo->flush.relocate_distance = FLUSH_RELOCATE_DISTANCE;
-+ sbinfo->flush.written_threshold = FLUSH_WRITTEN_THRESHOLD;
-+ sbinfo->flush.scan_maxnodes = FLUSH_SCAN_MAXNODES;
-+
-+ sbinfo->optimal_io_size = REISER4_OPTIMAL_IO_SIZE;
-+
-+ /* preliminary tree initializations */
-+ sbinfo->tree.super = super;
-+ sbinfo->tree.carry.new_node_flags = REISER4_NEW_NODE_FLAGS;
-+ sbinfo->tree.carry.new_extent_flags = REISER4_NEW_EXTENT_FLAGS;
-+ sbinfo->tree.carry.paste_flags = REISER4_PASTE_FLAGS;
-+ sbinfo->tree.carry.insert_flags = REISER4_INSERT_FLAGS;
-+ rwlock_init(&(sbinfo->tree.tree_lock));
-+ spin_lock_init(&(sbinfo->tree.epoch_lock));
-+
-+ /* initialize default readahead params */
-+ sbinfo->ra_params.max = num_physpages / 4;
-+ sbinfo->ra_params.flags = 0;
-+
-+ /* allocate memory for structure describing reiser4 mount options */
-+ opts = kmalloc(sizeof(struct opt_desc) * MAX_NR_OPTIONS,
-+ reiser4_ctx_gfp_mask_get());
-+ if (opts == NULL)
-+ return RETERR(-ENOMEM);
-+
-+ /* initialize structure describing reiser4 mount options */
-+ p = opts;
-+
+#if REISER4_DEBUG
-+# define OPT_ARRAY_CHECK if ((p) > (opts) + MAX_NR_OPTIONS) { \
++# define OPT_ARRAY_CHECK(opt, array) \
++ if ((opt) > (array) + MAX_NR_OPTIONS) { \
+ warning("zam-1046", "opt array is overloaded"); break; \
+ }
+#else
-+# define OPT_ARRAY_CHECK noop
++# define OPT_ARRAY_CHECK(opt, array) noop
+#endif
+
-+#define PUSH_OPT(...) \
++#define PUSH_OPT(opt, array, ...) \
+do { \
+ struct opt_desc o = __VA_ARGS__; \
-+ OPT_ARRAY_CHECK; \
-+ *p ++ = o; \
++ OPT_ARRAY_CHECK(opt, array); \
++ *(opt) ++ = o; \
+} while (0)
+
-+#define PUSH_SB_FIELD_OPT(field, format) PUSH_OPT(SB_FIELD_OPT(field, format))
-+#define PUSH_BIT_OPT(name, bit) PUSH_OPT(BIT_OPT(name, bit))
-+
++static noinline void push_sb_field_opts(struct opt_desc **p,
++ struct opt_desc *opts,
++ reiser4_super_info_data *sbinfo)
++{
++#define PUSH_SB_FIELD_OPT(field, format) \
++ PUSH_OPT(*p, opts, SB_FIELD_OPT(field, format))
+ /*
+ * tmgr.atom_max_size=N
+ * Atoms containing more than N blocks will be forced to commit. N is
+ */
+ PUSH_SB_FIELD_OPT(altsuper, "%lu");
+#endif
++}
++
++/**
++ * reiser4_init_super_data - initialize reiser4 private super block
++ * @super: super block to initialize
++ * @opt_string: list of reiser4 mount options
++ *
++ * Sets various reiser4 parameters to default values. Parses mount options and
++ * overwrites default settings.
++ */
++int reiser4_init_super_data(struct super_block *super, char *opt_string)
++{
++ int result;
++ struct opt_desc *opts, *p;
++ reiser4_super_info_data *sbinfo = get_super_private(super);
++
++ /* initialize super, export, dentry operations */
++ sbinfo->ops.super = reiser4_super_operations;
++ sbinfo->ops.export = reiser4_export_operations;
++ sbinfo->ops.dentry = reiser4_dentry_operations;
++ super->s_op = &sbinfo->ops.super;
++ super->s_export_op = &sbinfo->ops.export;
++
++ /* initialize transaction manager parameters to default values */
++ sbinfo->tmgr.atom_max_size = totalram_pages / 4;
++ sbinfo->tmgr.atom_max_age = REISER4_ATOM_MAX_AGE / HZ;
++ sbinfo->tmgr.atom_min_size = 256;
++ sbinfo->tmgr.atom_max_flushers = ATOM_MAX_FLUSHERS;
++
++ /* initialize cbk cache parameter */
++ sbinfo->tree.cbk_cache.nr_slots = CBK_CACHE_SLOTS;
++
++ /* initialize flush parameters */
++ sbinfo->flush.relocate_threshold = FLUSH_RELOCATE_THRESHOLD;
++ sbinfo->flush.relocate_distance = FLUSH_RELOCATE_DISTANCE;
++ sbinfo->flush.written_threshold = FLUSH_WRITTEN_THRESHOLD;
++ sbinfo->flush.scan_maxnodes = FLUSH_SCAN_MAXNODES;
++
++ sbinfo->optimal_io_size = REISER4_OPTIMAL_IO_SIZE;
++
++ /* preliminary tree initializations */
++ sbinfo->tree.super = super;
++ sbinfo->tree.carry.new_node_flags = REISER4_NEW_NODE_FLAGS;
++ sbinfo->tree.carry.new_extent_flags = REISER4_NEW_EXTENT_FLAGS;
++ sbinfo->tree.carry.paste_flags = REISER4_PASTE_FLAGS;
++ sbinfo->tree.carry.insert_flags = REISER4_INSERT_FLAGS;
++ rwlock_init(&(sbinfo->tree.tree_lock));
++ spin_lock_init(&(sbinfo->tree.epoch_lock));
++
++ /* initialize default readahead params */
++ sbinfo->ra_params.max = num_physpages / 4;
++ sbinfo->ra_params.flags = 0;
++
++ /* allocate memory for structure describing reiser4 mount options */
++ opts = kmalloc(sizeof(struct opt_desc) * MAX_NR_OPTIONS,
++ reiser4_ctx_gfp_mask_get());
++ if (opts == NULL)
++ return RETERR(-ENOMEM);
+
++ /* initialize structure describing reiser4 mount options */
++ p = opts;
++
++ push_sb_field_opts(&p, opts, sbinfo);
+ /* turn on BSD-style gid assignment */
++
++#define PUSH_BIT_OPT(name, bit) \
++ PUSH_OPT(p, opts, BIT_OPT(name, bit))
++
+ PUSH_BIT_OPT("bsdgroups", REISER4_BSD_GID);
+ /* turn on 32 bit times */
+ PUSH_BIT_OPT("32bittimes", REISER4_32_BIT_TIMES);
+ /* disable use of write barriers in the reiser4 log writer. */
+ PUSH_BIT_OPT("no_write_barrier", REISER4_NO_WRITE_BARRIER);
+
-+ PUSH_OPT(
++ PUSH_OPT(p, opts,
+ {
+ /*
+ * tree traversal readahead parameters:
+ );
+
+ /* What to do in case of fs error */
-+ PUSH_OPT(
++ PUSH_OPT(p, opts,
+ {
+ .name = "onerror",
+ .type = OPT_ONEOF,
+ * fill-column: 79
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/inode.c
---- /dev/null
-+++ a/fs/reiser4/inode.c
+diff -urN linux-2.6.35.orig/fs/reiser4/inode.c linux-2.6.35/fs/reiser4/inode.c
+--- linux-2.6.35.orig/fs/reiser4/inode.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/inode.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,711 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/inode.h
---- /dev/null
-+++ a/fs/reiser4/inode.h
+diff -urN linux-2.6.35.orig/fs/reiser4/inode.h linux-2.6.35/fs/reiser4/inode.h
+--- linux-2.6.35.orig/fs/reiser4/inode.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/inode.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,453 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/ioctl.h
---- /dev/null
-+++ a/fs/reiser4/ioctl.h
+diff -urN linux-2.6.35.orig/fs/reiser4/ioctl.h linux-2.6.35/fs/reiser4/ioctl.h
+--- linux-2.6.35.orig/fs/reiser4/ioctl.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/ioctl.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,41 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/jnode.c
---- /dev/null
-+++ a/fs/reiser4/jnode.c
+diff -urN linux-2.6.35.orig/fs/reiser4/jnode.c linux-2.6.35/fs/reiser4/jnode.c
+--- linux-2.6.35.orig/fs/reiser4/jnode.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/jnode.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,1923 @@
+/* Copyright 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+static int jnode_try_drop(jnode * node);
+
+#if REISER4_DEBUG
-+static int jnode_invariant(const jnode * node, int tlocked, int jlocked);
++static int jnode_invariant(jnode * node, int tlocked, int jlocked);
+#endif
+
+/* true if valid page is attached to jnode */
+}
+
+/* debugging aid: check znode invariant and panic if it doesn't hold */
-+static int jnode_invariant(const jnode * node, int tlocked, int jlocked)
++static int jnode_invariant(jnode * node, int tlocked, int jlocked)
+{
+ char const *failed_msg;
+ int result;
+ fill-column: 80
+ End:
+*/
-diff -puN /dev/null fs/reiser4/jnode.h
---- /dev/null
-+++ a/fs/reiser4/jnode.h
+diff -urN linux-2.6.35.orig/fs/reiser4/jnode.h linux-2.6.35/fs/reiser4/jnode.h
+--- linux-2.6.35.orig/fs/reiser4/jnode.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/jnode.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,704 @@
+/* Copyright 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/kassign.c
---- /dev/null
-+++ a/fs/reiser4/kassign.c
+diff -urN linux-2.6.35.orig/fs/reiser4/kassign.c linux-2.6.35/fs/reiser4/kassign.c
+--- linux-2.6.35.orig/fs/reiser4/kassign.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/kassign.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,677 @@
+/* Copyright 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/kassign.h
---- /dev/null
-+++ a/fs/reiser4/kassign.h
+diff -urN linux-2.6.35.orig/fs/reiser4/kassign.h linux-2.6.35/fs/reiser4/kassign.h
+--- linux-2.6.35.orig/fs/reiser4/kassign.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/kassign.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,111 @@
+/* Copyright 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/key.c
---- /dev/null
-+++ a/fs/reiser4/key.c
+diff -urN linux-2.6.35.orig/fs/reiser4/Kconfig linux-2.6.35/fs/reiser4/Kconfig
+--- linux-2.6.35.orig/fs/reiser4/Kconfig 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/Kconfig 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,34 @@
++config REISER4_FS
++ tristate "Reiser4 (EXPERIMENTAL)"
++ depends on EXPERIMENTAL
++ select ZLIB_INFLATE
++ select ZLIB_DEFLATE
++ select LZO_COMPRESS
++ select LZO_DECOMPRESS
++ select CRYPTO
++ help
++ Reiser4 is a filesystem that performs all filesystem operations
++ as atomic transactions, which means that it either performs a
++ write, or it does not, and in the event of a crash it does not
++ partially perform it or corrupt it.
++
++ It stores files in dancing trees, which are like balanced trees but
++ faster. It packs small files together so that they share blocks
++ without wasting space. This means you can use it to store really
++ small files. It also means that it saves you disk space. It avoids
++ hassling you with anachronisms like having a maximum number of
++ inodes, and wasting space if you use less than that number.
++
++ Reiser4 is a distinct filesystem type from reiserfs (V3).
++ It's therefore not possible to use reiserfs file systems
++ with reiser4.
++
++ To learn more about reiser4, go to http://www.namesys.com
++
++config REISER4_DEBUG
++ bool "Enable reiser4 debug mode"
++ depends on REISER4_FS
++ help
++ Don't use this unless you are debugging reiser4.
++
++ If unsure, say N.
+diff -urN linux-2.6.35.orig/fs/reiser4/key.c linux-2.6.35/fs/reiser4/key.c
+--- linux-2.6.35.orig/fs/reiser4/key.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/key.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,138 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/key.h
---- /dev/null
-+++ a/fs/reiser4/key.h
+diff -urN linux-2.6.35.orig/fs/reiser4/key.h linux-2.6.35/fs/reiser4/key.h
+--- linux-2.6.35.orig/fs/reiser4/key.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/key.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,392 @@
+/* Copyright 2000, 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/ktxnmgrd.c
---- /dev/null
-+++ a/fs/reiser4/ktxnmgrd.c
+diff -urN linux-2.6.35.orig/fs/reiser4/ktxnmgrd.c linux-2.6.35/fs/reiser4/ktxnmgrd.c
+--- linux-2.6.35.orig/fs/reiser4/ktxnmgrd.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/ktxnmgrd.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,215 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+/* Transaction manager daemon. */
+ * fill-column: 120
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/ktxnmgrd.h
---- /dev/null
-+++ a/fs/reiser4/ktxnmgrd.h
+diff -urN linux-2.6.35.orig/fs/reiser4/ktxnmgrd.h linux-2.6.35/fs/reiser4/ktxnmgrd.h
+--- linux-2.6.35.orig/fs/reiser4/ktxnmgrd.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/ktxnmgrd.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,52 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/lock.c
---- /dev/null
-+++ a/fs/reiser4/lock.c
+diff -urN linux-2.6.35.orig/fs/reiser4/lock.c linux-2.6.35/fs/reiser4/lock.c
+--- linux-2.6.35.orig/fs/reiser4/lock.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/lock.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,1237 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 79
+ End:
+*/
-diff -puN /dev/null fs/reiser4/lock.h
---- /dev/null
-+++ a/fs/reiser4/lock.h
+diff -urN linux-2.6.35.orig/fs/reiser4/lock.h linux-2.6.35/fs/reiser4/lock.h
+--- linux-2.6.35.orig/fs/reiser4/lock.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/lock.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,250 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/oid.c
---- /dev/null
-+++ a/fs/reiser4/oid.c
+diff -urN linux-2.6.35.orig/fs/reiser4/Makefile linux-2.6.35/fs/reiser4/Makefile
+--- linux-2.6.35.orig/fs/reiser4/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/Makefile 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,98 @@
++#
++# reiser4/Makefile
++#
++
++obj-$(CONFIG_REISER4_FS) += reiser4.o
++
++reiser4-y := \
++ debug.o \
++ jnode.o \
++ znode.o \
++ key.o \
++ pool.o \
++ tree_mod.o \
++ estimate.o \
++ carry.o \
++ carry_ops.o \
++ lock.o \
++ tree.o \
++ context.o \
++ tap.o \
++ coord.o \
++ block_alloc.o \
++ txnmgr.o \
++ kassign.o \
++ flush.o \
++ wander.o \
++ eottl.o \
++ search.o \
++ page_cache.o \
++ seal.o \
++ dscale.o \
++ flush_queue.o \
++ ktxnmgrd.o \
++ blocknrset.o \
++ super.o \
++ super_ops.o \
++ fsdata.o \
++ export_ops.o \
++ oid.o \
++ tree_walk.o \
++ inode.o \
++ vfs_ops.o \
++ as_ops.o \
++ entd.o\
++ readahead.o \
++ status_flags.o \
++ init_super.o \
++ safe_link.o \
++ \
++ plugin/plugin.o \
++ plugin/plugin_set.o \
++ plugin/node/node.o \
++ plugin/object.o \
++ plugin/cluster.o \
++ plugin/inode_ops.o \
++ plugin/inode_ops_rename.o \
++ plugin/file_ops.o \
++ plugin/file_ops_readdir.o \
++ plugin/file_plugin_common.o \
++ plugin/file/file.o \
++ plugin/file/tail_conversion.o \
++ plugin/file/file_conversion.o \
++ plugin/file/symlink.o \
++ plugin/file/cryptcompress.o \
++ plugin/dir_plugin_common.o \
++ plugin/dir/hashed_dir.o \
++ plugin/dir/seekable_dir.o \
++ plugin/node/node40.o \
++ \
++ plugin/crypto/cipher.o \
++ plugin/crypto/digest.o \
++ \
++ plugin/compress/compress.o \
++ plugin/compress/compress_mode.o \
++ \
++ plugin/item/static_stat.o \
++ plugin/item/sde.o \
++ plugin/item/cde.o \
++ plugin/item/blackbox.o \
++ plugin/item/internal.o \
++ plugin/item/tail.o \
++ plugin/item/ctail.o \
++ plugin/item/extent.o \
++ plugin/item/extent_item_ops.o \
++ plugin/item/extent_file_ops.o \
++ plugin/item/extent_flush_ops.o \
++ \
++ plugin/hash.o \
++ plugin/fibration.o \
++ plugin/tail_policy.o \
++ plugin/item/item.o \
++ \
++ plugin/security/perm.o \
++ plugin/space/bitmap.o \
++ \
++ plugin/disk_format/disk_format40.o \
++ plugin/disk_format/disk_format.o
++
+diff -urN linux-2.6.35.orig/fs/reiser4/oid.c linux-2.6.35/fs/reiser4/oid.c
+--- linux-2.6.35.orig/fs/reiser4/oid.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/oid.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,141 @@
+/* Copyright 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/page_cache.c
---- /dev/null
-+++ a/fs/reiser4/page_cache.c
-@@ -0,0 +1,714 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/page_cache.c linux-2.6.35/fs/reiser4/page_cache.c
+--- linux-2.6.35.orig/fs/reiser4/page_cache.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/page_cache.c 2010-08-04 16:59:56.000000000 +0200
+@@ -0,0 +1,690 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+ return ERR_PTR(RETERR(-ENOMEM));
+}
+
-+/* this function is internally called by jnode_make_dirty() */
-+int reiser4_set_page_dirty_internal(struct page *page)
-+{
-+ struct address_space *mapping;
-+
-+ mapping = page->mapping;
-+ BUG_ON(mapping == NULL);
-+
-+ if (!TestSetPageDirty(page)) {
-+ if (mapping_cap_account_dirty(mapping))
-+ inc_zone_page_state(page, NR_FILE_DIRTY);
-+
-+ __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
-+ }
-+
-+ /* znode must be dirty ? */
-+ if (mapping->host == reiser4_get_super_fake(mapping->host->i_sb))
-+ assert("", JF_ISSET(jprivate(page), JNODE_DIRTY));
-+ return 0;
-+}
-+
+#if 0
+static int can_hit_entd(reiser4_context *ctx, struct super_block *s)
+{
+int reiser4_writepage(struct page *page,
+ struct writeback_control *wbc)
+{
-+ struct super_block *s;
-+ reiser4_context *ctx;
-+
++ /*
++ * assert("edward-1562",
++ * can_hit_entd(get_current_context_check(), sb));
++ */
+ assert("vs-828", PageLocked(page));
+
-+ s = page->mapping->host->i_sb;
-+ ctx = get_current_context_check();
-+
-+ /* assert("", can_hit_entd(ctx, s)); */
+ return write_page_by_ent(page, wbc);
+}
+
+ .set_page_dirty = formatted_set_page_dirty,
+ /* used for read-ahead. Not applicable */
+ .readpages = NULL,
-+ .prepare_write = NULL,
-+ .commit_write = NULL,
++ .write_begin = NULL,
++ .write_end = NULL,
+ .bmap = NULL,
+ /* called just before page is being detached from inode mapping and
+ removed from memory. Called on truncate, cut/squeeze, and
+ * scroll-step: 1
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/page_cache.h
---- /dev/null
-+++ a/fs/reiser4/page_cache.h
-@@ -0,0 +1,68 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/page_cache.h linux-2.6.35/fs/reiser4/page_cache.h
+--- linux-2.6.35.orig/fs/reiser4/page_cache.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/page_cache.h 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,66 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+/* Memory pressure hooks. Fake inodes handling. See page_cache.c. */
+
+extern reiser4_tree *reiser4_tree_by_page(const struct page *);
+
-+extern int reiser4_set_page_dirty_internal(struct page *);
-+
+#define reiser4_submit_bio(rw, bio) submit_bio((rw), (bio))
+
+extern void reiser4_wait_page_writeback(struct page *);
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/Makefile
---- /dev/null
-+++ a/fs/reiser4/plugin/Makefile
-@@ -0,0 +1,26 @@
-+obj-$(CONFIG_REISER4_FS) += plugins.o
-+
-+plugins-objs := \
-+ plugin.o \
-+ plugin_set.o \
-+ object.o \
-+ inode_ops.o \
-+ inode_ops_rename.o \
-+ file_ops.o \
-+ file_ops_readdir.o \
-+ file_plugin_common.o \
-+ dir_plugin_common.o \
-+ digest.o \
-+ hash.o \
-+ fibration.o \
-+ tail_policy.o \
-+ regular.o
-+
-+obj-$(CONFIG_REISER4_FS) += item/
-+obj-$(CONFIG_REISER4_FS) += file/
-+obj-$(CONFIG_REISER4_FS) += dir/
-+obj-$(CONFIG_REISER4_FS) += node/
-+obj-$(CONFIG_REISER4_FS) += compress/
-+obj-$(CONFIG_REISER4_FS) += space/
-+obj-$(CONFIG_REISER4_FS) += disk_format/
-+obj-$(CONFIG_REISER4_FS) += security/
-diff -puN /dev/null fs/reiser4/plugin/cluster.c
---- /dev/null
-+++ a/fs/reiser4/plugin/cluster.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/cluster.c linux-2.6.35/fs/reiser4/plugin/cluster.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/cluster.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/cluster.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,72 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/cluster.h
---- /dev/null
-+++ a/fs/reiser4/plugin/cluster.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/cluster.h linux-2.6.35/fs/reiser4/plugin/cluster.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/cluster.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/cluster.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,410 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/compress/Makefile
---- /dev/null
-+++ a/fs/reiser4/plugin/compress/Makefile
-@@ -0,0 +1,5 @@
-+obj-$(CONFIG_REISER4_FS) += compress_plugins.o
-+
-+compress_plugins-objs := \
-+ compress.o \
-+ compress_mode.o
-diff -puN /dev/null fs/reiser4/plugin/compress/compress.c
---- /dev/null
-+++ a/fs/reiser4/plugin/compress/compress.c
-@@ -0,0 +1,367 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/compress/compress.c linux-2.6.35/fs/reiser4/plugin/compress/compress.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/compress/compress.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/compress/compress.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,355 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+/* reiser4 compression transform plugins */
+
+
+static int gzip1_init(void)
+{
-+ int ret = -EINVAL;
-+#if REISER4_ZLIB
-+ ret = 0;
-+#endif
-+ if (ret == -EINVAL)
-+ warning("edward-1337", "Zlib not compiled into kernel");
-+ return ret;
++ return 0;
+}
+
+static int gzip1_overrun(unsigned src_len UNUSED_ARG)
+static coa_t gzip1_alloc(tfm_action act)
+{
+ coa_t coa = NULL;
-+#if REISER4_ZLIB
+ int ret = 0;
+ switch (act) {
+ case TFMA_WRITE: /* compress */
+ act);
+ return ERR_PTR(ret);
+ }
-+#endif
+ return coa;
+}
+
+}
+
+static void
-+gzip1_compress(coa_t coa, __u8 * src_first, unsigned src_len,
-+ __u8 * dst_first, unsigned *dst_len)
++gzip1_compress(coa_t coa, __u8 * src_first, size_t src_len,
++ __u8 * dst_first, size_t *dst_len)
+{
-+#if REISER4_ZLIB
+ int ret = 0;
+ struct z_stream_s stream;
+
+ return;
+ rollback:
+ *dst_len = src_len;
-+#endif
+ return;
+}
+
+static void
-+gzip1_decompress(coa_t coa, __u8 * src_first, unsigned src_len,
-+ __u8 * dst_first, unsigned *dst_len)
++gzip1_decompress(coa_t coa, __u8 * src_first, size_t src_len,
++ __u8 * dst_first, size_t *dst_len)
+{
-+#if REISER4_ZLIB
+ int ret = 0;
+ struct z_stream_s stream;
+
+ return;
+ }
+ *dst_len = stream.total_out;
-+#endif
+ return;
+}
+
+}
+
+static void
-+lzo1_compress(coa_t coa, __u8 * src_first, unsigned src_len,
-+ __u8 * dst_first, unsigned *dst_len)
++lzo1_compress(coa_t coa, __u8 * src_first, size_t src_len,
++ __u8 * dst_first, size_t *dst_len)
+{
+ int result;
+
+}
+
+static void
-+lzo1_decompress(coa_t coa, __u8 * src_first, unsigned src_len,
-+ __u8 * dst_first, unsigned *dst_len)
++lzo1_decompress(coa_t coa, __u8 * src_first, size_t src_len,
++ __u8 * dst_first, size_t *dst_len)
+{
+ int result;
+
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/compress/compress.h
---- /dev/null
-+++ a/fs/reiser4/plugin/compress/compress.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/compress/compress.h linux-2.6.35/fs/reiser4/plugin/compress/compress.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/compress/compress.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/compress/compress.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,43 @@
+#if !defined( __FS_REISER4_COMPRESS_H__ )
+#define __FS_REISER4_COMPRESS_H__
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/compress/compress_mode.c
---- /dev/null
-+++ a/fs/reiser4/plugin/compress/compress_mode.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/compress/compress_mode.c linux-2.6.35/fs/reiser4/plugin/compress/compress_mode.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/compress/compress_mode.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/compress/compress_mode.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,162 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+/* This file contains Reiser4 compression mode plugins.
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/crypto/cipher.c
---- /dev/null
-+++ a/fs/reiser4/plugin/crypto/cipher.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/compress/Makefile linux-2.6.35/fs/reiser4/plugin/compress/Makefile
+--- linux-2.6.35.orig/fs/reiser4/plugin/compress/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/compress/Makefile 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,5 @@
++obj-$(CONFIG_REISER4_FS) += compress_plugins.o
++
++compress_plugins-objs := \
++ compress.o \
++ compress_mode.o
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/crypto/cipher.c linux-2.6.35/fs/reiser4/plugin/crypto/cipher.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/crypto/cipher.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/crypto/cipher.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,37 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser,
+ licensing governed by reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/crypto/cipher.h
---- /dev/null
-+++ a/fs/reiser4/plugin/crypto/cipher.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/crypto/cipher.h linux-2.6.35/fs/reiser4/plugin/crypto/cipher.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/crypto/cipher.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/crypto/cipher.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,55 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+/* This file contains definitions for the objects operated
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/crypto/digest.c
---- /dev/null
-+++ a/fs/reiser4/plugin/crypto/digest.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/crypto/digest.c linux-2.6.35/fs/reiser4/plugin/crypto/digest.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/crypto/digest.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/crypto/digest.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,58 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/dir/Makefile
---- /dev/null
-+++ a/fs/reiser4/plugin/dir/Makefile
-@@ -0,0 +1,5 @@
-+obj-$(CONFIG_REISER4_FS) += dir_plugins.o
-+
-+dir_plugins-objs := \
-+ hashed_dir.o \
-+ seekable_dir.o
-diff -puN /dev/null fs/reiser4/plugin/dir/dir.h
---- /dev/null
-+++ a/fs/reiser4/plugin/dir/dir.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/dir/dir.h linux-2.6.35/fs/reiser4/plugin/dir/dir.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/dir/dir.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/dir/dir.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,36 @@
+/* Copyright 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/dir/hashed_dir.c
---- /dev/null
-+++ a/fs/reiser4/plugin/dir/hashed_dir.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/dir/hashed_dir.c linux-2.6.35/fs/reiser4/plugin/dir/hashed_dir.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/dir/hashed_dir.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/dir/hashed_dir.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,81 @@
+/* Copyright 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/dir/seekable_dir.c
---- /dev/null
-+++ a/fs/reiser4/plugin/dir/seekable_dir.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/dir/Makefile linux-2.6.35/fs/reiser4/plugin/dir/Makefile
+--- linux-2.6.35.orig/fs/reiser4/plugin/dir/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/dir/Makefile 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,5 @@
++obj-$(CONFIG_REISER4_FS) += dir_plugins.o
++
++dir_plugins-objs := \
++ hashed_dir.o \
++ seekable_dir.o
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/dir/seekable_dir.c linux-2.6.35/fs/reiser4/plugin/dir/seekable_dir.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/dir/seekable_dir.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/dir/seekable_dir.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,46 @@
+/* Copyright 2005 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ set_key_offset(result, (__u64) 0);
+ return;
+}
-diff -puN /dev/null fs/reiser4/plugin/dir_plugin_common.c
---- /dev/null
-+++ a/fs/reiser4/plugin/dir_plugin_common.c
-@@ -0,0 +1,873 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/dir_plugin_common.c linux-2.6.35/fs/reiser4/plugin/dir_plugin_common.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/dir_plugin_common.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/dir_plugin_common.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,865 @@
+/* Copyright 2005 by Hans Reiser, licensing governed by
+ reiser4/README */
+
+ check_light_weight(parent, child);
+ reiser4_iget_complete(parent);
+ dentry = d_obtain_alias(parent);
-+ if (dentry == NULL) {
-+ iput(parent);
-+ dentry = ERR_PTR(RETERR(-ENOMEM));
-+ } else
++ if (!IS_ERR(dentry))
+ dentry->d_op = &get_super_private(s)->ops.dentry;
+ } else if (PTR_ERR(parent) == -ENOENT)
+ dentry = ERR_PTR(RETERR(-ESTALE));
+ result = reiser4_rem_entry_common(object, &goodby_dots, &entry);
+ reiser4_free_dentry_fsdata(&goodby_dots);
+ if (unlikely(result != 0 && result != -ENOMEM && result != -ENOENT))
-+ /* only worth a warning
-+
-+ "values of \ eB\ f will give rise to dom!\n"
-+ -- v6src/s2/mv.c:89
-+ */
+ warning("nikita-2252", "Cannot remove dot of %lli: %i",
+ (unsigned long long)get_inode_oid(object), result);
+ return 0;
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/disk_format/Makefile
---- /dev/null
-+++ a/fs/reiser4/plugin/disk_format/Makefile
-@@ -0,0 +1,5 @@
-+obj-$(CONFIG_REISER4_FS) += df_plugins.o
-+
-+df_plugins-objs := \
-+ disk_format40.o \
-+ disk_format.o
-diff -puN /dev/null fs/reiser4/plugin/disk_format/disk_format.c
---- /dev/null
-+++ a/fs/reiser4/plugin/disk_format/disk_format.c
-@@ -0,0 +1,38 @@
-+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
-+
-+#include "../../debug.h"
-+#include "../plugin_header.h"
-+#include "disk_format40.h"
-+#include "disk_format.h"
-+#include "../plugin.h"
-+
-+/* initialization of disk layout plugins */
-+disk_format_plugin format_plugins[LAST_FORMAT_ID] = {
-+ [FORMAT40_ID] = {
-+ .h = {
-+ .type_id = REISER4_FORMAT_PLUGIN_TYPE,
-+ .id = FORMAT40_ID,
-+ .pops = NULL,
-+ .label = "reiser40",
-+ .desc = "standard disk layout for reiser40",
-+ .linkage = {NULL, NULL}
-+ },
-+ .init_format = init_format_format40,
-+ .root_dir_key = root_dir_key_format40,
-+ .release = release_format40,
-+ .log_super = log_super_format40,
-+ .check_open = check_open_format40,
-+ .version_update = version_update_format40
-+ }
-+};
-+
-+/* Make Linus happy.
-+ Local variables:
-+ c-indentation-style: "K&R"
-+ mode-name: "LC"
-+ c-basic-offset: 8
-+ tab-width: 8
-+ fill-column: 120
-+ scroll-step: 1
-+ End:
-+*/
-diff -puN /dev/null fs/reiser4/plugin/disk_format/disk_format.h
---- /dev/null
-+++ a/fs/reiser4/plugin/disk_format/disk_format.h
-@@ -0,0 +1,27 @@
-+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
-+
-+/* identifiers for disk layouts, they are also used as indexes in array of disk
-+ plugins */
-+
-+#if !defined( __REISER4_DISK_FORMAT_H__ )
-+#define __REISER4_DISK_FORMAT_H__
-+
-+typedef enum {
-+ /* standard reiser4 disk layout plugin id */
-+ FORMAT40_ID,
-+ LAST_FORMAT_ID
-+} disk_format_id;
-+
-+/* __REISER4_DISK_FORMAT_H__ */
-+#endif
-+
-+/* Make Linus happy.
-+ Local variables:
-+ c-indentation-style: "K&R"
-+ mode-name: "LC"
-+ c-basic-offset: 8
-+ tab-width: 8
-+ fill-column: 120
-+ scroll-step: 1
-+ End:
-+*/
-diff -puN /dev/null fs/reiser4/plugin/disk_format/disk_format40.c
---- /dev/null
-+++ a/fs/reiser4/plugin/disk_format/disk_format40.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/disk_format/disk_format40.c linux-2.6.35/fs/reiser4/plugin/disk_format/disk_format40.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/disk_format/disk_format40.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/disk_format/disk_format40.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,655 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/disk_format/disk_format40.h
---- /dev/null
-+++ a/fs/reiser4/plugin/disk_format/disk_format40.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/disk_format/disk_format40.h linux-2.6.35/fs/reiser4/plugin/disk_format/disk_format40.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/disk_format/disk_format40.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/disk_format/disk_format40.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,109 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/fibration.c
---- /dev/null
-+++ a/fs/reiser4/plugin/fibration.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/disk_format/disk_format.c linux-2.6.35/fs/reiser4/plugin/disk_format/disk_format.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/disk_format/disk_format.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/disk_format/disk_format.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,38 @@
++/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
++
++#include "../../debug.h"
++#include "../plugin_header.h"
++#include "disk_format40.h"
++#include "disk_format.h"
++#include "../plugin.h"
++
++/* initialization of disk layout plugins */
++disk_format_plugin format_plugins[LAST_FORMAT_ID] = {
++ [FORMAT40_ID] = {
++ .h = {
++ .type_id = REISER4_FORMAT_PLUGIN_TYPE,
++ .id = FORMAT40_ID,
++ .pops = NULL,
++ .label = "reiser40",
++ .desc = "standard disk layout for reiser40",
++ .linkage = {NULL, NULL}
++ },
++ .init_format = init_format_format40,
++ .root_dir_key = root_dir_key_format40,
++ .release = release_format40,
++ .log_super = log_super_format40,
++ .check_open = check_open_format40,
++ .version_update = version_update_format40
++ }
++};
++
++/* Make Linus happy.
++ Local variables:
++ c-indentation-style: "K&R"
++ mode-name: "LC"
++ c-basic-offset: 8
++ tab-width: 8
++ fill-column: 120
++ scroll-step: 1
++ End:
++*/
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/disk_format/disk_format.h linux-2.6.35/fs/reiser4/plugin/disk_format/disk_format.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/disk_format/disk_format.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/disk_format/disk_format.h 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,27 @@
++/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
++
++/* identifiers for disk layouts, they are also used as indexes in array of disk
++ plugins */
++
++#if !defined( __REISER4_DISK_FORMAT_H__ )
++#define __REISER4_DISK_FORMAT_H__
++
++typedef enum {
++ /* standard reiser4 disk layout plugin id */
++ FORMAT40_ID,
++ LAST_FORMAT_ID
++} disk_format_id;
++
++/* __REISER4_DISK_FORMAT_H__ */
++#endif
++
++/* Make Linus happy.
++ Local variables:
++ c-indentation-style: "K&R"
++ mode-name: "LC"
++ c-basic-offset: 8
++ tab-width: 8
++ fill-column: 120
++ scroll-step: 1
++ End:
++*/
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/disk_format/Makefile linux-2.6.35/fs/reiser4/plugin/disk_format/Makefile
+--- linux-2.6.35.orig/fs/reiser4/plugin/disk_format/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/disk_format/Makefile 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,5 @@
++obj-$(CONFIG_REISER4_FS) += df_plugins.o
++
++df_plugins-objs := \
++ disk_format40.o \
++ disk_format.o
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/fibration.c linux-2.6.35/fs/reiser4/plugin/fibration.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/fibration.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/fibration.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,175 @@
+/* Copyright 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ * fill-column: 79
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/plugin/fibration.h
---- /dev/null
-+++ a/fs/reiser4/plugin/fibration.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/fibration.h linux-2.6.35/fs/reiser4/plugin/fibration.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/fibration.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/fibration.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,37 @@
+/* Copyright 2004 by Hans Reiser, licensing governed by reiser4/README */
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/file/Makefile
---- /dev/null
-+++ a/fs/reiser4/plugin/file/Makefile
-@@ -0,0 +1,7 @@
-+obj-$(CONFIG_REISER4_FS) += file_plugins.o
-+
-+file_plugins-objs := \
-+ file.o \
-+ tail_conversion.o \
-+ symlink.o \
-+ cryptcompress.o
-diff -puN /dev/null fs/reiser4/plugin/file/cryptcompress.c
---- /dev/null
-+++ a/fs/reiser4/plugin/file/cryptcompress.c
-@@ -0,0 +1,3775 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/file/cryptcompress.c linux-2.6.35/fs/reiser4/plugin/file/cryptcompress.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/file/cryptcompress.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/file/cryptcompress.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,3803 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ reiser4/README */
+/*
+ coplug = inode_compression_plugin(inode);
+ if (should_compress(tc, clust->index, inode)) {
+ /* try to compress, discard bad results */
-+ __u32 dst_len;
++ size_t dst_len;
+ compression_mode_plugin * mplug =
+ inode_compression_mode_plugin(inode);
+ assert("edward-602", coplug != NULL);
+ transformed = 1;
+ }
+ if (need_inflate(clust, inode, 0)) {
-+ unsigned dst_len = inode_cluster_size(inode);
++ size_t dst_len = inode_cluster_size(inode);
+ if(transformed)
+ alternate_streams(tc);
+
+ assert("edward-968", pg != NULL);
+ lock_page(pg);
+ assert("edward-1065", PageUptodate(pg));
-+ reiser4_set_page_dirty_internal(pg);
++ set_page_dirty_notag(pg);
+ unlock_page(pg);
+ mark_page_accessed(pg);
+ }
+ info = cryptcompress_inode_data(inode);
+
+ mutex_unlock(&info->checkin_mutex);
-+ reiser4_txn_restart_current();
-+ balance_dirty_pages_ratelimited_nr(inode->i_mapping, nr_dirtied);
++ reiser4_throttle_write(inode, nr_dirtied);
+ mutex_lock(&info->checkin_mutex);
+ return 0;
+}
+ lock_page(page);
+ zero_user(page, pg_off, to_pg);
+ SetPageUptodate(page);
-+ reiser4_set_page_dirty_internal(page);
++ set_page_dirty_notag(page);
+ mark_page_accessed(page);
+ unlock_page(page);
+
+/* the heart of write_cryptcompress */
+static loff_t do_write_cryptcompress(struct file *file, struct inode *inode,
+ const char __user *buf, size_t to_write,
-+ loff_t pos, struct psched_context *cont)
++ loff_t pos, struct dispatch_context *cont)
+{
+ int i;
+ hint_t *hint;
+ if (next_window_stat(&win) == HOLE_WINDOW) {
+ /* write hole in this iteration
+ separated from the loop below */
-+ result = write_pschedule_hook(file, inode,
-+ pos,
-+ &clust,
-+ cont);
++ result = write_dispatch_hook(file, inode,
++ pos, &clust, cont);
+ if (result)
+ goto out;
+ result = prepare_logical_cluster(inode, pos, count, &clust,
+
+ assert("edward-750", reiser4_schedulable());
+
-+ result = write_pschedule_hook(file, inode,
-+ pos + to_write - count,
-+ &clust,
-+ cont);
++ result = write_dispatch_hook(file, inode,
++ pos + to_write - count,
++ &clust, cont);
+ if (result)
+ goto out;
-+ if (cont->state == PSCHED_ASSIGNED_NEW)
-+ /* done_lh was called in write_pschedule_hook */
++ if (cont->state == DISPATCH_ASSIGNED_NEW)
++ /* done_lh was called in write_dispatch_hook */
+ goto out_no_longterm_lock;
+
+ result = prepare_logical_cluster(inode, pos, count, &clust,
+ goto err2;
+ }
+ SetPageUptodate(clust.pages[i]);
-+ reiser4_set_page_dirty_internal(clust.pages[i]);
++ set_page_dirty_notag(clust.pages[i]);
+ flush_dcache_page(clust.pages[i]);
+ mark_page_accessed(clust.pages[i]);
+ unlock_page(clust.pages[i]);
+ put_cluster_handle(&clust);
+ assert("edward-195",
+ ergo((to_write == count),
-+ (result < 0 || cont->state == PSCHED_ASSIGNED_NEW)));
++ (result < 0 || cont->state == DISPATCH_ASSIGNED_NEW)));
+ return (to_write - count) ? (to_write - count) : result;
+}
+
+ */
+ssize_t write_cryptcompress(struct file *file, const char __user *buf,
+ size_t count, loff_t *off,
-+ struct psched_context *cont)
++ struct dispatch_context *cont)
+{
+ ssize_t result;
+ struct inode *inode;
+ loff_t pos = *off;
+ struct cryptcompress_info *info;
+
-+ assert("edward-1449", cont->state == PSCHED_INVAL_STATE);
++ assert("edward-1449", cont->state == DISPATCH_INVAL_STATE);
+
+ inode = file->f_dentry->d_inode;
+ assert("edward-196", cryptcompress_inode_ok(inode));
+ return result;
+}
+
-+/* Capture an anonymous pager cluster. (Page cluser is
-+ * anonymous if it contains at least one anonymous page
++/**
++ * Capture a pager cluster.
++ * @clust must be set up by a caller.
+ */
-+static int capture_anon_page_cluster(struct cluster_handle * clust,
-+ struct inode * inode)
++static int capture_page_cluster(struct cluster_handle * clust,
++ struct inode * inode)
+{
+ int result;
+
+ result = prepare_logical_cluster(inode, 0, 0, clust, LC_APPOV);
+ if (result)
+ return result;
++
+ set_cluster_pages_dirty(clust, inode);
+ result = checkin_logical_cluster(clust, inode);
+ put_hint_cluster(clust, inode, ZNODE_WRITE_LOCK);
+ break;
+ }
+ move_cluster_forward(&clust, inode, pages[0]->index);
-+ result = capture_anon_page_cluster(&clust, inode);
++ result = capture_page_cluster(&clust, inode);
+
+ put_found_pages(pages, found); /* find_anon_page_cluster */
+ if (result)
+ ctx = reiser4_init_context(dentry->d_inode->i_sb);
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
-+ result = setattr_pschedule_hook(inode);
++ result = setattr_dispatch_hook(inode);
+ if (result) {
+ context_set_commit_async(ctx);
+ reiser4_exit_context(ctx);
+}
+
+/* plugin->prepare_write */
-+int prepare_write_cryptcompress(struct file *file, struct page *page,
-+ unsigned from, unsigned to)
++int write_begin_cryptcompress(struct file *file, struct page *page,
++ unsigned from, unsigned to)
+{
-+ return -EINVAL;
++ return do_prepare_write(file, page, from, to);
+}
+
+/* plugin->commit_write */
-+int commit_write_cryptcompress(struct file *file, struct page *page,
-+ unsigned from, unsigned to)
++int write_end_cryptcompress(struct file *file, struct page *page,
++ unsigned from, unsigned to)
+{
-+ BUG();
-+ return 0;
++ int ret;
++ hint_t *hint;
++ lock_handle *lh;
++ struct inode * inode;
++ struct cluster_handle clust;
++
++ unlock_page(page);
++
++ inode = page->mapping->host;
++ hint = kmalloc(sizeof(*hint), reiser4_ctx_gfp_mask_get());
++ if (hint == NULL)
++ return RETERR(-ENOMEM);
++ hint_init_zero(hint);
++ lh = &hint->lh;
++
++ cluster_init_read(&clust, NULL);
++ clust.hint = hint;
++
++ ret = alloc_cluster_pgset(&clust, cluster_nrpages(inode));
++ if (ret)
++ goto out;
++ clust.index = pg_to_clust(page->index, inode);
++ ret = capture_page_cluster(&clust, inode);
++ if (ret)
++ warning("edward-1557",
++ "Capture failed (inode %llu, result=%i)",
++ (unsigned long long)get_inode_oid(inode), ret);
++ out:
++ done_lh(lh);
++ kfree(hint);
++ put_cluster_handle(&clust);
++ return ret;
+}
+
+/* plugin->bmap */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/file/cryptcompress.h
---- /dev/null
-+++ a/fs/reiser4/plugin/file/cryptcompress.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/file/cryptcompress.h linux-2.6.35/fs/reiser4/plugin/file/cryptcompress.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/file/cryptcompress.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/file/cryptcompress.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,616 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+/* See http://www.namesys.com/cryptcompress_design.html */
+void destroy_inode_cryptcompress(struct inode * inode);
+int grab_page_cluster(struct inode *inode, struct cluster_handle * clust,
+ rw_op rw);
-+int write_pschedule_hook(struct file *file, struct inode * inode,
-+ loff_t pos, struct cluster_handle * clust,
-+ struct psched_context * cont);
-+int setattr_pschedule_hook(struct inode * inode);
++int write_dispatch_hook(struct file *file, struct inode * inode,
++ loff_t pos, struct cluster_handle * clust,
++ struct dispatch_context * cont);
++int setattr_dispatch_hook(struct inode * inode);
+struct reiser4_crypto_info * inode_crypto_info(struct inode * inode);
+void inherit_crypto_info_common(struct inode * parent, struct inode * object,
+ int (*can_inherit)(struct inode * child,
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/file/file.c
---- /dev/null
-+++ a/fs/reiser4/plugin/file/file.c
-@@ -0,0 +1,2728 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/file/file.c linux-2.6.35/fs/reiser4/plugin/file/file.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/file/file.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/file/file.c 2010-08-04 18:08:14.000000000 +0200
+@@ -0,0 +1,2688 @@
+/* Copyright 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+
+ BUG_ON(node->atom == NULL);
+ JF_CLR(node, JNODE_WRITE_PREPARED);
-+ jput(node);
+
+ if (get_current_context()->entd) {
+ entd_context *ent = get_entd_context(node->tree->super);
+
+ if (ent->cur_request->page == page)
-+ ent->cur_request->node = node;
++ /* the following reference will be
++ dropped in reiser4_writeout */
++ ent->cur_request->node = jref(node);
+ }
++ jput(node);
+ return 0;
+}
+
+ return result;
+}
+
-+/* this is implementation of method commit_write of struct
-+ address_space_operations for unix file plugin */
-+int
-+commit_write_unix_file(struct file *file, struct page *page,
-+ unsigned from, unsigned to)
++/* plugin->write_end() */
++int write_end_unix_file(struct file *file, struct page *page,
++ unsigned from, unsigned to)
+{
-+ reiser4_context *ctx;
-+ struct inode *inode;
-+ int result;
-+
-+ assert("umka-3101", file != NULL);
-+ assert("umka-3102", page != NULL);
-+ assert("umka-3093", PageLocked(page));
-+
-+ SetPageUptodate(page);
-+
-+ inode = page->mapping->host;
-+ ctx = reiser4_init_context(page->mapping->host->i_sb);
-+ if (IS_ERR(ctx))
-+ return PTR_ERR(ctx);
-+ page_cache_get(page);
+ unlock_page(page);
-+ result = capture_page_and_create_extent(page);
-+ lock_page(page);
-+ page_cache_release(page);
-+
-+ /* don't commit transaction under inode semaphore */
-+ context_set_commit_async(ctx);
-+ reiser4_exit_context(ctx);
-+ return result;
++ return capture_page_and_create_extent(page);
+}
+
+/*
+ *
+ * As a result of (3) ->writepage may be called on a dirty page without
+ * jnode. Such page is called "anonymous" in reiser4. Certain work-loads
-+ * (iozone) generate huge number of anonymous pages. Emergency flush handles
-+ * this situation by creating jnode for anonymous page, starting IO on the
-+ * page, and marking jnode with JNODE_KEEPME bit so that it's not thrown out of
-+ * memory. Such jnode is also called anonymous.
++ * (iozone) generate huge number of anonymous pages.
+ *
-+ * reiser4_sync_sb() method tries to insert anonymous pages and jnodes into
++ * reiser4_sync_sb() method tries to insert anonymous pages into
+ * tree. This is done by capture_anonymous_*() functions below.
+ */
+
+ *index = pvec.pages[i - 1]->index + 1;
+
+ for (i = 0; i < pagevec_count(&pvec); i++) {
-+ /*
-+ * tag PAGECACHE_TAG_REISER4_MOVED will be cleared by
-+ * reiser4_set_page_dirty_internal which is called when jnode is
-+ * captured
-+ */
+ result = capture_anonymous_page(pvec.pages[i]);
+ if (result == 1)
+ nr++;
+ * @cont: unused argument, as we don't perform plugin conversion when being
+ * managed by unix_file plugin.
+ */
-+ssize_t write_unix_file(struct file *file, const char __user *buf,
-+ size_t count, loff_t *pos, struct psched_context *cont)
++ssize_t write_unix_file(struct file *file,
++ const char __user *buf,
++ size_t count, loff_t *pos,
++ struct dispatch_context *cont)
+{
+ int result;
+ reiser4_context *ctx;
+ }
+ drop_access(uf_info);
+ ea = NEITHER_OBTAINED;
-+ reiser4_txn_restart(ctx);
-+ current->journal_info = NULL;
++
+ /*
+ * tell VM how many pages were dirtied. Maybe number of pages
+ * which were dirty already should not be counted
+ */
-+ balance_dirty_pages_ratelimited_nr(inode->i_mapping,
-+ (written + PAGE_CACHE_SIZE - 1) / PAGE_CACHE_SIZE);
-+ current->journal_info = ctx;
-+
++ reiser4_throttle_write(inode,
++ (written + PAGE_CACHE_SIZE - 1) / PAGE_CACHE_SIZE);
+ left -= written;
+ buf += written;
+ *pos += written;
+ if (result == 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) {
+ reiser4_txn_restart_current();
+ grab_space_enable();
-+ result = reiser4_sync_file_common(file, file->f_dentry,
++ result = reiser4_sync_file_common(file,
+ 0 /* data and stat data */);
+ if (result)
+ warning("reiser4-7", "failed to sync file %llu",
+ return reiser4_delete_object_common(inode);
+}
+
-+int
-+prepare_write_unix_file(struct file *file, struct page *page,
-+ unsigned from, unsigned to)
++/* plugin->write_begin() */
++int write_begin_unix_file(struct file *file, struct page *page,
++ unsigned from, unsigned to)
+{
-+ reiser4_context *ctx;
-+ struct unix_file_info *uf_info;
+ int ret;
++ struct unix_file_info *info;
+
-+ ctx = reiser4_init_context(file->f_dentry->d_inode->i_sb);
-+ if (IS_ERR(ctx))
-+ return PTR_ERR(ctx);
-+
-+ uf_info = unix_file_inode_data(file->f_dentry->d_inode);
-+ get_exclusive_access(uf_info);
-+ ret = find_file_state(file->f_dentry->d_inode, uf_info);
-+ if (ret == 0) {
-+ if (uf_info->container == UF_CONTAINER_TAILS)
++ info = unix_file_inode_data(file->f_dentry->d_inode);
++ get_exclusive_access(info);
++ ret = find_file_state(file->f_dentry->d_inode, info);
++ if (likely(ret == 0)) {
++ if (info->container == UF_CONTAINER_TAILS)
+ ret = -EINVAL;
+ else
+ ret = do_prepare_write(file, page, from, to);
+ }
-+ drop_exclusive_access(uf_info);
-+
-+ /* don't commit transaction under inode semaphore */
-+ context_set_commit_async(ctx);
-+ reiser4_exit_context(ctx);
++ drop_exclusive_access(info);
+ return ret;
+}
+
+ * scroll-step: 1
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/plugin/file/file.h
---- /dev/null
-+++ a/fs/reiser4/plugin/file/file.h
-@@ -0,0 +1,331 @@
-+/* Copyright 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
-+ * reiser4/README */
-+
-+/* this file contains declarations of methods implementing
-+ file plugins (UNIX_FILE_PLUGIN_ID, CRYPTCOMPRESS_FILE_PLUGIN_ID
-+ and SYMLINK_FILE_PLUGIN_ID) */
-+
-+#if !defined( __REISER4_FILE_H__ )
-+#define __REISER4_FILE_H__
-+
-+/* possible states when scheduling a new file plugin */
-+typedef enum {
-+ PSCHED_INVAL_STATE, /* invalid state */
-+ PSCHED_SCHED_POINT, /* scheduling point has been achieved */
-+ PSCHED_REMAINS_OLD, /* made a decision to be managed by old plugin */
-+ PSCHED_ASSIGNED_NEW /* new plugin has been scheduled */
-+} psched_state;
-+
-+struct psched_context {
-+ int nr_pages;
-+ struct page **pages;
-+ psched_state state;
-+};
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/file/file_conversion.c linux-2.6.35/fs/reiser4/plugin/file/file_conversion.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/file/file_conversion.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/file/file_conversion.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,747 @@
++/* Copyright 2001, 2002, 2003 by Hans Reiser,
++ licensing governed by reiser4/README */
+
+/**
-+ * Declarations of common/careful/generic methods.
-+ * Suppose ->foo() is a vs method (of f_ops, i_ops, or a_ops);
-+ * Then common reiser4 method for foo looks like reiser4_foo_common;
-+ * careful method looks like reiser4_foo_careful;
-+ * generic method looks like reiser4_foo.
++ * This file contains dispatching hooks, and conversion methods, which
++ * implement transitions in the FILE interface.
+ *
-+ * Common method is a simple instruction set eligible for more
-+ * then one plugin id.
++ * Dispatching hook makes a decision (at dispatching point) about the
++ * most reasonable plugin. Such decision is made in accordance with some
++ * O(1)-heuristic.
+ *
-+ * Generic method looks at the plugin installed in inode's
-+ * plugin set and calls its appropriate method.
++ * We implement a transition CRYPTCOMPRESS -> UNIX_FILE for files with
++ * incompressible data. Current heuristic to estimate compressibility is
++ * very simple: if first complete logical cluster (64K by default) of a
++ * file is incompressible, then we make a decision, that the whole file
++ * is incompressible.
+ *
-+ * Careful method looks like generic method with protected pset
-+ * (see plugin/file/file_conversion.c for details).
-+ */
-+
-+/* inode operations */
-+int reiser4_setattr(struct dentry *, struct iattr *);
-+
-+/* file operations */
-+ssize_t reiser4_read_careful(struct file *, char __user *buf,
-+ size_t count, loff_t *off);
-+ssize_t reiser4_write_careful(struct file *, const char __user *buf,
-+ size_t count, loff_t * off);
-+int reiser4_ioctl_careful(struct inode *inode, struct file *filp,
-+ unsigned int cmd, unsigned long arg);
-+int reiser4_mmap_careful(struct file *, struct vm_area_struct *);
-+int reiser4_open_careful(struct inode *inode, struct file *file);
-+int reiser4_release_careful(struct inode *, struct file *);
-+int reiser4_sync_file_common(struct file *, struct dentry *, int datasync);
-+
-+/* address space operations */
-+int reiser4_readpage(struct file *, struct page *);
-+int reiser4_readpages(struct file*, struct address_space*, struct list_head*,
-+ unsigned);
-+int reiser4_writepages(struct address_space *, struct writeback_control *);
-+int reiser4_prepare_write(struct file *, struct page *, unsigned from,
-+ unsigned to);
-+int reiser4_commit_write(struct file *, struct page *, unsigned from,
-+ unsigned to);
-+sector_t reiser4_bmap_careful(struct address_space *, sector_t lblock);
-+
-+/*
-+ * Private methods of unix-file plugin
-+ * (UNIX_FILE_PLUGIN_ID)
-+ */
-+
-+/* private inode operations */
-+int setattr_unix_file(struct dentry *, struct iattr *);
-+
-+/* private file operations */
-+
-+ssize_t read_unix_file(struct file *, char __user *buf, size_t read_amount,
-+ loff_t *off);
-+ssize_t write_unix_file(struct file *, const char __user *buf, size_t write_amount,
-+ loff_t * off, struct psched_context * cont);
-+int ioctl_unix_file(struct inode *, struct file *, unsigned int cmd,
-+ unsigned long arg);
-+int mmap_unix_file(struct file *, struct vm_area_struct *);
-+int open_unix_file(struct inode *, struct file *);
-+int release_unix_file(struct inode *, struct file *);
-+
-+/* private address space operations */
-+int readpage_unix_file(struct file *, struct page *);
-+int readpages_unix_file(struct file*, struct address_space*, struct list_head*, unsigned);
-+int writepages_unix_file(struct address_space *, struct writeback_control *);
-+int prepare_write_unix_file(struct file *, struct page *, unsigned from,
-+ unsigned to);
-+int commit_write_unix_file(struct file *, struct page *, unsigned from,
-+ unsigned to);
-+sector_t bmap_unix_file(struct address_space *, sector_t lblock);
-+
-+/* other private methods */
-+int delete_object_unix_file(struct inode *);
-+int flow_by_inode_unix_file(struct inode *, const char __user *buf,
-+ int user, loff_t, loff_t, rw_op, flow_t *);
-+int owns_item_unix_file(const struct inode *, const coord_t *);
-+void init_inode_data_unix_file(struct inode *, reiser4_object_create_data *,
-+ int create);
-+
-+/*
-+ * Private methods of cryptcompress file plugin
-+ * (CRYPTCOMPRESS_FILE_PLUGIN_ID)
-+ */
-+
-+/* private inode operations */
-+int setattr_cryptcompress(struct dentry *, struct iattr *);
-+
-+/* private file operations */
-+ssize_t read_cryptcompress(struct file *, char __user *buf,
-+ size_t count, loff_t *off);
-+ssize_t write_cryptcompress(struct file *, const char __user *buf,
-+ size_t count, loff_t * off,
-+ struct psched_context *cont);
-+int ioctl_cryptcompress(struct inode *, struct file *, unsigned int cmd,
-+ unsigned long arg);
-+int mmap_cryptcompress(struct file *, struct vm_area_struct *);
-+int open_cryptcompress(struct inode *, struct file *);
-+int release_cryptcompress(struct inode *, struct file *);
-+
-+/* private address space operations */
-+int readpage_cryptcompress(struct file *, struct page *);
-+int readpages_cryptcompress(struct file*, struct address_space*,
-+ struct list_head*, unsigned);
-+int writepages_cryptcompress(struct address_space *,
-+ struct writeback_control *);
-+int prepare_write_cryptcompress(struct file *, struct page *, unsigned from,
-+ unsigned to);
-+int commit_write_cryptcompress(struct file *, struct page *, unsigned from,
-+ unsigned to);
-+sector_t bmap_cryptcompress(struct address_space *, sector_t lblock);
-+
-+/* other private methods */
-+int flow_by_inode_cryptcompress(struct inode *, const char __user *buf,
-+ int user, loff_t, loff_t, rw_op, flow_t *);
-+int key_by_inode_cryptcompress(struct inode *, loff_t off, reiser4_key *);
-+int create_object_cryptcompress(struct inode *, struct inode *,
-+ reiser4_object_create_data *);
-+int delete_object_cryptcompress(struct inode *);
-+void init_inode_data_cryptcompress(struct inode *, reiser4_object_create_data *,
-+ int create);
-+int cut_tree_worker_cryptcompress(tap_t *, const reiser4_key * from_key,
-+ const reiser4_key * to_key,
-+ reiser4_key * smallest_removed,
-+ struct inode *object, int truncate,
-+ int *progress);
-+void destroy_inode_cryptcompress(struct inode *);
-+
-+/*
-+ * Private methods of symlink file plugin
-+ * (SYMLINK_FILE_PLUGIN_ID)
-+ */
-+int reiser4_create_symlink(struct inode *symlink, struct inode *dir,
-+ reiser4_object_create_data *);
-+void destroy_inode_symlink(struct inode *);
-+
-+/*
-+ * all the write into unix file is performed by item write method. Write method
-+ * of unix file plugin only decides which item plugin (extent or tail) and in
-+ * which mode (one from the enum below) to call
-+ */
-+typedef enum {
-+ FIRST_ITEM = 1,
-+ APPEND_ITEM = 2,
-+ OVERWRITE_ITEM = 3
-+} write_mode_t;
-+
-+/* unix file may be in one the following states */
-+typedef enum {
-+ UF_CONTAINER_UNKNOWN = 0,
-+ UF_CONTAINER_TAILS = 1,
-+ UF_CONTAINER_EXTENTS = 2,
-+ UF_CONTAINER_EMPTY = 3
-+} file_container_t;
-+
-+struct formatting_plugin;
-+struct inode;
-+
-+/* unix file plugin specific part of reiser4 inode */
-+struct unix_file_info {
-+ /*
-+ * this read-write lock protects file containerization change. Accesses
-+ * which do not change file containerization (see file_container_t)
-+ * (read, readpage, writepage, write (until tail conversion is
-+ * involved)) take read-lock. Accesses which modify file
-+ * containerization (truncate, conversion from tail to extent and back)
-+ * take write-lock.
-+ */
-+ struct rw_semaphore latch;
-+ /* this enum specifies which items are used to build the file */
-+ file_container_t container;
-+ /*
-+ * plugin which controls when file is to be converted to extents and
-+ * back to tail
-+ */
-+ struct formatting_plugin *tplug;
-+ /* if this is set, file is in exclusive use */
-+ int exclusive_use;
-+#if REISER4_DEBUG
-+ /* pointer to task struct of thread owning exclusive access to file */
-+ void *ea_owner;
-+ atomic_t nr_neas;
-+ void *last_reader;
-+#endif
-+};
-+
-+struct unix_file_info *unix_file_inode_data(const struct inode *inode);
-+void get_exclusive_access(struct unix_file_info *);
-+void drop_exclusive_access(struct unix_file_info *);
-+void get_nonexclusive_access(struct unix_file_info *);
-+void drop_nonexclusive_access(struct unix_file_info *);
-+int try_to_get_nonexclusive_access(struct unix_file_info *);
-+int find_file_item(hint_t *, const reiser4_key *, znode_lock_mode,
-+ struct inode *);
-+int find_file_item_nohint(coord_t *, lock_handle *,
-+ const reiser4_key *, znode_lock_mode,
-+ struct inode *);
-+
-+int load_file_hint(struct file *, hint_t *);
-+void save_file_hint(struct file *, const hint_t *);
-+
-+#include "../item/extent.h"
-+#include "../item/tail.h"
-+#include "../item/ctail.h"
-+
-+struct uf_coord {
-+ coord_t coord;
-+ lock_handle *lh;
-+ int valid;
-+ union {
-+ struct extent_coord_extension extent;
-+ struct tail_coord_extension tail;
-+ struct ctail_coord_extension ctail;
-+ } extension;
-+};
-+
-+#include "../../forward.h"
-+#include "../../seal.h"
-+#include "../../lock.h"
-+
-+/*
-+ * This structure is used to speed up file operations (reads and writes). A
-+ * hint is a suggestion about where a key resolved to last time. A seal
-+ * indicates whether a node has been modified since a hint was last recorded.
-+ * You check the seal, and if the seal is still valid, you can use the hint
-+ * without traversing the tree again.
-+ */
-+struct hint {
-+ seal_t seal; /* a seal over last file item accessed */
-+ uf_coord_t ext_coord;
-+ loff_t offset;
-+ znode_lock_mode mode;
-+ lock_handle lh;
-+};
-+
-+static inline int hint_is_valid(hint_t * hint)
-+{
-+ return hint->ext_coord.valid;
-+}
-+
-+static inline void hint_set_valid(hint_t * hint)
-+{
-+ hint->ext_coord.valid = 1;
-+}
-+
-+static inline void hint_clr_valid(hint_t * hint)
-+{
-+ hint->ext_coord.valid = 0;
-+}
-+
-+int load_file_hint(struct file *, hint_t *);
-+void save_file_hint(struct file *, const hint_t *);
-+void hint_init_zero(hint_t *);
-+void reiser4_set_hint(hint_t *, const reiser4_key *, znode_lock_mode);
-+int hint_is_set(const hint_t *);
-+void reiser4_unset_hint(hint_t *);
-+
-+int reiser4_update_file_size(struct inode *, loff_t, int update_sd);
-+int cut_file_items(struct inode *, loff_t new_size,
-+ int update_sd, loff_t cur_size,
-+ int (*update_actor) (struct inode *, loff_t, int));
-+#if REISER4_DEBUG
-+
-+/* return 1 is exclusive access is obtained, 0 - otherwise */
-+static inline int ea_obtained(struct unix_file_info * uf_info)
-+{
-+ int ret;
-+
-+ ret = down_read_trylock(&uf_info->latch);
-+ if (ret)
-+ up_read(&uf_info->latch);
-+ return !ret;
-+}
-+
-+#endif
-+
-+#define WRITE_GRANULARITY 32
-+
-+int tail2extent(struct unix_file_info *);
-+int extent2tail(struct file *, struct unix_file_info *);
-+
-+int goto_right_neighbor(coord_t *, lock_handle *);
-+int find_or_create_extent(struct page *);
-+int equal_to_ldk(znode *, const reiser4_key *);
-+
-+void init_uf_coord(uf_coord_t *uf_coord, lock_handle *lh);
-+
-+static inline int cbk_errored(int cbk_result)
-+{
-+ return (cbk_result != CBK_COORD_NOTFOUND
-+ && cbk_result != CBK_COORD_FOUND);
-+}
-+
-+/* __REISER4_FILE_H__ */
-+#endif
-+
-+/*
-+ * Local variables:
-+ * c-indentation-style: "K&R"
-+ * mode-name: "LC"
-+ * c-basic-offset: 8
-+ * tab-width: 8
-+ * fill-column: 79
-+ * scroll-step: 1
-+ * End:
-+*/
-diff -puN /dev/null fs/reiser4/plugin/file/file_conversion.c
---- /dev/null
-+++ a/fs/reiser4/plugin/file/file_conversion.c
-@@ -0,0 +1,689 @@
-+/* Copyright 2001, 2002, 2003 by Hans Reiser,
-+ licensing governed by reiser4/README */
-+
-+/**
-+ * This file contains plugin schedule hooks, and plugin conversion methods.
-+ *
-+ * Plugin schedule hook makes a decision (at plugin schedule point) about the
-+ * most reasonable plugins for managing a regular file. Usually such decisions
-+ * is made by some O(1)-heuristic.
-+ *
-+ * By default we assign a unix_file plugin id when writing incompressible file
-+ * managed by cryptcompress plugin id. Currently used heuristic for estimating
-+ * compressibility is very simple: if first complete logical cluster (64K by
-+ * default) of a file is incompressible, then we make a decision, that the whole
-+ * file is incompressible (*).
-+ *
-+ * To enable a conversion we install a special "magic" compression mode plugin
-+ * (CONVX_COMPRESSION_MODE_ID, see plugin/compress/compress_mode.c for details)
-+ * at file creation time (**).
-+ *
-+ * Note, that we don't perform back conversion (unix_file->cryptcompress)
-+ * because of compatibility reasons (see http://dev.namesys.com/Version4.X.Y
-+ * for details).
-+ *
-+ * The conversion is accompanied by rebuilding disk structures of a file, so it
-+ * is important to protect them from being interacted with other plugins which
-+ * don't expect them to be in such inconsistent state. For this to be protected
-+ * we serialize readers and writers of a file's conversion set (FCS).
-+ *
-+ * We define FCS as a file plugin installed in inode's pset plus file's data
-+ * and metadata that this file plugin manipulates with (items, etc).
-+ * Note, that FCS is defined per file.
-+ * FCS reader is defined as a set of instruction of the following type:
-+ * {inode_file_plugin(inode)->method()} (I.e. retrieving a file plugin id
-+ * conjoined with all method's instructions should be atomic).
-+ * FCS writer is a set of instructions that perform file plugin conversion
-+ * (convert items, update pset, etc).
-+ * Example:
-+ * reiser4_write_careful() supplied to VFS as a ->write() file operation is
-+ * composed of the following (optional) instructions:
-+ * 1 2 3
-+ * *********************** ####### -------------------------------------------->
-+ *
-+ * 1) "****" are instructions performed on behalf of cryptcompress file plugin;
-+ * 2) "####" is a FCS writer (performing a conversion cryptcompress->unix_file);
-+ * 3) "----" are instructions performed on behalf of unix_file plugin;
-+ * Here (1) and (3) are FCS readers.
-+ *
-+ * In this example FCS readers and writers are already serialized (by design),
-+ * however there can be readers and writers executing at the same time in
-+ * different contexts, so we need a common mechanism of serialization.
-+ *
-+ * Currently serialization of FCS readers and writers is performed via acquiring
-+ * a special per-inode rw-semaphore (conv_sem). And yes, {down, up}_read is for
-+ * FCS readers, and {down, up}_write is for FCS writers, see the macros below
-+ * for passive/active protection.
-+ *
-+ * ---
-+ * (*) This heuristic can be changed to a better one (benchmarking is needed).
-+ * (**) Such technique allows to keep enable/disable state on disk.
++ * To enable dispatching we install a special "magic" compression mode
++ * plugin CONVX_COMPRESSION_MODE_ID at file creation time.
++ *
++ * Note, that we don't perform back conversion (UNIX_FILE->CRYPTCOMPRESS)
++ * because of compatibility reasons).
++ *
++ * In conversion time we protect CS, the conversion set (file's (meta)data
++ * and plugin table (pset)) via special per-inode rw-semaphore (conv_sem).
++ * The methods which implement conversion are CS writers. The methods of FS
++ * interface (file_operations, inode_operations, address_space_operations)
++ * are CS readers.
+ */
+
+#include "../../inode.h"
+/**
+ * Check if we really have achieved plugin scheduling point
+ */
-+static int check_psched_point(struct inode * inode,
-+ loff_t pos /* position in the
-+ file to write from */,
-+ struct cluster_handle * clust,
-+ struct psched_context * cont)
++static int check_dispatch_point(struct inode * inode,
++ loff_t pos /* position in the
++ file to write from */,
++ struct cluster_handle * clust,
++ struct dispatch_context * cont)
+{
+ assert("edward-1505", conversion_enabled(inode));
+ /*
+ pos == inode->i_size &&
+ pos == inode_cluster_size(inode));
+ assert("edward-1539", cont != NULL);
-+ assert("edward-1540", cont->state == PSCHED_INVAL_STATE);
++ assert("edward-1540", cont->state == DISPATCH_INVAL_STATE);
+
-+ cont->state = PSCHED_SCHED_POINT;
++ cont->state = DISPATCH_POINT;
+ return 0;
+}
+
+ */
+static int read_check_compressibility(struct inode * inode,
+ struct cluster_handle * clust,
-+ struct psched_context * cont)
++ struct dispatch_context * cont)
+{
+ int i;
+ int result;
-+ __u32 dst_len;
++ size_t dst_len;
+ hint_t tmp_hint;
+ hint_t * cur_hint = clust->hint;
-+ assert("edward-1541", cont->state == PSCHED_SCHED_POINT);
++ assert("edward-1541", cont->state == DISPATCH_POINT);
+
+ start_check_compressibility(inode, clust, &tmp_hint);
+
+ finish_check_compressibility(inode, clust, cur_hint);
+ cont->state =
+ (data_is_compressible(dst_len, inode_cluster_size(inode)) ?
-+ PSCHED_REMAINS_OLD :
-+ PSCHED_ASSIGNED_NEW);
++ DISPATCH_REMAINS_OLD :
++ DISPATCH_ASSIGNED_NEW);
+ return 0;
+ error:
+ put_page_cluster(clust, inode, READ_OP);
+/**
+ * Convert cryptcompress file plugin to unix_file plugin.
+ */
-+static int cryptcompress2unixfile(struct file * file, struct inode * inode,
-+ struct psched_context * cont)
++static int cryptcompress2unixfile(struct file *file, struct inode *inode,
++ struct dispatch_context *cont)
+{
+ int i;
+ int result = 0;
+ * Make a decision about the most reasonable file plugin id to manage
+ * the file.
+ */
-+int write_pschedule_hook(struct file * file, struct inode * inode,
-+ loff_t pos, struct cluster_handle * clust,
-+ struct psched_context * cont)
++int write_dispatch_hook(struct file *file, struct inode *inode,
++ loff_t pos, struct cluster_handle *clust,
++ struct dispatch_context *cont)
+{
+ int result;
+ if (!conversion_enabled(inode))
+ return 0;
-+ result = check_psched_point(inode, pos, clust, cont);
-+ if (result || cont->state != PSCHED_SCHED_POINT)
++ result = check_dispatch_point(inode, pos, clust, cont);
++ if (result || cont->state != DISPATCH_POINT)
+ return result;
+ result = read_check_compressibility(inode, clust, cont);
+ if (result)
+ return result;
-+ if (cont->state == PSCHED_REMAINS_OLD) {
++ if (cont->state == DISPATCH_REMAINS_OLD) {
+ put_page_cluster(clust, inode, READ_OP);
+ return disable_conversion(inode);
+ }
-+ assert("edward-1543", cont->state == PSCHED_ASSIGNED_NEW);
++ assert("edward-1543", cont->state == DISPATCH_ASSIGNED_NEW);
+ /*
+ * page cluster is grabbed and uptodate. It will be
+ * released with a pgset after plugin conversion is
-+ * finished, see put_psched_context().
++ * finished, see put_dispatch_context().
+ */
+ reiser4_unset_hint(clust->hint);
+ move_cluster_pgset(clust, &cont->pages, &cont->nr_pages);
+/**
+ * This is called by ->setattr() method of cryptcompress file plugin.
+ */
-+int setattr_pschedule_hook(struct inode * inode)
++int setattr_dispatch_hook(struct inode * inode)
+{
+ if (conversion_enabled(inode))
+ return disable_conversion(inode);
+ return 0;
+}
+
-+static inline void init_psched_context(struct psched_context * cont)
++static inline void init_dispatch_context(struct dispatch_context * cont)
+{
+ memset(cont, 0, sizeof(*cont));
+}
+
-+static inline void done_psched_context(struct psched_context * cont,
-+ struct inode * inode)
++static inline void done_dispatch_context(struct dispatch_context * cont,
++ struct inode * inode)
+{
+ if (cont->pages) {
+ __put_page_cluster(0, cont->nr_pages, cont->pages, inode);
+ reiser4_context *ctx;
+ ssize_t written_old = 0; /* bytes written with initial plugin */
+ ssize_t written_new = 0; /* bytes written with new plugin */
-+ struct psched_context cont;
++ struct dispatch_context cont;
+ struct inode * inode = file->f_dentry->d_inode;
+
+ ctx = reiser4_init_context(inode->i_sb);
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
-+ init_psched_context(&cont);
++ init_dispatch_context(&cont);
+ mutex_lock(&inode->i_mutex);
+ /**
+ * First step.
+ count,
+ off,
+ &cont);
-+ if (cont.state != PSCHED_ASSIGNED_NEW || written_old < 0)
++ if (cont.state != DISPATCH_ASSIGNED_NEW || written_old < 0)
+ goto exit;
+ /**
+ * Second step.
+ NULL);
+ exit:
+ mutex_unlock(&inode->i_mutex);
-+ done_psched_context(&cont, inode);
++ done_dispatch_context(&cont, inode);
+ reiser4_exit_context(ctx);
+
+ return written_old + (written_new < 0 ? 0 : written_new);
+ return PROT_PASSIVE(sector_t, bmap, (mapping, lblock));
+}
+
++/**
++ * NOTE: The following two methods are
++ * used only for loopback functionality.
++ * reiser4_write_end() can not cope with
++ * short writes for now.
++ */
++int reiser4_write_begin_careful(struct file *file,
++ struct address_space *mapping,
++ loff_t pos,
++ unsigned len,
++ unsigned flags,
++ struct page **pagep,
++ void **fsdata)
++{
++ int ret = 0;
++ unsigned start, end;
++ struct page *page;
++ pgoff_t index;
++ reiser4_context *ctx;
++ struct inode * inode = file->f_dentry->d_inode;
++
++ index = pos >> PAGE_CACHE_SHIFT;
++ start = pos & (PAGE_CACHE_SIZE - 1);
++ end = start + len;
++
++ page = grab_cache_page_write_begin(mapping, index,
++ flags & AOP_FLAG_NOFS);
++ *pagep = page;
++ if (!page)
++ return -ENOMEM;
++
++ ctx = reiser4_init_context(file->f_dentry->d_inode->i_sb);
++ if (IS_ERR(ctx)) {
++ ret = PTR_ERR(ctx);
++ goto out;
++ }
++ ret = PROT_PASSIVE(int, write_begin, (file, page, start, end));
++
++ /* don't commit transaction under inode semaphore */
++ context_set_commit_async(ctx);
++ reiser4_exit_context(ctx);
++ out:
++ if (unlikely(ret)) {
++ unlock_page(page);
++ page_cache_release(page);
++ }
++ return ret;
++}
++
++int reiser4_write_end_careful(struct file *file,
++ struct address_space *mapping,
++ loff_t pos,
++ unsigned len,
++ unsigned copied,
++ struct page *page,
++ void *fsdata)
++{
++ int ret;
++ reiser4_context *ctx;
++ unsigned start, end;
++ struct inode *inode = page->mapping->host;
++
++ assert("umka-3101", file != NULL);
++ assert("umka-3102", page != NULL);
++ assert("umka-3093", PageLocked(page));
++
++ start = pos & (PAGE_CACHE_SIZE - 1);
++ end = start + len;
++
++ flush_dcache_page(page);
++ SetPageUptodate(page);
++
++ ctx = reiser4_init_context(page->mapping->host->i_sb);
++ if (IS_ERR(ctx)){
++ unlock_page(page);
++ ret = PTR_ERR(ctx);
++ goto out;
++ }
++ ret = PROT_PASSIVE(int, write_end, (file, page, start, end));
++
++ /* don't commit transaction under inode semaphore */
++ context_set_commit_async(ctx);
++ reiser4_exit_context(ctx);
++ out:
++ page_cache_release(page);
++ if (!ret)
++ ret = copied;
++ return ret;
++}
++
+/*
+ * Wrappers without protection for:
+ *
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/file/symfile.c
---- /dev/null
-+++ a/fs/reiser4/plugin/file/symfile.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/file/file.h linux-2.6.35/fs/reiser4/plugin/file/file.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/file/file.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/file/file.h 2010-08-04 20:23:15.000000000 +0200
+@@ -0,0 +1,336 @@
++/* Copyright 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
++ * reiser4/README */
++
++/* this file contains declarations of methods implementing
++ file plugins (UNIX_FILE_PLUGIN_ID, CRYPTCOMPRESS_FILE_PLUGIN_ID
++ and SYMLINK_FILE_PLUGIN_ID) */
++
++#if !defined( __REISER4_FILE_H__ )
++#define __REISER4_FILE_H__
++
++/* possible states in dispatching process */
++typedef enum {
++ DISPATCH_INVAL_STATE, /* invalid state */
++ DISPATCH_POINT, /* dispatching point has been achieved */
++ DISPATCH_REMAINS_OLD, /* made a decision to manage by old plugin */
++ DISPATCH_ASSIGNED_NEW /* a new plugin has been assigned */
++} dispatch_state;
++
++struct dispatch_context {
++ int nr_pages;
++ struct page **pages;
++ dispatch_state state;
++};
++
++/**
++ * Declarations of common/careful/generic methods.
++ * Suppose ->foo() is a vs method (of f_ops, i_ops, or a_ops);
++ * Then common reiser4 method for foo looks like reiser4_foo_common;
++ * careful method looks like reiser4_foo_careful;
++ * generic method looks like reiser4_foo.
++ *
++ * Common method is a simple instruction set eligible for more
++ * then one plugin id.
++ *
++ * Generic method looks at the plugin installed in inode's
++ * plugin set and calls its appropriate method.
++ *
++ * Careful method looks like generic method with protected pset
++ * (see plugin/file/file_conversion.c for details).
++ */
++
++/* inode operations */
++int reiser4_setattr(struct dentry *, struct iattr *);
++
++/* file operations */
++ssize_t reiser4_read_careful(struct file *, char __user *buf,
++ size_t count, loff_t *off);
++ssize_t reiser4_write_careful(struct file *, const char __user *buf,
++ size_t count, loff_t * off);
++int reiser4_ioctl_careful(struct inode *inode, struct file *filp,
++ unsigned int cmd, unsigned long arg);
++int reiser4_mmap_careful(struct file *, struct vm_area_struct *);
++int reiser4_open_careful(struct inode *inode, struct file *file);
++int reiser4_release_careful(struct inode *, struct file *);
++int reiser4_sync_file_common(struct file *, int datasync);
++
++/* address space operations */
++int reiser4_readpage(struct file *, struct page *);
++int reiser4_readpages(struct file*, struct address_space*, struct list_head*,
++ unsigned);
++int reiser4_writepages(struct address_space *, struct writeback_control *);
++int reiser4_write_begin_careful(struct file *file,
++ struct address_space *mapping,
++ loff_t pos, unsigned len, unsigned flags,
++ struct page **pagep, void **fsdata);
++int reiser4_write_end_careful(struct file *file,
++ struct address_space *mapping,
++ loff_t pos, unsigned len, unsigned copied,
++ struct page *page, void *fsdata);
++sector_t reiser4_bmap_careful(struct address_space *, sector_t lblock);
++
++/*
++ * Private methods of unix-file plugin
++ * (UNIX_FILE_PLUGIN_ID)
++ */
++
++/* private inode operations */
++int setattr_unix_file(struct dentry *, struct iattr *);
++
++/* private file operations */
++
++ssize_t read_unix_file(struct file *, char __user *buf, size_t read_amount,
++ loff_t *off);
++ssize_t write_unix_file(struct file *, const char __user *buf, size_t write_amount,
++ loff_t * off, struct dispatch_context * cont);
++int ioctl_unix_file(struct inode *, struct file *, unsigned int cmd,
++ unsigned long arg);
++int mmap_unix_file(struct file *, struct vm_area_struct *);
++int open_unix_file(struct inode *, struct file *);
++int release_unix_file(struct inode *, struct file *);
++
++/* private address space operations */
++int readpage_unix_file(struct file *, struct page *);
++int readpages_unix_file(struct file*, struct address_space*, struct list_head*,
++ unsigned);
++int writepages_unix_file(struct address_space *, struct writeback_control *);
++int write_begin_unix_file(struct file *file, struct page *page,
++ unsigned from, unsigned to);
++int write_end_unix_file(struct file *file, struct page *page,
++ unsigned from, unsigned to);
++sector_t bmap_unix_file(struct address_space *, sector_t lblock);
++
++/* other private methods */
++int delete_object_unix_file(struct inode *);
++int flow_by_inode_unix_file(struct inode *, const char __user *buf,
++ int user, loff_t, loff_t, rw_op, flow_t *);
++int owns_item_unix_file(const struct inode *, const coord_t *);
++void init_inode_data_unix_file(struct inode *, reiser4_object_create_data *,
++ int create);
++
++/*
++ * Private methods of cryptcompress file plugin
++ * (CRYPTCOMPRESS_FILE_PLUGIN_ID)
++ */
++
++/* private inode operations */
++int setattr_cryptcompress(struct dentry *, struct iattr *);
++
++/* private file operations */
++ssize_t read_cryptcompress(struct file *, char __user *buf,
++ size_t count, loff_t *off);
++ssize_t write_cryptcompress(struct file *, const char __user *buf,
++ size_t count, loff_t * off,
++ struct dispatch_context *cont);
++int ioctl_cryptcompress(struct inode *, struct file *, unsigned int cmd,
++ unsigned long arg);
++int mmap_cryptcompress(struct file *, struct vm_area_struct *);
++int open_cryptcompress(struct inode *, struct file *);
++int release_cryptcompress(struct inode *, struct file *);
++
++/* private address space operations */
++int readpage_cryptcompress(struct file *, struct page *);
++int readpages_cryptcompress(struct file*, struct address_space*,
++ struct list_head*, unsigned);
++int writepages_cryptcompress(struct address_space *,
++ struct writeback_control *);
++int write_begin_cryptcompress(struct file *file, struct page *page,
++ unsigned from, unsigned to);
++int write_end_cryptcompress(struct file *file, struct page *page,
++ unsigned from, unsigned to);
++sector_t bmap_cryptcompress(struct address_space *, sector_t lblock);
++
++/* other private methods */
++int flow_by_inode_cryptcompress(struct inode *, const char __user *buf,
++ int user, loff_t, loff_t, rw_op, flow_t *);
++int key_by_inode_cryptcompress(struct inode *, loff_t off, reiser4_key *);
++int create_object_cryptcompress(struct inode *, struct inode *,
++ reiser4_object_create_data *);
++int delete_object_cryptcompress(struct inode *);
++void init_inode_data_cryptcompress(struct inode *, reiser4_object_create_data *,
++ int create);
++int cut_tree_worker_cryptcompress(tap_t *, const reiser4_key * from_key,
++ const reiser4_key * to_key,
++ reiser4_key * smallest_removed,
++ struct inode *object, int truncate,
++ int *progress);
++void destroy_inode_cryptcompress(struct inode *);
++
++/*
++ * Private methods of symlink file plugin
++ * (SYMLINK_FILE_PLUGIN_ID)
++ */
++int reiser4_create_symlink(struct inode *symlink, struct inode *dir,
++ reiser4_object_create_data *);
++void destroy_inode_symlink(struct inode *);
++
++/*
++ * all the write into unix file is performed by item write method. Write method
++ * of unix file plugin only decides which item plugin (extent or tail) and in
++ * which mode (one from the enum below) to call
++ */
++typedef enum {
++ FIRST_ITEM = 1,
++ APPEND_ITEM = 2,
++ OVERWRITE_ITEM = 3
++} write_mode_t;
++
++/* unix file may be in one the following states */
++typedef enum {
++ UF_CONTAINER_UNKNOWN = 0,
++ UF_CONTAINER_TAILS = 1,
++ UF_CONTAINER_EXTENTS = 2,
++ UF_CONTAINER_EMPTY = 3
++} file_container_t;
++
++struct formatting_plugin;
++struct inode;
++
++/* unix file plugin specific part of reiser4 inode */
++struct unix_file_info {
++ /*
++ * this read-write lock protects file containerization change. Accesses
++ * which do not change file containerization (see file_container_t)
++ * (read, readpage, writepage, write (until tail conversion is
++ * involved)) take read-lock. Accesses which modify file
++ * containerization (truncate, conversion from tail to extent and back)
++ * take write-lock.
++ */
++ struct rw_semaphore latch;
++ /* this enum specifies which items are used to build the file */
++ file_container_t container;
++ /*
++ * plugin which controls when file is to be converted to extents and
++ * back to tail
++ */
++ struct formatting_plugin *tplug;
++ /* if this is set, file is in exclusive use */
++ int exclusive_use;
++#if REISER4_DEBUG
++ /* pointer to task struct of thread owning exclusive access to file */
++ void *ea_owner;
++ atomic_t nr_neas;
++ void *last_reader;
++#endif
++};
++
++struct unix_file_info *unix_file_inode_data(const struct inode *inode);
++void get_exclusive_access(struct unix_file_info *);
++void drop_exclusive_access(struct unix_file_info *);
++void get_nonexclusive_access(struct unix_file_info *);
++void drop_nonexclusive_access(struct unix_file_info *);
++int try_to_get_nonexclusive_access(struct unix_file_info *);
++int find_file_item(hint_t *, const reiser4_key *, znode_lock_mode,
++ struct inode *);
++int find_file_item_nohint(coord_t *, lock_handle *,
++ const reiser4_key *, znode_lock_mode,
++ struct inode *);
++
++int load_file_hint(struct file *, hint_t *);
++void save_file_hint(struct file *, const hint_t *);
++
++#include "../item/extent.h"
++#include "../item/tail.h"
++#include "../item/ctail.h"
++
++struct uf_coord {
++ coord_t coord;
++ lock_handle *lh;
++ int valid;
++ union {
++ struct extent_coord_extension extent;
++ struct tail_coord_extension tail;
++ struct ctail_coord_extension ctail;
++ } extension;
++};
++
++#include "../../forward.h"
++#include "../../seal.h"
++#include "../../lock.h"
++
++/*
++ * This structure is used to speed up file operations (reads and writes). A
++ * hint is a suggestion about where a key resolved to last time. A seal
++ * indicates whether a node has been modified since a hint was last recorded.
++ * You check the seal, and if the seal is still valid, you can use the hint
++ * without traversing the tree again.
++ */
++struct hint {
++ seal_t seal; /* a seal over last file item accessed */
++ uf_coord_t ext_coord;
++ loff_t offset;
++ znode_lock_mode mode;
++ lock_handle lh;
++};
++
++static inline int hint_is_valid(hint_t * hint)
++{
++ return hint->ext_coord.valid;
++}
++
++static inline void hint_set_valid(hint_t * hint)
++{
++ hint->ext_coord.valid = 1;
++}
++
++static inline void hint_clr_valid(hint_t * hint)
++{
++ hint->ext_coord.valid = 0;
++}
++
++int load_file_hint(struct file *, hint_t *);
++void save_file_hint(struct file *, const hint_t *);
++void hint_init_zero(hint_t *);
++void reiser4_set_hint(hint_t *, const reiser4_key *, znode_lock_mode);
++int hint_is_set(const hint_t *);
++void reiser4_unset_hint(hint_t *);
++
++int reiser4_update_file_size(struct inode *, loff_t, int update_sd);
++int cut_file_items(struct inode *, loff_t new_size,
++ int update_sd, loff_t cur_size,
++ int (*update_actor) (struct inode *, loff_t, int));
++#if REISER4_DEBUG
++
++/* return 1 is exclusive access is obtained, 0 - otherwise */
++static inline int ea_obtained(struct unix_file_info * uf_info)
++{
++ int ret;
++
++ ret = down_read_trylock(&uf_info->latch);
++ if (ret)
++ up_read(&uf_info->latch);
++ return !ret;
++}
++
++#endif
++
++#define WRITE_GRANULARITY 32
++
++int tail2extent(struct unix_file_info *);
++int extent2tail(struct file *, struct unix_file_info *);
++
++int goto_right_neighbor(coord_t *, lock_handle *);
++int find_or_create_extent(struct page *);
++int equal_to_ldk(znode *, const reiser4_key *);
++
++void init_uf_coord(uf_coord_t *uf_coord, lock_handle *lh);
++
++static inline int cbk_errored(int cbk_result)
++{
++ return (cbk_result != CBK_COORD_NOTFOUND
++ && cbk_result != CBK_COORD_FOUND);
++}
++
++/* __REISER4_FILE_H__ */
++#endif
++
++/*
++ * Local variables:
++ * c-indentation-style: "K&R"
++ * mode-name: "LC"
++ * c-basic-offset: 8
++ * tab-width: 8
++ * fill-column: 79
++ * scroll-step: 1
++ * End:
++*/
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/file/Makefile linux-2.6.35/fs/reiser4/plugin/file/Makefile
+--- linux-2.6.35.orig/fs/reiser4/plugin/file/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/file/Makefile 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,7 @@
++obj-$(CONFIG_REISER4_FS) += file_plugins.o
++
++file_plugins-objs := \
++ file.o \
++ tail_conversion.o \
++ symlink.o \
++ cryptcompress.o
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/file/symfile.c linux-2.6.35/fs/reiser4/plugin/file/symfile.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/file/symfile.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/file/symfile.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,87 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ sophisticated symfile syntax that we are not planning to write for
+ version 4.0.
+*/
-diff -puN /dev/null fs/reiser4/plugin/file/symlink.c
---- /dev/null
-+++ a/fs/reiser4/plugin/file/symlink.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/file/symlink.c linux-2.6.35/fs/reiser4/plugin/file/symlink.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/file/symlink.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/file/symlink.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,95 @@
+/* Copyright 2002, 2003, 2005 by Hans Reiser, licensing governed by reiser4/README */
+
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/file/tail_conversion.c
---- /dev/null
-+++ a/fs/reiser4/plugin/file/tail_conversion.c
-@@ -0,0 +1,737 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/file/tail_conversion.c linux-2.6.35/fs/reiser4/plugin/file/tail_conversion.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/file/tail_conversion.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/file/tail_conversion.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,743 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+#include "../../inode.h"
+ * on partially converted files.
+ */
+ drop_exclusive_access(uf_info);
-+ /* throttle the conversion */
-+ reiser4_throttle_write(inode);
++ /* throttle the conversion
++ FIXME-EDWARD: Pass the precise number of pages
++ that was dirtied */
++ reiser4_throttle_write(inode, 1);
+ get_exclusive_access(uf_info);
+
+ /*
+ page_cache_release(page);
+
+ drop_exclusive_access(uf_info);
-+ /* throttle the conversion */
-+ reiser4_throttle_write(inode);
++ /*
++ * throttle the conversion.
++ * FIXME-EDWARD: Calculate and pass the precise number
++ * of pages that was dirtied
++ */
++ reiser4_throttle_write(inode, 1);
+ get_exclusive_access(uf_info);
+ /*
+ * nobody is allowed to complete conversion but a process which
+ * scroll-step: 1
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/plugin/file_ops.c
---- /dev/null
-+++ a/fs/reiser4/plugin/file_ops.c
-@@ -0,0 +1,205 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/file_ops.c linux-2.6.35/fs/reiser4/plugin/file_ops.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/file_ops.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/file_ops.c 2010-08-04 18:11:07.000000000 +0200
+@@ -0,0 +1,163 @@
+/* Copyright 2005 by Hans Reiser, licensing governed by
+ reiser4/README */
+
+/* this is common implementation of vfs's fsync method of struct
+ file_operations
+*/
-+int reiser4_sync_common(struct file *file, struct dentry *dentry, int datasync)
++int reiser4_sync_common(struct file *file, int datasync)
+{
+ reiser4_context *ctx;
+ int result;
++ struct dentry *dentry = file->f_path.dentry;
+
+ ctx = reiser4_init_context(dentry->d_inode->i_sb);
+ if (IS_ERR(ctx))
+ * filemap_fdatawrite() that will ultimately call reiser4_writepages(), insert
+ * all missing extents and capture anonymous pages.
+ */
-+int reiser4_sync_file_common(struct file *file,
-+ struct dentry *dentry, int datasync)
++int reiser4_sync_file_common(struct file *file, int datasync)
+{
+ reiser4_context *ctx;
+ txn_atom *atom;
+ reiser4_block_nr reserve;
++ struct dentry *dentry = file->f_path.dentry;
+
+ ctx = reiser4_init_context(dentry->d_inode->i_sb);
+ if (IS_ERR(ctx))
+ return 0;
+}
+
-+/* this is common implementation of vfs's sendfile method of struct
-+ file_operations
-+
-+ Reads @count bytes from @file and calls @actor for every page read. This is
-+ needed for loop back devices support.
-+*/
-+#if 0
-+ssize_t
-+sendfile_common(struct file *file, loff_t *ppos, size_t count,
-+ read_actor_t actor, void *target)
-+{
-+ reiser4_context *ctx;
-+ ssize_t result;
-+
-+ ctx = reiser4_init_context(file->f_dentry->d_inode->i_sb);
-+ if (IS_ERR(ctx))
-+ return PTR_ERR(ctx);
-+ result = generic_file_sendfile(file, ppos, count, actor, target);
-+ reiser4_exit_context(ctx);
-+ return result;
-+}
-+#endif /* 0 */
+
+/* address space operations */
+
-+/* this is common implementation of vfs's prepare_write method of struct
-+ address_space_operations
-+*/
-+int
-+prepare_write_common(struct file *file, struct page *page, unsigned from,
-+ unsigned to)
-+{
-+ reiser4_context *ctx;
-+ int result;
-+
-+ ctx = reiser4_init_context(page->mapping->host->i_sb);
-+ result = do_prepare_write(file, page, from, to);
+
-+ /* don't commit transaction under inode semaphore */
-+ context_set_commit_async(ctx);
-+ reiser4_exit_context(ctx);
-+
-+ return result;
-+}
-+
-+/* this is helper for prepare_write_common and prepare_write_unix_file
-+ */
-+int
-+do_prepare_write(struct file *file, struct page *page, unsigned from,
++/* this is helper for plugin->write_begin() */
++int do_prepare_write(struct file *file, struct page *page, unsigned from,
+ unsigned to)
+{
+ int result;
+ * scroll-step: 1
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/plugin/file_ops_readdir.c
---- /dev/null
-+++ a/fs/reiser4/plugin/file_ops_readdir.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/file_ops_readdir.c linux-2.6.35/fs/reiser4/plugin/file_ops_readdir.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/file_ops_readdir.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/file_ops_readdir.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,658 @@
+/* Copyright 2005 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ * fill-column: 79
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/plugin/file_plugin_common.c
---- /dev/null
-+++ a/fs/reiser4/plugin/file_plugin_common.c
-@@ -0,0 +1,1011 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/file_plugin_common.c linux-2.6.35/fs/reiser4/plugin/file_plugin_common.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/file_plugin_common.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/file_plugin_common.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,1008 @@
+/* Copyright 2005 by Hans Reiser, licensing governed by
+ reiser4/README */
+
+
+ object->i_mode = data->mode;
+ /* this should be plugin decision */
-+ object->i_uid = current_fsuid();
++ object->i_uid = current->cred->fsuid;
+ object->i_mtime = object->i_atime = object->i_ctime = CURRENT_TIME;
+
+ /* support for BSD style group-id assignment. See mount's manual page
+ /* sguid is inherited by sub-directories */
+ object->i_mode |= S_ISGID;
+ } else
-+ object->i_gid = current_fsgid();
++ object->i_gid = current->cred->fsgid;
+
+ /* this object doesn't have stat-data yet */
+ reiser4_inode_set_flag(object, REISER4_NO_SD);
+ if (!IS_ERR(inode)) {
+ reiser4_iget_complete(inode);
+ dentry = d_obtain_alias(inode);
-+ if (dentry == NULL) {
-+ iput(inode);
-+ dentry = ERR_PTR(-ENOMEM);
-+ } else
++ if (!IS_ERR(dentry))
+ dentry->d_op = &get_super_private(sb)->ops.dentry;
+ } else if (PTR_ERR(inode) == -ENOENT)
+ /*
+ if (!reiser4_inode_get_flag(inode, REISER4_NO_SD)) {
+ reiser4_key sd_key;
+
-+ DQUOT_FREE_INODE(inode);
-+ DQUOT_DROP(inode);
++ dquot_free_inode(inode);
++ dquot_drop(inode);
+
+ build_sd_key(inode, &sd_key);
+ result =
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/hash.c
---- /dev/null
-+++ a/fs/reiser4/plugin/hash.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/hash.c linux-2.6.35/fs/reiser4/plugin/hash.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/hash.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/hash.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,352 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/inode_ops.c
---- /dev/null
-+++ a/fs/reiser4/plugin/inode_ops.c
-@@ -0,0 +1,906 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/inode_ops.c linux-2.6.35/fs/reiser4/plugin/inode_ops.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/inode_ops.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/inode_ops.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,916 @@
+/*
+ * Copyright 2005 by Hans Reiser, licensing governed by reiser4/README
+ */
+ result = setattr_reserve(reiser4_tree_by_inode(inode));
+ if (!result) {
+ if ((attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid)
-+ || (attr->ia_valid & ATTR_GID
++BROKEN || (attr->ia_valid & ATTR_GID
+ && attr->ia_gid != inode->i_gid)) {
-+ result = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0;
++ result = dquot_transfer(inode, attr) ? -EDQUOT : 0;
+ if (result) {
+ context_set_commit_async(ctx);
+ reiser4_exit_context(ctx);
+ return result;
+ }
+ }
-+ result = inode_setattr(inode, attr);
-+ if (!result)
++
++ if ((attr->ia_valid & ATTR_SIZE) &&
++ attr->ia_size != i_size_read(inode))
++ result = vmtruncate(inode, attr->ia_size);
++BROKEN if (result)
++ goto result_error;
++ setattr_copy(inode, attr);
++ mark_inode_dirty(inode);
++ result = 0;
++
++
++result_error:
++ if (!result) {
+ reiser4_update_sd(inode);
++ }
+ }
+
+ context_set_commit_async(ctx);
+ /* So that on error iput will be called. */
+ *retobj = object;
+
-+ if (DQUOT_ALLOC_INODE(object)) {
-+ DQUOT_DROP(object);
++ if (dquot_alloc_inode(object)) {
++ dquot_drop(object);
+ object->i_flags |= S_NOQUOTA;
+ return RETERR(-EDQUOT);
+ }
+ if (result) {
+ warning("nikita-431", "Cannot install plugin %i on %llx",
+ data->id, (unsigned long long)get_inode_oid(object));
-+ DQUOT_FREE_INODE(object);
++ dquot_free_inode(object);
+ object->i_flags |= S_NOQUOTA;
+ return result;
+ }
+ obj_plug = inode_file_plugin(object);
+
+ if (obj_plug->create_object == NULL) {
-+ DQUOT_FREE_INODE(object);
++ dquot_free_inode(object);
+ object->i_flags |= S_NOQUOTA;
+ return RETERR(-EPERM);
+ }
+ warning("nikita-432", "Cannot inherit from %llx to %llx",
+ (unsigned long long)get_inode_oid(parent),
+ (unsigned long long)get_inode_oid(object));
-+ DQUOT_FREE_INODE(object);
++ dquot_free_inode(object);
+ object->i_flags |= S_NOQUOTA;
+ return result;
+ }
+ /* obtain directory plugin (if any) for new object. */
+ obj_dir = inode_dir_plugin(object);
+ if (obj_dir != NULL && obj_dir->init == NULL) {
-+ DQUOT_FREE_INODE(object);
++ dquot_free_inode(object);
+ object->i_flags |= S_NOQUOTA;
+ return RETERR(-EPERM);
+ }
+
+ reserve = estimate_create_vfs_object(parent, object);
+ if (reiser4_grab_space(reserve, BA_CAN_COMMIT)) {
-+ DQUOT_FREE_INODE(object);
++ dquot_free_inode(object);
+ object->i_flags |= S_NOQUOTA;
+ return RETERR(-ENOSPC);
+ }
+ warning("nikita-2219",
+ "Failed to create sd for %llu",
+ (unsigned long long)get_inode_oid(object));
-+ DQUOT_FREE_INODE(object);
++ dquot_free_inode(object);
+ object->i_flags |= S_NOQUOTA;
+ return result;
+ }
+ */
+ reiser4_update_sd(object);
+ if (result != 0) {
-+ DQUOT_FREE_INODE(object);
++ dquot_free_inode(object);
+ object->i_flags |= S_NOQUOTA;
+ /* if everything was ok (result == 0), parent stat-data is
+ * already updated above (update_parent_dir()) */
+ dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+ return reiser4_update_sd(dir);
+}
-diff -puN /dev/null fs/reiser4/plugin/inode_ops_rename.c
---- /dev/null
-+++ a/fs/reiser4/plugin/inode_ops_rename.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/inode_ops_rename.c linux-2.6.35/fs/reiser4/plugin/inode_ops_rename.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/inode_ops_rename.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/inode_ops_rename.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,925 @@
+/* Copyright 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ return result;
+}
+#endif
-diff -puN /dev/null fs/reiser4/plugin/item/Makefile
---- /dev/null
-+++ a/fs/reiser4/plugin/item/Makefile
-@@ -0,0 +1,18 @@
-+obj-$(CONFIG_REISER4_FS) += item_plugins.o
-+
-+item_plugins-objs := \
-+ item.o \
-+ static_stat.o \
-+ sde.o \
-+ cde.o \
-+ blackbox.o \
-+ internal.o \
-+ tail.o \
-+ ctail.o \
-+ extent.o \
-+ extent_item_ops.o \
-+ extent_file_ops.o \
-+ extent_flush_ops.o
-+
-+
-+
-diff -puN /dev/null fs/reiser4/plugin/item/acl.h
---- /dev/null
-+++ a/fs/reiser4/plugin/item/acl.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/acl.h linux-2.6.35/fs/reiser4/plugin/item/acl.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/acl.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/acl.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,66 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/blackbox.c
---- /dev/null
-+++ a/fs/reiser4/plugin/item/blackbox.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/blackbox.c linux-2.6.35/fs/reiser4/plugin/item/blackbox.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/blackbox.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/blackbox.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,142 @@
+/* Copyright 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/blackbox.h
---- /dev/null
-+++ a/fs/reiser4/plugin/item/blackbox.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/blackbox.h linux-2.6.35/fs/reiser4/plugin/item/blackbox.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/blackbox.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/blackbox.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,33 @@
+/* Copyright 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/cde.c
---- /dev/null
-+++ a/fs/reiser4/plugin/item/cde.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/cde.c linux-2.6.35/fs/reiser4/plugin/item/cde.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/cde.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/cde.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,1008 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ data.length = estimate_cde(result ? coord : NULL, &data);
+
+ /* NOTE-NIKITA quota plugin? */
-+ if (DQUOT_ALLOC_SPACE_NODIRTY(dir, cde_bytes(result, &data)))
++ if (dquot_alloc_space_nodirty(dir, cde_bytes(result, &data)))
+ return RETERR(-EDQUOT);
+
+ if (result)
+ kill_node_content(coord, &shadow, NULL, NULL, NULL, NULL, NULL, 0);
+ if (result == 0) {
+ /* NOTE-NIKITA quota plugin? */
-+ DQUOT_FREE_SPACE_NODIRTY(dir, length);
++ dquot_free_space_nodirty(dir, length);
+ }
+ return result;
+}
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/cde.h
---- /dev/null
-+++ a/fs/reiser4/plugin/item/cde.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/cde.h linux-2.6.35/fs/reiser4/plugin/item/cde.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/cde.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/cde.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,87 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/ctail.c
---- /dev/null
-+++ a/fs/reiser4/plugin/item/ctail.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/ctail.c linux-2.6.35/fs/reiser4/plugin/item/ctail.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/ctail.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/ctail.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,1613 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/ctail.h
---- /dev/null
-+++ a/fs/reiser4/plugin/item/ctail.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/ctail.h linux-2.6.35/fs/reiser4/plugin/item/ctail.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/ctail.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/ctail.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,102 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/extent.c
---- /dev/null
-+++ a/fs/reiser4/plugin/item/extent.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/extent.c linux-2.6.35/fs/reiser4/plugin/item/extent.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/extent.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/extent.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,197 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ * scroll-step: 1
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/plugin/item/extent.h
---- /dev/null
-+++ a/fs/reiser4/plugin/item/extent.h
-@@ -0,0 +1,231 @@
-+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
-+
-+#ifndef __REISER4_EXTENT_H__
-+#define __REISER4_EXTENT_H__
-+
-+/* on disk extent */
-+typedef struct {
-+ reiser4_dblock_nr start;
-+ reiser4_dblock_nr width;
-+} reiser4_extent;
-+
-+struct extent_stat {
-+ int unallocated_units;
-+ int unallocated_blocks;
-+ int allocated_units;
-+ int allocated_blocks;
-+ int hole_units;
-+ int hole_blocks;
-+};
-+
-+/* extents in an extent item can be either holes, or unallocated or allocated
-+ extents */
-+typedef enum {
-+ HOLE_EXTENT,
-+ UNALLOCATED_EXTENT,
-+ ALLOCATED_EXTENT
-+} extent_state;
-+
-+#define HOLE_EXTENT_START 0
-+#define UNALLOCATED_EXTENT_START 1
-+#define UNALLOCATED_EXTENT_START2 2
-+
-+struct extent_coord_extension {
-+ reiser4_block_nr pos_in_unit;
-+ reiser4_block_nr width; /* width of current unit */
-+ pos_in_node_t nr_units; /* number of units */
-+ int ext_offset; /* offset from the beginning of zdata() */
-+ unsigned long expected_page;
-+#if REISER4_DEBUG
-+ reiser4_extent extent;
-+#endif
-+};
-+
-+/* macros to set/get fields of on-disk extent */
-+static inline reiser4_block_nr extent_get_start(const reiser4_extent * ext)
-+{
-+ return le64_to_cpu(ext->start);
-+}
-+
-+static inline reiser4_block_nr extent_get_width(const reiser4_extent * ext)
-+{
-+ return le64_to_cpu(ext->width);
-+}
-+
-+extern __u64 reiser4_current_block_count(void);
-+
-+static inline void
-+extent_set_start(reiser4_extent * ext, reiser4_block_nr start)
-+{
-+ cassert(sizeof(ext->start) == 8);
-+ assert("nikita-2510",
-+ ergo(start > 1, start < reiser4_current_block_count()));
-+ put_unaligned(cpu_to_le64(start), &ext->start);
-+}
-+
-+static inline void
-+extent_set_width(reiser4_extent * ext, reiser4_block_nr width)
-+{
-+ cassert(sizeof(ext->width) == 8);
-+ assert("", width > 0);
-+ put_unaligned(cpu_to_le64(width), &ext->width);
-+ assert("nikita-2511",
-+ ergo(extent_get_start(ext) > 1,
-+ extent_get_start(ext) + width <=
-+ reiser4_current_block_count()));
-+}
-+
-+#define extent_item(coord) \
-+({ \
-+ assert("nikita-3143", item_is_extent(coord)); \
-+ ((reiser4_extent *)item_body_by_coord (coord)); \
-+})
-+
-+#define extent_by_coord(coord) \
-+({ \
-+ assert("nikita-3144", item_is_extent(coord)); \
-+ (extent_item (coord) + (coord)->unit_pos); \
-+})
-+
-+#define width_by_coord(coord) \
-+({ \
-+ assert("nikita-3145", item_is_extent(coord)); \
-+ extent_get_width (extent_by_coord(coord)); \
-+})
-+
-+struct carry_cut_data;
-+struct carry_kill_data;
-+
-+/* plugin->u.item.b.* */
-+reiser4_key *max_key_inside_extent(const coord_t *, reiser4_key *);
-+int can_contain_key_extent(const coord_t * coord, const reiser4_key * key,
-+ const reiser4_item_data *);
-+int mergeable_extent(const coord_t * p1, const coord_t * p2);
-+pos_in_node_t nr_units_extent(const coord_t *);
-+lookup_result lookup_extent(const reiser4_key *, lookup_bias, coord_t *);
-+void init_coord_extent(coord_t *);
-+int init_extent(coord_t *, reiser4_item_data *);
-+int paste_extent(coord_t *, reiser4_item_data *, carry_plugin_info *);
-+int can_shift_extent(unsigned free_space,
-+ coord_t * source, znode * target, shift_direction,
-+ unsigned *size, unsigned want);
-+void copy_units_extent(coord_t * target, coord_t * source, unsigned from,
-+ unsigned count, shift_direction where_is_free_space,
-+ unsigned free_space);
-+int kill_hook_extent(const coord_t *, pos_in_node_t from, pos_in_node_t count,
-+ struct carry_kill_data *);
-+int create_hook_extent(const coord_t * coord, void *arg);
-+int cut_units_extent(coord_t * coord, pos_in_node_t from, pos_in_node_t to,
-+ struct carry_cut_data *, reiser4_key * smallest_removed,
-+ reiser4_key * new_first);
-+int kill_units_extent(coord_t * coord, pos_in_node_t from, pos_in_node_t to,
-+ struct carry_kill_data *, reiser4_key * smallest_removed,
-+ reiser4_key * new_first);
-+reiser4_key *unit_key_extent(const coord_t *, reiser4_key *);
-+reiser4_key *max_unit_key_extent(const coord_t *, reiser4_key *);
-+void print_extent(const char *, coord_t *);
-+int utmost_child_extent(const coord_t * coord, sideof side, jnode ** child);
-+int utmost_child_real_block_extent(const coord_t * coord, sideof side,
-+ reiser4_block_nr * block);
-+void item_stat_extent(const coord_t * coord, void *vp);
-+int reiser4_check_extent(const coord_t * coord, const char **error);
-+
-+/* plugin->u.item.s.file.* */
-+ssize_t reiser4_write_extent(struct file *, struct inode * inode,
-+ const char __user *, size_t, loff_t *);
-+int reiser4_read_extent(struct file *, flow_t *, hint_t *);
-+int reiser4_readpage_extent(void *, struct page *);
-+int reiser4_do_readpage_extent(reiser4_extent*, reiser4_block_nr, struct page*);
-+reiser4_key *append_key_extent(const coord_t *, reiser4_key *);
-+void init_coord_extension_extent(uf_coord_t *, loff_t offset);
-+int get_block_address_extent(const coord_t *, sector_t block,
-+ sector_t * result);
-+
-+/* these are used in flush.c
-+ FIXME-VS: should they be somewhere in item_plugin? */
-+int allocate_extent_item_in_place(coord_t *, lock_handle *, flush_pos_t * pos);
-+int allocate_and_copy_extent(znode * left, coord_t * right, flush_pos_t * pos,
-+ reiser4_key * stop_key);
-+
-+int extent_is_unallocated(const coord_t * item); /* True if this extent is unallocated (i.e., not a hole, not allocated). */
-+__u64 extent_unit_index(const coord_t * item); /* Block offset of this unit. */
-+__u64 extent_unit_width(const coord_t * item); /* Number of blocks in this unit. */
-+
-+/* plugin->u.item.f. */
-+int reiser4_scan_extent(flush_scan * scan);
-+extern int key_by_offset_extent(struct inode *, loff_t, reiser4_key *);
-+
-+reiser4_item_data *init_new_extent(reiser4_item_data * data, void *ext_unit,
-+ int nr_extents);
-+reiser4_block_nr reiser4_extent_size(const coord_t * coord, pos_in_node_t nr);
-+extent_state state_of_extent(reiser4_extent * ext);
-+void reiser4_set_extent(reiser4_extent *, reiser4_block_nr start,
-+ reiser4_block_nr width);
-+int reiser4_update_extent(struct inode *, jnode *, loff_t pos,
-+ int *plugged_hole);
-+
-+#include "../../coord.h"
-+#include "../../lock.h"
-+#include "../../tap.h"
-+
-+struct replace_handle {
-+ /* these are to be set before calling reiser4_replace_extent */
-+ coord_t *coord;
-+ lock_handle *lh;
-+ reiser4_key key;
-+ reiser4_key *pkey;
-+ reiser4_extent overwrite;
-+ reiser4_extent new_extents[2];
-+ int nr_new_extents;
-+ unsigned flags;
-+
-+ /* these are used by reiser4_replace_extent */
-+ reiser4_item_data item;
-+ coord_t coord_after;
-+ lock_handle lh_after;
-+ tap_t watch;
-+ reiser4_key paste_key;
-+#if REISER4_DEBUG
-+ reiser4_extent orig_ext;
-+ reiser4_key tmp;
-+#endif
-+};
-+
-+/* this structure is kmalloced before calling make_extent to avoid excessive
-+ stack consumption on plug_hole->reiser4_replace_extent */
-+struct make_extent_handle {
-+ uf_coord_t *uf_coord;
-+ reiser4_block_nr blocknr;
-+ int created;
-+ struct inode *inode;
-+ union {
-+ struct {
-+ } append;
-+ struct replace_handle replace;
-+ } u;
-+};
-+
-+int reiser4_replace_extent(struct replace_handle *,
-+ int return_inserted_position);
-+lock_handle *znode_lh(znode *);
-+
-+/* the reiser4 repacker support */
-+struct repacker_cursor;
-+extern int process_extent_backward_for_repacking(tap_t *,
-+ struct repacker_cursor *);
-+extern int mark_extent_for_repacking(tap_t *, int);
-+
-+#define coord_by_uf_coord(uf_coord) (&((uf_coord)->coord))
-+#define ext_coord_by_uf_coord(uf_coord) (&((uf_coord)->extension.extent))
-+
-+/* __REISER4_EXTENT_H__ */
-+#endif
-+/*
-+ Local variables:
-+ c-indentation-style: "K&R"
-+ mode-name: "LC"
-+ c-basic-offset: 8
-+ tab-width: 8
-+ fill-column: 120
-+ End:
-+*/
-diff -puN /dev/null fs/reiser4/plugin/item/extent_file_ops.c
---- /dev/null
-+++ a/fs/reiser4/plugin/item/extent_file_ops.c
-@@ -0,0 +1,1450 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/extent_file_ops.c linux-2.6.35/fs/reiser4/plugin/item/extent_file_ops.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/extent_file_ops.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/extent_file_ops.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,1453 @@
+/* COPYRIGHT 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+#include "item.h"
+
+ assert("", get_key_offset(key) == (loff_t)index_jnode(jnodes[0]) * PAGE_CACHE_SIZE);
+
-+ result = DQUOT_ALLOC_BLOCK_NODIRTY(mapping_jnode(jnodes[0])->host,
++ result = dquot_alloc_block_nodirty(mapping_jnode(jnodes[0])->host,
+ count);
+ BUG_ON(result != 0);
+
+ if (count == 0)
+ return 0;
+
-+ result = DQUOT_ALLOC_BLOCK_NODIRTY(mapping_jnode(jnodes[0])->host, count);
++ result = dquot_alloc_block_nodirty(mapping_jnode(jnodes[0])->host,
++ count);
+ BUG_ON(result != 0);
+
+ /*
+ break;
+
+ case HOLE_EXTENT:
-+ result = DQUOT_ALLOC_BLOCK_NODIRTY(mapping_jnode(node)->host, 1);
++ result = dquot_alloc_block_nodirty(mapping_jnode(node)->host,
++ 1);
+ BUG_ON(result != 0);
+ result = plug_hole(uf_coord, key, &how);
+ if (result)
+
+ lock_page(page);
+ if (!PageUptodate(page) && to_page != PAGE_CACHE_SIZE)
-+ simple_prepare_write(file, page, page_off,
-+ page_off + to_page);
++ zero_user_segments(page, 0, page_off,
++ page_off + to_page,
++ PAGE_CACHE_SIZE);
+
+ written = filemap_copy_from_user(page, page_off, buf, to_page);
+ if (unlikely(written != to_page)) {
+ }
+
+ flush_dcache_page(page);
-+ reiser4_set_page_dirty_internal(page);
++ set_page_dirty_notag(page);
+ unlock_page(page);
+ nr_dirty++;
+
+ * scroll-step: 1
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/plugin/item/extent_flush_ops.c
---- /dev/null
-+++ a/fs/reiser4/plugin/item/extent_flush_ops.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/extent_flush_ops.c linux-2.6.35/fs/reiser4/plugin/item/extent_flush_ops.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/extent_flush_ops.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/extent_flush_ops.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,1028 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ * scroll-step: 1
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/plugin/item/extent_item_ops.c
---- /dev/null
-+++ a/fs/reiser4/plugin/item/extent_item_ops.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/extent.h linux-2.6.35/fs/reiser4/plugin/item/extent.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/extent.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/extent.h 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,231 @@
++/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
++
++#ifndef __REISER4_EXTENT_H__
++#define __REISER4_EXTENT_H__
++
++/* on disk extent */
++typedef struct {
++ reiser4_dblock_nr start;
++ reiser4_dblock_nr width;
++} reiser4_extent;
++
++struct extent_stat {
++ int unallocated_units;
++ int unallocated_blocks;
++ int allocated_units;
++ int allocated_blocks;
++ int hole_units;
++ int hole_blocks;
++};
++
++/* extents in an extent item can be either holes, or unallocated or allocated
++ extents */
++typedef enum {
++ HOLE_EXTENT,
++ UNALLOCATED_EXTENT,
++ ALLOCATED_EXTENT
++} extent_state;
++
++#define HOLE_EXTENT_START 0
++#define UNALLOCATED_EXTENT_START 1
++#define UNALLOCATED_EXTENT_START2 2
++
++struct extent_coord_extension {
++ reiser4_block_nr pos_in_unit;
++ reiser4_block_nr width; /* width of current unit */
++ pos_in_node_t nr_units; /* number of units */
++ int ext_offset; /* offset from the beginning of zdata() */
++ unsigned long expected_page;
++#if REISER4_DEBUG
++ reiser4_extent extent;
++#endif
++};
++
++/* macros to set/get fields of on-disk extent */
++static inline reiser4_block_nr extent_get_start(const reiser4_extent * ext)
++{
++ return le64_to_cpu(ext->start);
++}
++
++static inline reiser4_block_nr extent_get_width(const reiser4_extent * ext)
++{
++ return le64_to_cpu(ext->width);
++}
++
++extern __u64 reiser4_current_block_count(void);
++
++static inline void
++extent_set_start(reiser4_extent * ext, reiser4_block_nr start)
++{
++ cassert(sizeof(ext->start) == 8);
++ assert("nikita-2510",
++ ergo(start > 1, start < reiser4_current_block_count()));
++ put_unaligned(cpu_to_le64(start), &ext->start);
++}
++
++static inline void
++extent_set_width(reiser4_extent * ext, reiser4_block_nr width)
++{
++ cassert(sizeof(ext->width) == 8);
++ assert("", width > 0);
++ put_unaligned(cpu_to_le64(width), &ext->width);
++ assert("nikita-2511",
++ ergo(extent_get_start(ext) > 1,
++ extent_get_start(ext) + width <=
++ reiser4_current_block_count()));
++}
++
++#define extent_item(coord) \
++({ \
++ assert("nikita-3143", item_is_extent(coord)); \
++ ((reiser4_extent *)item_body_by_coord (coord)); \
++})
++
++#define extent_by_coord(coord) \
++({ \
++ assert("nikita-3144", item_is_extent(coord)); \
++ (extent_item (coord) + (coord)->unit_pos); \
++})
++
++#define width_by_coord(coord) \
++({ \
++ assert("nikita-3145", item_is_extent(coord)); \
++ extent_get_width (extent_by_coord(coord)); \
++})
++
++struct carry_cut_data;
++struct carry_kill_data;
++
++/* plugin->u.item.b.* */
++reiser4_key *max_key_inside_extent(const coord_t *, reiser4_key *);
++int can_contain_key_extent(const coord_t * coord, const reiser4_key * key,
++ const reiser4_item_data *);
++int mergeable_extent(const coord_t * p1, const coord_t * p2);
++pos_in_node_t nr_units_extent(const coord_t *);
++lookup_result lookup_extent(const reiser4_key *, lookup_bias, coord_t *);
++void init_coord_extent(coord_t *);
++int init_extent(coord_t *, reiser4_item_data *);
++int paste_extent(coord_t *, reiser4_item_data *, carry_plugin_info *);
++int can_shift_extent(unsigned free_space,
++ coord_t * source, znode * target, shift_direction,
++ unsigned *size, unsigned want);
++void copy_units_extent(coord_t * target, coord_t * source, unsigned from,
++ unsigned count, shift_direction where_is_free_space,
++ unsigned free_space);
++int kill_hook_extent(const coord_t *, pos_in_node_t from, pos_in_node_t count,
++ struct carry_kill_data *);
++int create_hook_extent(const coord_t * coord, void *arg);
++int cut_units_extent(coord_t * coord, pos_in_node_t from, pos_in_node_t to,
++ struct carry_cut_data *, reiser4_key * smallest_removed,
++ reiser4_key * new_first);
++int kill_units_extent(coord_t * coord, pos_in_node_t from, pos_in_node_t to,
++ struct carry_kill_data *, reiser4_key * smallest_removed,
++ reiser4_key * new_first);
++reiser4_key *unit_key_extent(const coord_t *, reiser4_key *);
++reiser4_key *max_unit_key_extent(const coord_t *, reiser4_key *);
++void print_extent(const char *, coord_t *);
++int utmost_child_extent(const coord_t * coord, sideof side, jnode ** child);
++int utmost_child_real_block_extent(const coord_t * coord, sideof side,
++ reiser4_block_nr * block);
++void item_stat_extent(const coord_t * coord, void *vp);
++int reiser4_check_extent(const coord_t * coord, const char **error);
++
++/* plugin->u.item.s.file.* */
++ssize_t reiser4_write_extent(struct file *, struct inode * inode,
++ const char __user *, size_t, loff_t *);
++int reiser4_read_extent(struct file *, flow_t *, hint_t *);
++int reiser4_readpage_extent(void *, struct page *);
++int reiser4_do_readpage_extent(reiser4_extent*, reiser4_block_nr, struct page*);
++reiser4_key *append_key_extent(const coord_t *, reiser4_key *);
++void init_coord_extension_extent(uf_coord_t *, loff_t offset);
++int get_block_address_extent(const coord_t *, sector_t block,
++ sector_t * result);
++
++/* these are used in flush.c
++ FIXME-VS: should they be somewhere in item_plugin? */
++int allocate_extent_item_in_place(coord_t *, lock_handle *, flush_pos_t * pos);
++int allocate_and_copy_extent(znode * left, coord_t * right, flush_pos_t * pos,
++ reiser4_key * stop_key);
++
++int extent_is_unallocated(const coord_t * item); /* True if this extent is unallocated (i.e., not a hole, not allocated). */
++__u64 extent_unit_index(const coord_t * item); /* Block offset of this unit. */
++__u64 extent_unit_width(const coord_t * item); /* Number of blocks in this unit. */
++
++/* plugin->u.item.f. */
++int reiser4_scan_extent(flush_scan * scan);
++extern int key_by_offset_extent(struct inode *, loff_t, reiser4_key *);
++
++reiser4_item_data *init_new_extent(reiser4_item_data * data, void *ext_unit,
++ int nr_extents);
++reiser4_block_nr reiser4_extent_size(const coord_t * coord, pos_in_node_t nr);
++extent_state state_of_extent(reiser4_extent * ext);
++void reiser4_set_extent(reiser4_extent *, reiser4_block_nr start,
++ reiser4_block_nr width);
++int reiser4_update_extent(struct inode *, jnode *, loff_t pos,
++ int *plugged_hole);
++
++#include "../../coord.h"
++#include "../../lock.h"
++#include "../../tap.h"
++
++struct replace_handle {
++ /* these are to be set before calling reiser4_replace_extent */
++ coord_t *coord;
++ lock_handle *lh;
++ reiser4_key key;
++ reiser4_key *pkey;
++ reiser4_extent overwrite;
++ reiser4_extent new_extents[2];
++ int nr_new_extents;
++ unsigned flags;
++
++ /* these are used by reiser4_replace_extent */
++ reiser4_item_data item;
++ coord_t coord_after;
++ lock_handle lh_after;
++ tap_t watch;
++ reiser4_key paste_key;
++#if REISER4_DEBUG
++ reiser4_extent orig_ext;
++ reiser4_key tmp;
++#endif
++};
++
++/* this structure is kmalloced before calling make_extent to avoid excessive
++ stack consumption on plug_hole->reiser4_replace_extent */
++struct make_extent_handle {
++ uf_coord_t *uf_coord;
++ reiser4_block_nr blocknr;
++ int created;
++ struct inode *inode;
++ union {
++ struct {
++ } append;
++ struct replace_handle replace;
++ } u;
++};
++
++int reiser4_replace_extent(struct replace_handle *,
++ int return_inserted_position);
++lock_handle *znode_lh(znode *);
++
++/* the reiser4 repacker support */
++struct repacker_cursor;
++extern int process_extent_backward_for_repacking(tap_t *,
++ struct repacker_cursor *);
++extern int mark_extent_for_repacking(tap_t *, int);
++
++#define coord_by_uf_coord(uf_coord) (&((uf_coord)->coord))
++#define ext_coord_by_uf_coord(uf_coord) (&((uf_coord)->extension.extent))
++
++/* __REISER4_EXTENT_H__ */
++#endif
++/*
++ Local variables:
++ c-indentation-style: "K&R"
++ mode-name: "LC"
++ c-basic-offset: 8
++ tab-width: 8
++ fill-column: 120
++ End:
++*/
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/extent_item_ops.c linux-2.6.35/fs/reiser4/plugin/item/extent_item_ops.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/extent_item_ops.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/extent_item_ops.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,889 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ length = to_off - offset;
+ }
+
-+ DQUOT_FREE_BLOCK_NODIRTY(inode, length);
++ dquot_free_block_nodirty(inode, length);
+
+ if (state_of_extent(ext) == UNALLOCATED_EXTENT) {
+ /* some jnodes corresponding to this unallocated extent */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/internal.c
---- /dev/null
-+++ a/fs/reiser4/plugin/item/internal.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/internal.c linux-2.6.35/fs/reiser4/plugin/item/internal.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/internal.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/internal.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,404 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ assert("nikita-1225", count == 1);
+
+ child = znode_at(item, item->node);
++ if (child == NULL)
++ return 0;
+ if (IS_ERR(child))
+ return PTR_ERR(child);
-+ assert("edward-1560", child != NULL);
-+
+ result = zload(child);
+ if (result) {
+ zput(child);
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/internal.h
---- /dev/null
-+++ a/fs/reiser4/plugin/item/internal.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/internal.h linux-2.6.35/fs/reiser4/plugin/item/internal.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/internal.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/internal.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,57 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+/* Internal item contains down-link to the child of the internal/twig
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/item.c
---- /dev/null
-+++ a/fs/reiser4/plugin/item/item.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/item.c linux-2.6.35/fs/reiser4/plugin/item/item.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/item.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/item.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,719 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/item.h
---- /dev/null
-+++ a/fs/reiser4/plugin/item/item.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/item.h linux-2.6.35/fs/reiser4/plugin/item/item.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/item.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/item.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,398 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+
+/* operations specific to items regular (unix) file metadata are built of */
+struct file_iops{
-+ int (*write) (struct file *, struct inode *,
-+ const char __user *, size_t, loff_t *pos);
++ ssize_t (*write) (struct file *, struct inode *,
++ const char __user *, size_t, loff_t *pos);
+ int (*read) (struct file *, flow_t *, hint_t *);
+ int (*readpage) (void *, struct page *);
+ int (*get_block) (const coord_t *, sector_t, sector_t *);
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/sde.c
---- /dev/null
-+++ a/fs/reiser4/plugin/item/sde.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/Makefile linux-2.6.35/fs/reiser4/plugin/item/Makefile
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/Makefile 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,18 @@
++obj-$(CONFIG_REISER4_FS) += item_plugins.o
++
++item_plugins-objs := \
++ item.o \
++ static_stat.o \
++ sde.o \
++ cde.o \
++ blackbox.o \
++ internal.o \
++ tail.o \
++ ctail.o \
++ extent.o \
++ extent_item_ops.o \
++ extent_file_ops.o \
++ extent_flush_ops.o
++
++
++
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/sde.c linux-2.6.35/fs/reiser4/plugin/item/sde.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/sde.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/sde.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,190 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ data.iplug = item_plugin_by_id(SIMPLE_DIR_ENTRY_ID);
+
+ /* NOTE-NIKITA quota plugin */
-+ if (DQUOT_ALLOC_SPACE_NODIRTY(dir, data.length))
++ if (dquot_alloc_space_nodirty(dir, data.length))
+ return -EDQUOT;
+
+ result = insert_by_coord(coord, &data, &entry->key, lh, 0 /*flags */ );
+ kill_node_content(coord, &shadow, NULL, NULL, NULL, NULL, NULL, 0);
+ if (result == 0) {
+ /* NOTE-NIKITA quota plugin */
-+ DQUOT_FREE_SPACE_NODIRTY(dir, length);
++ dquot_free_space_nodirty(dir, length);
+ }
+ return result;
+}
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/sde.h
---- /dev/null
-+++ a/fs/reiser4/plugin/item/sde.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/sde.h linux-2.6.35/fs/reiser4/plugin/item/sde.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/sde.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/sde.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,66 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/static_stat.c
---- /dev/null
-+++ a/fs/reiser4/plugin/item/static_stat.c
-@@ -0,0 +1,1107 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/static_stat.c linux-2.6.35/fs/reiser4/plugin/item/static_stat.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/static_stat.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/static_stat.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,1114 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+/* stat data manipulation. */
+
+ sdplug = sd_ext_plugin_by_id(bit);
+ assert("nikita-633", sdplug != NULL);
-+ /* no aligment support
-+ result +=
-+ round_up( result, sdplug -> alignment ) - result; */
++ /*
++ no aligment support
++ result +=
++ reiser4_round_up(result, sdplug -> alignment) -
++ result;
++ */
+ result += sdplug->save_len(inode);
+ }
+ }
+ info->heir_mask & (1 << memb)) {
+ len += sizeof(reiser4_plugin_slot);
+ if (plugin->h.pops && plugin->h.pops->save_len != NULL) {
-+ /* non-standard plugin, call method */
-+ /* commented as it is incompatible with alignment
-+ * policy in save_plug() -edward */
-+ /* len = round_up(len, plugin->h.pops->alignment); */
++ /*
++ * non-standard plugin, call method
++ * commented as it is incompatible with alignment
++ * policy in save_plug() -edward
++ *
++ * len = reiser4_round_up(len,
++ * plugin->h.pops->alignment);
++ */
+ len += plugin->h.pops->save_len(inode, plugin);
+ }
+ }
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/static_stat.h
---- /dev/null
-+++ a/fs/reiser4/plugin/item/static_stat.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/static_stat.h linux-2.6.35/fs/reiser4/plugin/item/static_stat.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/static_stat.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/static_stat.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,224 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/item/tail.c
---- /dev/null
-+++ a/fs/reiser4/plugin/item/tail.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/tail.c linux-2.6.35/fs/reiser4/plugin/item/tail.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/tail.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/tail.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,807 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ * were real data which are all zeros. Therefore we have to
+ * allocate quota here as well
+ */
-+ if (DQUOT_ALLOC_SPACE_NODIRTY(inode, flow->length))
++ if (dquot_alloc_space_nodirty(inode, flow->length))
+ return RETERR(-EDQUOT);
+ result = reiser4_insert_flow(coord, lh, flow);
+ if (flow->length)
-+ DQUOT_FREE_SPACE_NODIRTY(inode, flow->length);
++ dquot_free_space_nodirty(inode, flow->length);
+
+ uf_info = unix_file_inode_data(inode);
+
+ }
+
+ /* check quota before appending data */
-+ if (DQUOT_ALLOC_SPACE_NODIRTY(inode, flow->length))
++ if (dquot_alloc_space_nodirty(inode, flow->length))
+ return RETERR(-EDQUOT);
+
+ to_write = flow->length;
+ result = reiser4_insert_flow(coord, lh, flow);
+ if (flow->length)
-+ DQUOT_FREE_SPACE_NODIRTY(inode, flow->length);
++ dquot_free_space_nodirty(inode, flow->length);
+ return (to_write - flow->length) ? (to_write - flow->length) : result;
+}
+
+ * were real data which are all zeros. Therefore we have to
+ * allocate quota here as well
+ */
-+ if (DQUOT_ALLOC_SPACE_NODIRTY(inode, flow->length))
++ if (dquot_alloc_space_nodirty(inode, flow->length))
+ return RETERR(-EDQUOT);
+ result = reiser4_insert_flow(coord, lh, flow);
+ if (flow->length)
-+ DQUOT_FREE_SPACE_NODIRTY(inode, flow->length);
++ dquot_free_space_nodirty(inode, flow->length);
+ return result;
+ }
+
+ /* check quota before appending data */
-+ if (DQUOT_ALLOC_SPACE_NODIRTY(inode, flow->length))
++ if (dquot_alloc_space_nodirty(inode, flow->length))
+ return RETERR(-EDQUOT);
+
+ to_write = flow->length;
+ result = reiser4_insert_flow(coord, lh, flow);
+ if (flow->length)
-+ DQUOT_FREE_SPACE_NODIRTY(inode, flow->length);
++ dquot_free_space_nodirty(inode, flow->length);
+ return (to_write - flow->length) ? (to_write - flow->length) : result;
+}
+
+ * scroll-step: 1
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/plugin/item/tail.h
---- /dev/null
-+++ a/fs/reiser4/plugin/item/tail.h
-@@ -0,0 +1,58 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/item/tail.h linux-2.6.35/fs/reiser4/plugin/item/tail.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/item/tail.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/item/tail.h 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,56 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+#if !defined( __REISER4_TAIL_H__ )
+reiser4_key *append_key_tail(const coord_t *, reiser4_key *);
+void init_coord_extension_tail(uf_coord_t *, loff_t offset);
+int get_block_address_tail(const coord_t *, sector_t, sector_t *);
-+int item_balance_dirty_pages(struct address_space *, const flow_t *,
-+ hint_t *, int back_to_dirty, int set_hint);
+
+/* __REISER4_TAIL_H__ */
+#endif
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/node/Makefile
---- /dev/null
-+++ a/fs/reiser4/plugin/node/Makefile
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/Makefile linux-2.6.35/fs/reiser4/plugin/Makefile
+--- linux-2.6.35.orig/fs/reiser4/plugin/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/Makefile 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,26 @@
++obj-$(CONFIG_REISER4_FS) += plugins.o
++
++plugins-objs := \
++ plugin.o \
++ plugin_set.o \
++ object.o \
++ inode_ops.o \
++ inode_ops_rename.o \
++ file_ops.o \
++ file_ops_readdir.o \
++ file_plugin_common.o \
++ dir_plugin_common.o \
++ digest.o \
++ hash.o \
++ fibration.o \
++ tail_policy.o \
++ regular.o
++
++obj-$(CONFIG_REISER4_FS) += item/
++obj-$(CONFIG_REISER4_FS) += file/
++obj-$(CONFIG_REISER4_FS) += dir/
++obj-$(CONFIG_REISER4_FS) += node/
++obj-$(CONFIG_REISER4_FS) += compress/
++obj-$(CONFIG_REISER4_FS) += space/
++obj-$(CONFIG_REISER4_FS) += disk_format/
++obj-$(CONFIG_REISER4_FS) += security/
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/node/Makefile linux-2.6.35/fs/reiser4/plugin/node/Makefile
+--- linux-2.6.35.orig/fs/reiser4/plugin/node/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/node/Makefile 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,5 @@
+obj-$(CONFIG_REISER4_FS) += node_plugins.o
+
+node_plugins-objs := \
+ node.o \
+ node40.o
-diff -puN /dev/null fs/reiser4/plugin/node/node.c
---- /dev/null
-+++ a/fs/reiser4/plugin/node/node.c
-@@ -0,0 +1,131 @@
-+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
-+
-+/* Node plugin interface.
-+
-+ Description: The tree provides the abstraction of flows, which it
-+ internally fragments into items which it stores in nodes.
-+
-+ A key_atom is a piece of data bound to a single key.
-+
-+ For reasonable space efficiency to be achieved it is often
-+ necessary to store key_atoms in the nodes in the form of items, where
-+ an item is a sequence of key_atoms of the same or similar type. It is
-+ more space-efficient, because the item can implement (very)
-+ efficient compression of key_atom's bodies using internal knowledge
-+ about their semantics, and it can often avoid having a key for each
-+ key_atom. Each type of item has specific operations implemented by its
-+ item handler (see balance.c).
-+
-+ Rationale: the rest of the code (specifically balancing routines)
-+ accesses leaf level nodes through this interface. This way we can
-+ implement various block layouts and even combine various layouts
-+ within the same tree. Balancing/allocating algorithms should not
-+ care about peculiarities of splitting/merging specific item types,
-+ but rather should leave that to the item's item handler.
-+
-+ Items, including those that provide the abstraction of flows, have
-+ the property that if you move them in part or in whole to another
-+ node, the balancing code invokes their is_left_mergeable()
-+ item_operation to determine if they are mergeable with their new
-+ neighbor in the node you have moved them to. For some items the
-+ is_left_mergeable() function always returns null.
-+
-+ When moving the bodies of items from one node to another:
-+
-+ if a partial item is shifted to another node the balancing code invokes
-+ an item handler method to handle the item splitting.
-+
-+ if the balancing code needs to merge with an item in the node it
-+ is shifting to, it will invoke an item handler method to handle
-+ the item merging.
-+
-+ if it needs to move whole item bodies unchanged, the balancing code uses xmemcpy()
-+ adjusting the item headers after the move is done using the node handler.
-+*/
-+
-+#include "../../forward.h"
-+#include "../../debug.h"
-+#include "../../key.h"
-+#include "../../coord.h"
-+#include "../plugin_header.h"
-+#include "../item/item.h"
-+#include "node.h"
-+#include "../plugin.h"
-+#include "../../znode.h"
-+#include "../../tree.h"
-+#include "../../super.h"
-+#include "../../reiser4.h"
-+
-+/**
-+ * leftmost_key_in_node - get the smallest key in node
-+ * @node:
-+ * @key: store result here
-+ *
-+ * Stores the leftmost key of @node in @key.
-+ */
-+reiser4_key *leftmost_key_in_node(const znode *node, reiser4_key *key)
-+{
-+ assert("nikita-1634", node != NULL);
-+ assert("nikita-1635", key != NULL);
-+
-+ if (!node_is_empty(node)) {
-+ coord_t first_item;
-+
-+ coord_init_first_unit(&first_item, (znode *) node);
-+ item_key_by_coord(&first_item, key);
-+ } else
-+ *key = *reiser4_max_key();
-+ return key;
-+}
-+
-+node_plugin node_plugins[LAST_NODE_ID] = {
-+ [NODE40_ID] = {
-+ .h = {
-+ .type_id = REISER4_NODE_PLUGIN_TYPE,
-+ .id = NODE40_ID,
-+ .pops = NULL,
-+ .label = "unified",
-+ .desc = "unified node layout",
-+ .linkage = {NULL, NULL}
-+ },
-+ .item_overhead = item_overhead_node40,
-+ .free_space = free_space_node40,
-+ .lookup = lookup_node40,
-+ .num_of_items = num_of_items_node40,
-+ .item_by_coord = item_by_coord_node40,
-+ .length_by_coord = length_by_coord_node40,
-+ .plugin_by_coord = plugin_by_coord_node40,
-+ .key_at = key_at_node40,
-+ .estimate = estimate_node40,
-+ .check = check_node40,
-+ .parse = parse_node40,
-+ .init = init_node40,
-+#ifdef GUESS_EXISTS
-+ .guess = guess_node40,
-+#endif
-+ .change_item_size = change_item_size_node40,
-+ .create_item = create_item_node40,
-+ .update_item_key = update_item_key_node40,
-+ .cut_and_kill = kill_node40,
-+ .cut = cut_node40,
-+ .shift = shift_node40,
-+ .shrink_item = shrink_item_node40,
-+ .fast_insert = fast_insert_node40,
-+ .fast_paste = fast_paste_node40,
-+ .fast_cut = fast_cut_node40,
-+ .max_item_size = max_item_size_node40,
-+ .prepare_removal = prepare_removal_node40,
-+ .set_item_plugin = set_item_plugin_node40
-+ }
-+};
-+
-+/*
-+ Local variables:
-+ c-indentation-style: "K&R"
-+ mode-name: "LC"
-+ c-basic-offset: 8
-+ tab-width: 8
-+ fill-column: 120
-+ scroll-step: 1
-+ End:
-+*/
-diff -puN /dev/null fs/reiser4/plugin/node/node.h
---- /dev/null
-+++ a/fs/reiser4/plugin/node/node.h
-@@ -0,0 +1,272 @@
-+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
-+
-+/* We need a definition of the default node layout here. */
-+
-+/* Generally speaking, it is best to have free space in the middle of the
-+ node so that two sets of things can grow towards it, and to have the
-+ item bodies on the left so that the last one of them grows into free
-+ space. We optimize for the case where we append new items to the end
-+ of the node, or grow the last item, because it hurts nothing to so
-+ optimize and it is a common special case to do massive insertions in
-+ increasing key order (and one of cases more likely to have a real user
-+ notice the delay time for).
-+
-+ formatted leaf default layout: (leaf1)
-+
-+ |node header:item bodies:free space:key + pluginid + item offset|
-+
-+ We grow towards the middle, optimizing layout for the case where we
-+ append new items to the end of the node. The node header is fixed
-+ length. Keys, and item offsets plus pluginids for the items
-+ corresponding to them are in increasing key order, and are fixed
-+ length. Item offsets are relative to start of node (16 bits creating
-+ a node size limit of 64k, 12 bits might be a better choice....). Item
-+ bodies are in decreasing key order. Item bodies have a variable size.
-+ There is a one to one to one mapping of keys to item offsets to item
-+ bodies. Item offsets consist of pointers to the zeroth byte of the
-+ item body. Item length equals the start of the next item minus the
-+ start of this item, except the zeroth item whose length equals the end
-+ of the node minus the start of that item (plus a byte). In other
-+ words, the item length is not recorded anywhere, and it does not need
-+ to be since it is computable.
-+
-+ Leaf variable length items and keys layout : (lvar)
-+
-+ |node header:key offset + item offset + pluginid triplets:free space:key bodies:item bodies|
-+
-+ We grow towards the middle, optimizing layout for the case where we
-+ append new items to the end of the node. The node header is fixed
-+ length. Keys and item offsets for the items corresponding to them are
-+ in increasing key order, and keys are variable length. Item offsets
-+ are relative to start of node (16 bits). Item bodies are in
-+ decreasing key order. Item bodies have a variable size. There is a
-+ one to one to one mapping of keys to item offsets to item bodies.
-+ Item offsets consist of pointers to the zeroth byte of the item body.
-+ Item length equals the start of the next item's key minus the start of
-+ this item, except the zeroth item whose length equals the end of the
-+ node minus the start of that item (plus a byte).
-+
-+ leaf compressed keys layout: (lcomp)
-+
-+ |node header:key offset + key inherit + item offset pairs:free space:key bodies:item bodies|
-+
-+ We grow towards the middle, optimizing layout for the case where we
-+ append new items to the end of the node. The node header is fixed
-+ length. Keys and item offsets for the items corresponding to them are
-+ in increasing key order, and keys are variable length. The "key
-+ inherit" field indicates how much of the key prefix is identical to
-+ the previous key (stem compression as described in "Managing
-+ Gigabytes" is used). key_inherit is a one byte integer. The
-+ intra-node searches performed through this layout are linear searches,
-+ and this is theorized to not hurt performance much due to the high
-+ cost of processor stalls on modern CPUs, and the small number of keys
-+ in a single node. Item offsets are relative to start of node (16
-+ bits). Item bodies are in decreasing key order. Item bodies have a
-+ variable size. There is a one to one to one mapping of keys to item
-+ offsets to item bodies. Item offsets consist of pointers to the
-+ zeroth byte of the item body. Item length equals the start of the
-+ next item minus the start of this item, except the zeroth item whose
-+ length equals the end of the node minus the start of that item (plus a
-+ byte). In other words, item length and key length is not recorded
-+ anywhere, and it does not need to be since it is computable.
-+
-+ internal node default layout: (idef1)
-+
-+ just like ldef1 except that item bodies are either blocknrs of
-+ children or extents, and moving them may require updating parent
-+ pointers in the nodes that they point to.
-+*/
-+
-+/* There is an inherent 3-way tradeoff between optimizing and
-+ exchanging disks between different architectures and code
-+ complexity. This is optimal and simple and inexchangeable.
-+ Someone else can do the code for exchanging disks and make it
-+ complex. It would not be that hard. Using other than the PAGE_SIZE
-+ might be suboptimal.
-+*/
-+
-+#if !defined( __REISER4_NODE_H__ )
-+#define __REISER4_NODE_H__
-+
-+#define LEAF40_NODE_SIZE PAGE_CACHE_SIZE
-+
-+#include "../../dformat.h"
-+#include "../plugin_header.h"
-+
-+#include <linux/types.h>
-+
-+typedef enum {
-+ NS_FOUND = 0,
-+ NS_NOT_FOUND = -ENOENT
-+} node_search_result;
-+
-+/* Maximal possible space overhead for creation of new item in a node */
-+#define REISER4_NODE_MAX_OVERHEAD ( sizeof( reiser4_key ) + 32 )
-+
-+typedef enum {
-+ REISER4_NODE_DKEYS = (1 << 0),
-+ REISER4_NODE_TREE_STABLE = (1 << 1)
-+} reiser4_node_check_flag;
-+
-+/* cut and cut_and_kill have too long list of parameters. This structure is just to safe some space on stack */
-+struct cut_list {
-+ coord_t *from;
-+ coord_t *to;
-+ const reiser4_key *from_key;
-+ const reiser4_key *to_key;
-+ reiser4_key *smallest_removed;
-+ carry_plugin_info *info;
-+ __u32 flags;
-+ struct inode *inode; /* this is to pass list of eflushed jnodes down to extent_kill_hook */
-+ lock_handle *left;
-+ lock_handle *right;
-+};
-+
-+struct carry_cut_data;
-+struct carry_kill_data;
-+
-+/* The responsibility of the node plugin is to store and give access
-+ to the sequence of items within the node. */
-+typedef struct node_plugin {
-+ /* generic plugin fields */
-+ plugin_header h;
-+
-+ /* calculates the amount of space that will be required to store an
-+ item which is in addition to the space consumed by the item body.
-+ (the space consumed by the item body can be gotten by calling
-+ item->estimate) */
-+ size_t(*item_overhead) (const znode * node, flow_t * f);
-+
-+ /* returns free space by looking into node (i.e., without using
-+ znode->free_space). */
-+ size_t(*free_space) (znode * node);
-+ /* search within the node for the one item which might
-+ contain the key, invoking item->search_within to search within
-+ that item to see if it is in there */
-+ node_search_result(*lookup) (znode * node, const reiser4_key * key,
-+ lookup_bias bias, coord_t * coord);
-+ /* number of items in node */
-+ int (*num_of_items) (const znode * node);
-+
-+ /* store information about item in @coord in @data */
-+ /* break into several node ops, don't add any more uses of this before doing so */
-+ /*int ( *item_at )( const coord_t *coord, reiser4_item_data *data ); */
-+ char *(*item_by_coord) (const coord_t * coord);
-+ int (*length_by_coord) (const coord_t * coord);
-+ item_plugin *(*plugin_by_coord) (const coord_t * coord);
-+
-+ /* store item key in @key */
-+ reiser4_key *(*key_at) (const coord_t * coord, reiser4_key * key);
-+ /* conservatively estimate whether unit of what size can fit
-+ into node. This estimation should be performed without
-+ actually looking into the node's content (free space is saved in
-+ znode). */
-+ size_t(*estimate) (znode * node);
-+
-+ /* performs every consistency check the node plugin author could
-+ imagine. Optional. */
-+ int (*check) (const znode * node, __u32 flags, const char **error);
-+
-+ /* Called when node is read into memory and node plugin is
-+ already detected. This should read some data into znode (like free
-+ space counter) and, optionally, check data consistency.
-+ */
-+ int (*parse) (znode * node);
-+ /* This method is called on a new node to initialise plugin specific
-+ data (header, etc.) */
-+ int (*init) (znode * node);
-+ /* Check whether @node content conforms to this plugin format.
-+ Probably only useful after support for old V3.x formats is added.
-+ Uncomment after 4.0 only.
-+ */
-+ /* int ( *guess )( const znode *node ); */
-+#if REISER4_DEBUG
-+ void (*print) (const char *prefix, const znode * node, __u32 flags);
-+#endif
-+ /* change size of @item by @by bytes. @item->node has enough free
-+ space. When @by > 0 - free space is appended to end of item. When
-+ @by < 0 - item is truncated - it is assumed that last @by bytes if
-+ the item are freed already */
-+ void (*change_item_size) (coord_t * item, int by);
-+
-+ /* create new item @length bytes long in coord @target */
-+ int (*create_item) (coord_t * target, const reiser4_key * key,
-+ reiser4_item_data * data, carry_plugin_info * info);
-+
-+ /* update key of item. */
-+ void (*update_item_key) (coord_t * target, const reiser4_key * key,
-+ carry_plugin_info * info);
-+
-+ int (*cut_and_kill) (struct carry_kill_data *, carry_plugin_info *);
-+ int (*cut) (struct carry_cut_data *, carry_plugin_info *);
-+
-+ /*
-+ * shrink item pointed to by @coord by @delta bytes.
-+ */
-+ int (*shrink_item) (coord_t * coord, int delta);
-+
-+ /* copy as much as possible but not more than up to @stop from
-+ @stop->node to @target. If (pend == append) then data from beginning of
-+ @stop->node are copied to the end of @target. If (pend == prepend) then
-+ data from the end of @stop->node are copied to the beginning of
-+ @target. Copied data are removed from @stop->node. Information
-+ about what to do on upper level is stored in @todo */
-+ int (*shift) (coord_t * stop, znode * target, shift_direction pend,
-+ int delete_node, int including_insert_coord,
-+ carry_plugin_info * info);
-+ /* return true if this node allows skip carry() in some situations
-+ (see fs/reiser4/tree.c:insert_by_coord()). Reiser3.x format
-+ emulation doesn't.
-+
-+ This will speedup insertions that doesn't require updates to the
-+ parent, by bypassing initialisation of carry() structures. It's
-+ believed that majority of insertions will fit there.
-+
-+ */
-+ int (*fast_insert) (const coord_t * coord);
-+ int (*fast_paste) (const coord_t * coord);
-+ int (*fast_cut) (const coord_t * coord);
-+ /* this limits max size of item which can be inserted into a node and
-+ number of bytes item in a node may be appended with */
-+ int (*max_item_size) (void);
-+ int (*prepare_removal) (znode * empty, carry_plugin_info * info);
-+ /* change plugin id of items which are in a node already. Currently it is Used in tail conversion for regular
-+ * files */
-+ int (*set_item_plugin) (coord_t * coord, item_id);
-+} node_plugin;
-+
-+typedef enum {
-+ /* standard unified node layout used for both leaf and internal
-+ nodes */
-+ NODE40_ID,
-+ LAST_NODE_ID
-+} reiser4_node_id;
-+
-+extern reiser4_key *leftmost_key_in_node(const znode * node, reiser4_key * key);
-+#if REISER4_DEBUG
-+extern void print_node_content(const char *prefix, const znode * node,
-+ __u32 flags);
-+#endif
-+
-+extern void indent_znode(const znode * node);
-+
-+typedef struct common_node_header {
-+ /*
-+ * identifier of node plugin. Must be located at the very beginning of
-+ * a node.
-+ */
-+ __le16 plugin_id;
-+} common_node_header;
-+
-+/* __REISER4_NODE_H__ */
-+#endif
-+/*
-+ * Local variables:
-+ * c-indentation-style: "K&R"
-+ * mode-name: "LC"
-+ * c-basic-offset: 8
-+ * tab-width: 8
-+ * fill-column: 79
-+ * scroll-step: 1
-+ * End:
-+ */
-diff -puN /dev/null fs/reiser4/plugin/node/node40.c
---- /dev/null
-+++ a/fs/reiser4/plugin/node/node40.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/node/node40.c linux-2.6.35/fs/reiser4/plugin/node/node40.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/node/node40.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/node/node40.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,2924 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/node/node40.h
---- /dev/null
-+++ a/fs/reiser4/plugin/node/node40.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/node/node40.h linux-2.6.35/fs/reiser4/plugin/node/node40.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/node/node40.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/node/node40.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,125 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/object.c
---- /dev/null
-+++ a/fs/reiser4/plugin/object.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/node/node.c linux-2.6.35/fs/reiser4/plugin/node/node.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/node/node.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/node/node.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,131 @@
++/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
++
++/* Node plugin interface.
++
++ Description: The tree provides the abstraction of flows, which it
++ internally fragments into items which it stores in nodes.
++
++ A key_atom is a piece of data bound to a single key.
++
++ For reasonable space efficiency to be achieved it is often
++ necessary to store key_atoms in the nodes in the form of items, where
++ an item is a sequence of key_atoms of the same or similar type. It is
++ more space-efficient, because the item can implement (very)
++ efficient compression of key_atom's bodies using internal knowledge
++ about their semantics, and it can often avoid having a key for each
++ key_atom. Each type of item has specific operations implemented by its
++ item handler (see balance.c).
++
++ Rationale: the rest of the code (specifically balancing routines)
++ accesses leaf level nodes through this interface. This way we can
++ implement various block layouts and even combine various layouts
++ within the same tree. Balancing/allocating algorithms should not
++ care about peculiarities of splitting/merging specific item types,
++ but rather should leave that to the item's item handler.
++
++ Items, including those that provide the abstraction of flows, have
++ the property that if you move them in part or in whole to another
++ node, the balancing code invokes their is_left_mergeable()
++ item_operation to determine if they are mergeable with their new
++ neighbor in the node you have moved them to. For some items the
++ is_left_mergeable() function always returns null.
++
++ When moving the bodies of items from one node to another:
++
++ if a partial item is shifted to another node the balancing code invokes
++ an item handler method to handle the item splitting.
++
++ if the balancing code needs to merge with an item in the node it
++ is shifting to, it will invoke an item handler method to handle
++ the item merging.
++
++ if it needs to move whole item bodies unchanged, the balancing code uses xmemcpy()
++ adjusting the item headers after the move is done using the node handler.
++*/
++
++#include "../../forward.h"
++#include "../../debug.h"
++#include "../../key.h"
++#include "../../coord.h"
++#include "../plugin_header.h"
++#include "../item/item.h"
++#include "node.h"
++#include "../plugin.h"
++#include "../../znode.h"
++#include "../../tree.h"
++#include "../../super.h"
++#include "../../reiser4.h"
++
++/**
++ * leftmost_key_in_node - get the smallest key in node
++ * @node:
++ * @key: store result here
++ *
++ * Stores the leftmost key of @node in @key.
++ */
++reiser4_key *leftmost_key_in_node(const znode *node, reiser4_key *key)
++{
++ assert("nikita-1634", node != NULL);
++ assert("nikita-1635", key != NULL);
++
++ if (!node_is_empty(node)) {
++ coord_t first_item;
++
++ coord_init_first_unit(&first_item, (znode *) node);
++ item_key_by_coord(&first_item, key);
++ } else
++ *key = *reiser4_max_key();
++ return key;
++}
++
++node_plugin node_plugins[LAST_NODE_ID] = {
++ [NODE40_ID] = {
++ .h = {
++ .type_id = REISER4_NODE_PLUGIN_TYPE,
++ .id = NODE40_ID,
++ .pops = NULL,
++ .label = "unified",
++ .desc = "unified node layout",
++ .linkage = {NULL, NULL}
++ },
++ .item_overhead = item_overhead_node40,
++ .free_space = free_space_node40,
++ .lookup = lookup_node40,
++ .num_of_items = num_of_items_node40,
++ .item_by_coord = item_by_coord_node40,
++ .length_by_coord = length_by_coord_node40,
++ .plugin_by_coord = plugin_by_coord_node40,
++ .key_at = key_at_node40,
++ .estimate = estimate_node40,
++ .check = check_node40,
++ .parse = parse_node40,
++ .init = init_node40,
++#ifdef GUESS_EXISTS
++ .guess = guess_node40,
++#endif
++ .change_item_size = change_item_size_node40,
++ .create_item = create_item_node40,
++ .update_item_key = update_item_key_node40,
++ .cut_and_kill = kill_node40,
++ .cut = cut_node40,
++ .shift = shift_node40,
++ .shrink_item = shrink_item_node40,
++ .fast_insert = fast_insert_node40,
++ .fast_paste = fast_paste_node40,
++ .fast_cut = fast_cut_node40,
++ .max_item_size = max_item_size_node40,
++ .prepare_removal = prepare_removal_node40,
++ .set_item_plugin = set_item_plugin_node40
++ }
++};
++
++/*
++ Local variables:
++ c-indentation-style: "K&R"
++ mode-name: "LC"
++ c-basic-offset: 8
++ tab-width: 8
++ fill-column: 120
++ scroll-step: 1
++ End:
++*/
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/node/node.h linux-2.6.35/fs/reiser4/plugin/node/node.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/node/node.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/node/node.h 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,272 @@
++/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
++
++/* We need a definition of the default node layout here. */
++
++/* Generally speaking, it is best to have free space in the middle of the
++ node so that two sets of things can grow towards it, and to have the
++ item bodies on the left so that the last one of them grows into free
++ space. We optimize for the case where we append new items to the end
++ of the node, or grow the last item, because it hurts nothing to so
++ optimize and it is a common special case to do massive insertions in
++ increasing key order (and one of cases more likely to have a real user
++ notice the delay time for).
++
++ formatted leaf default layout: (leaf1)
++
++ |node header:item bodies:free space:key + pluginid + item offset|
++
++ We grow towards the middle, optimizing layout for the case where we
++ append new items to the end of the node. The node header is fixed
++ length. Keys, and item offsets plus pluginids for the items
++ corresponding to them are in increasing key order, and are fixed
++ length. Item offsets are relative to start of node (16 bits creating
++ a node size limit of 64k, 12 bits might be a better choice....). Item
++ bodies are in decreasing key order. Item bodies have a variable size.
++ There is a one to one to one mapping of keys to item offsets to item
++ bodies. Item offsets consist of pointers to the zeroth byte of the
++ item body. Item length equals the start of the next item minus the
++ start of this item, except the zeroth item whose length equals the end
++ of the node minus the start of that item (plus a byte). In other
++ words, the item length is not recorded anywhere, and it does not need
++ to be since it is computable.
++
++ Leaf variable length items and keys layout : (lvar)
++
++ |node header:key offset + item offset + pluginid triplets:free space:key bodies:item bodies|
++
++ We grow towards the middle, optimizing layout for the case where we
++ append new items to the end of the node. The node header is fixed
++ length. Keys and item offsets for the items corresponding to them are
++ in increasing key order, and keys are variable length. Item offsets
++ are relative to start of node (16 bits). Item bodies are in
++ decreasing key order. Item bodies have a variable size. There is a
++ one to one to one mapping of keys to item offsets to item bodies.
++ Item offsets consist of pointers to the zeroth byte of the item body.
++ Item length equals the start of the next item's key minus the start of
++ this item, except the zeroth item whose length equals the end of the
++ node minus the start of that item (plus a byte).
++
++ leaf compressed keys layout: (lcomp)
++
++ |node header:key offset + key inherit + item offset pairs:free space:key bodies:item bodies|
++
++ We grow towards the middle, optimizing layout for the case where we
++ append new items to the end of the node. The node header is fixed
++ length. Keys and item offsets for the items corresponding to them are
++ in increasing key order, and keys are variable length. The "key
++ inherit" field indicates how much of the key prefix is identical to
++ the previous key (stem compression as described in "Managing
++ Gigabytes" is used). key_inherit is a one byte integer. The
++ intra-node searches performed through this layout are linear searches,
++ and this is theorized to not hurt performance much due to the high
++ cost of processor stalls on modern CPUs, and the small number of keys
++ in a single node. Item offsets are relative to start of node (16
++ bits). Item bodies are in decreasing key order. Item bodies have a
++ variable size. There is a one to one to one mapping of keys to item
++ offsets to item bodies. Item offsets consist of pointers to the
++ zeroth byte of the item body. Item length equals the start of the
++ next item minus the start of this item, except the zeroth item whose
++ length equals the end of the node minus the start of that item (plus a
++ byte). In other words, item length and key length is not recorded
++ anywhere, and it does not need to be since it is computable.
++
++ internal node default layout: (idef1)
++
++ just like ldef1 except that item bodies are either blocknrs of
++ children or extents, and moving them may require updating parent
++ pointers in the nodes that they point to.
++*/
++
++/* There is an inherent 3-way tradeoff between optimizing and
++ exchanging disks between different architectures and code
++ complexity. This is optimal and simple and inexchangeable.
++ Someone else can do the code for exchanging disks and make it
++ complex. It would not be that hard. Using other than the PAGE_SIZE
++ might be suboptimal.
++*/
++
++#if !defined( __REISER4_NODE_H__ )
++#define __REISER4_NODE_H__
++
++#define LEAF40_NODE_SIZE PAGE_CACHE_SIZE
++
++#include "../../dformat.h"
++#include "../plugin_header.h"
++
++#include <linux/types.h>
++
++typedef enum {
++ NS_FOUND = 0,
++ NS_NOT_FOUND = -ENOENT
++} node_search_result;
++
++/* Maximal possible space overhead for creation of new item in a node */
++#define REISER4_NODE_MAX_OVERHEAD ( sizeof( reiser4_key ) + 32 )
++
++typedef enum {
++ REISER4_NODE_DKEYS = (1 << 0),
++ REISER4_NODE_TREE_STABLE = (1 << 1)
++} reiser4_node_check_flag;
++
++/* cut and cut_and_kill have too long list of parameters. This structure is just to safe some space on stack */
++struct cut_list {
++ coord_t *from;
++ coord_t *to;
++ const reiser4_key *from_key;
++ const reiser4_key *to_key;
++ reiser4_key *smallest_removed;
++ carry_plugin_info *info;
++ __u32 flags;
++ struct inode *inode; /* this is to pass list of eflushed jnodes down to extent_kill_hook */
++ lock_handle *left;
++ lock_handle *right;
++};
++
++struct carry_cut_data;
++struct carry_kill_data;
++
++/* The responsibility of the node plugin is to store and give access
++ to the sequence of items within the node. */
++typedef struct node_plugin {
++ /* generic plugin fields */
++ plugin_header h;
++
++ /* calculates the amount of space that will be required to store an
++ item which is in addition to the space consumed by the item body.
++ (the space consumed by the item body can be gotten by calling
++ item->estimate) */
++ size_t(*item_overhead) (const znode * node, flow_t * f);
++
++ /* returns free space by looking into node (i.e., without using
++ znode->free_space). */
++ size_t(*free_space) (znode * node);
++ /* search within the node for the one item which might
++ contain the key, invoking item->search_within to search within
++ that item to see if it is in there */
++ node_search_result(*lookup) (znode * node, const reiser4_key * key,
++ lookup_bias bias, coord_t * coord);
++ /* number of items in node */
++ int (*num_of_items) (const znode * node);
++
++ /* store information about item in @coord in @data */
++ /* break into several node ops, don't add any more uses of this before doing so */
++ /*int ( *item_at )( const coord_t *coord, reiser4_item_data *data ); */
++ char *(*item_by_coord) (const coord_t * coord);
++ int (*length_by_coord) (const coord_t * coord);
++ item_plugin *(*plugin_by_coord) (const coord_t * coord);
++
++ /* store item key in @key */
++ reiser4_key *(*key_at) (const coord_t * coord, reiser4_key * key);
++ /* conservatively estimate whether unit of what size can fit
++ into node. This estimation should be performed without
++ actually looking into the node's content (free space is saved in
++ znode). */
++ size_t(*estimate) (znode * node);
++
++ /* performs every consistency check the node plugin author could
++ imagine. Optional. */
++ int (*check) (const znode * node, __u32 flags, const char **error);
++
++ /* Called when node is read into memory and node plugin is
++ already detected. This should read some data into znode (like free
++ space counter) and, optionally, check data consistency.
++ */
++ int (*parse) (znode * node);
++ /* This method is called on a new node to initialise plugin specific
++ data (header, etc.) */
++ int (*init) (znode * node);
++ /* Check whether @node content conforms to this plugin format.
++ Probably only useful after support for old V3.x formats is added.
++ Uncomment after 4.0 only.
++ */
++ /* int ( *guess )( const znode *node ); */
++#if REISER4_DEBUG
++ void (*print) (const char *prefix, const znode * node, __u32 flags);
++#endif
++ /* change size of @item by @by bytes. @item->node has enough free
++ space. When @by > 0 - free space is appended to end of item. When
++ @by < 0 - item is truncated - it is assumed that last @by bytes if
++ the item are freed already */
++ void (*change_item_size) (coord_t * item, int by);
++
++ /* create new item @length bytes long in coord @target */
++ int (*create_item) (coord_t * target, const reiser4_key * key,
++ reiser4_item_data * data, carry_plugin_info * info);
++
++ /* update key of item. */
++ void (*update_item_key) (coord_t * target, const reiser4_key * key,
++ carry_plugin_info * info);
++
++ int (*cut_and_kill) (struct carry_kill_data *, carry_plugin_info *);
++ int (*cut) (struct carry_cut_data *, carry_plugin_info *);
++
++ /*
++ * shrink item pointed to by @coord by @delta bytes.
++ */
++ int (*shrink_item) (coord_t * coord, int delta);
++
++ /* copy as much as possible but not more than up to @stop from
++ @stop->node to @target. If (pend == append) then data from beginning of
++ @stop->node are copied to the end of @target. If (pend == prepend) then
++ data from the end of @stop->node are copied to the beginning of
++ @target. Copied data are removed from @stop->node. Information
++ about what to do on upper level is stored in @todo */
++ int (*shift) (coord_t * stop, znode * target, shift_direction pend,
++ int delete_node, int including_insert_coord,
++ carry_plugin_info * info);
++ /* return true if this node allows skip carry() in some situations
++ (see fs/reiser4/tree.c:insert_by_coord()). Reiser3.x format
++ emulation doesn't.
++
++ This will speedup insertions that doesn't require updates to the
++ parent, by bypassing initialisation of carry() structures. It's
++ believed that majority of insertions will fit there.
++
++ */
++ int (*fast_insert) (const coord_t * coord);
++ int (*fast_paste) (const coord_t * coord);
++ int (*fast_cut) (const coord_t * coord);
++ /* this limits max size of item which can be inserted into a node and
++ number of bytes item in a node may be appended with */
++ int (*max_item_size) (void);
++ int (*prepare_removal) (znode * empty, carry_plugin_info * info);
++ /* change plugin id of items which are in a node already. Currently it is Used in tail conversion for regular
++ * files */
++ int (*set_item_plugin) (coord_t * coord, item_id);
++} node_plugin;
++
++typedef enum {
++ /* standard unified node layout used for both leaf and internal
++ nodes */
++ NODE40_ID,
++ LAST_NODE_ID
++} reiser4_node_id;
++
++extern reiser4_key *leftmost_key_in_node(const znode * node, reiser4_key * key);
++#if REISER4_DEBUG
++extern void print_node_content(const char *prefix, const znode * node,
++ __u32 flags);
++#endif
++
++extern void indent_znode(const znode * node);
++
++typedef struct common_node_header {
++ /*
++ * identifier of node plugin. Must be located at the very beginning of
++ * a node.
++ */
++ __le16 plugin_id;
++} common_node_header;
++
++/* __REISER4_NODE_H__ */
++#endif
++/*
++ * Local variables:
++ * c-indentation-style: "K&R"
++ * mode-name: "LC"
++ * c-basic-offset: 8
++ * tab-width: 8
++ * fill-column: 79
++ * scroll-step: 1
++ * End:
++ */
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/object.c linux-2.6.35/fs/reiser4/plugin/object.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/object.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/object.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,531 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ .read = reiser4_read_careful,
+ .write = reiser4_write_careful,
+ .aio_read = generic_file_aio_read,
-+ .ioctl = reiser4_ioctl_careful,
++ .unlocked_ioctl = reiser4_ioctl_careful,
+ .mmap = reiser4_mmap_careful,
+ .open = reiser4_open_careful,
+ .release = reiser4_release_careful,
+ .writepages = reiser4_writepages,
+ .set_page_dirty = reiser4_set_page_dirty,
+ .readpages = reiser4_readpages,
-+ .prepare_write = reiser4_prepare_write,
-+ .commit_write = reiser4_commit_write,
++ .write_begin = reiser4_write_begin_careful,
++ .write_end = reiser4_write_end_careful,
+ .bmap = reiser4_bmap_careful,
+ .invalidatepage = reiser4_invalidatepage,
+ .releasepage = reiser4_releasepage
+ .writepages = dummyop,
+ .set_page_dirty = bugop,
+ .readpages = bugop,
-+ .prepare_write = bugop,
-+ .commit_write = bugop,
++ .write_begin = bugop,
++ .write_end = bugop,
+ .bmap = bugop,
+ .invalidatepage = bugop,
+ .releasepage = bugop
+ .readpage = readpage_unix_file,
+ .readpages = readpages_unix_file,
+ .writepages = writepages_unix_file,
-+ .prepare_write = prepare_write_unix_file,
-+ .commit_write = commit_write_unix_file,
++ .write_begin = write_begin_unix_file,
++ .write_end = write_end_unix_file,
+ /*
+ * private a_ops
+ */
+ .pops = &file_plugin_ops,
+ .label = "symlink",
+ .desc = "symbolic link",
-+ .linkage = {NULL, NULL}
++ .linkage = {NULL,NULL}
+ },
+ .inode_ops = &symlink_file_i_ops,
-+ /* inode->i_fop of symlink is initialized by NULL in
-+ * setup_inode_ops */
++ /* inode->i_fop of symlink is initialized
++ by NULL in setup_inode_ops */
+ .file_ops = &null_f_ops,
+ .as_ops = &null_a_ops,
+
+ .readpage = readpage_cryptcompress,
+ .readpages = readpages_cryptcompress,
+ .writepages = writepages_cryptcompress,
-+ .prepare_write = prepare_write_cryptcompress,
-+ .commit_write = commit_write_cryptcompress,
++ .write_begin = write_begin_cryptcompress,
++ .write_end = write_end_cryptcompress,
+
+ .bmap = bmap_cryptcompress,
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/object.h
---- /dev/null
-+++ a/fs/reiser4/plugin/object.h
-@@ -0,0 +1,120 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/object.h linux-2.6.35/fs/reiser4/plugin/object.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/object.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/object.h 2010-08-04 18:11:54.000000000 +0200
+@@ -0,0 +1,116 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+loff_t reiser4_llseek_dir_common(struct file *, loff_t off, int origin);
+int reiser4_readdir_common(struct file *, void *dirent, filldir_t);
+int reiser4_release_dir_common(struct inode *, struct file *);
-+int reiser4_sync_common(struct file *, struct dentry *, int datasync);
-+
-+/* common implementations of address space operations */
-+int prepare_write_common(struct file *, struct page *, unsigned from,
-+ unsigned to);
++int reiser4_sync_common(struct file *, int datasync);
+
+/* file plugin operations: common implementations */
+int write_sd_by_inode_common(struct inode *);
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/plugin.c
---- /dev/null
-+++ a/fs/reiser4/plugin/plugin.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/plugin.c linux-2.6.35/fs/reiser4/plugin/plugin.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/plugin.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/plugin.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,560 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ * fill-column: 120
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/plugin/plugin.h
---- /dev/null
-+++ a/fs/reiser4/plugin/plugin.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/plugin.h linux-2.6.35/fs/reiser4/plugin/plugin.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/plugin.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/plugin.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,942 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ * in @cont */
+ ssize_t (*write) (struct file *, const char __user *buf,
+ size_t write_amount, loff_t * off,
-+ struct psched_context * cont);
++ struct dispatch_context * cont);
+ int (*ioctl) (struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg);
+ int (*mmap) (struct file *, struct vm_area_struct *);
+ struct list_head *pages, unsigned nr_pages);
+ int (*writepages)(struct address_space *mapping,
+ struct writeback_control *wbc);
-+ int (*prepare_write)(struct file *file, struct page *page,
-+ unsigned from, unsigned to);
-+ int (*commit_write)(struct file *file, struct page *page,
-+ unsigned from, unsigned to);
++ int (*write_begin)(struct file *file, struct page *page,
++ unsigned from, unsigned to);
++ int (*write_end)(struct file *file, struct page *page,
++ unsigned from, unsigned to);
+ sector_t (*bmap) (struct address_space * mapping, sector_t lblock);
+ /* other private methods */
+ /* save inode cached stat-data onto disk. It was called
+ int (*min_size_deflate) (void);
+ __u32(*checksum) (char *data, __u32 length);
+ /* main transform procedures */
-+ void (*compress) (coa_t coa, __u8 *src_first, unsigned src_len,
-+ __u8 *dst_first, unsigned *dst_len);
-+ void (*decompress) (coa_t coa, __u8 *src_first, unsigned src_len,
-+ __u8 *dst_first, unsigned *dst_len);
++ void (*compress) (coa_t coa, __u8 *src_first, size_t src_len,
++ __u8 *dst_first, size_t *dst_len);
++ void (*decompress) (coa_t coa, __u8 *src_first, size_t src_len,
++ __u8 *dst_first, size_t *dst_len);
+} compression_plugin;
+
+typedef struct compression_mode_plugin {
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/plugin_header.h
---- /dev/null
-+++ a/fs/reiser4/plugin/plugin_header.h
-@@ -0,0 +1,157 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/plugin_header.h linux-2.6.35/fs/reiser4/plugin/plugin_header.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/plugin_header.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/plugin_header.h 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,149 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+/* plugin header. Data structures required by all plugin types. */
+#include "../debug.h"
+#include "../dformat.h"
+
-+/* Every plugin type can be considered as a class of virtual objects
-+ {(type, i) | i = 0, 1, ...}, which has one the following categories
-+ of virtualization:
-+ A - no virtualization;
-+ F - per-file virtualization;
-+ S - per-superblock virtualization;
-+ FIXME-EDWARD: Define every such category */
-+
-+/* Supported plugin types: (id, (virtualization category), short description) */
++/* The list of Reiser4 interfaces */
+typedef enum {
-+ REISER4_FILE_PLUGIN_TYPE, /* (F) service VFS enry-points */
-+ REISER4_DIR_PLUGIN_TYPE, /* (F) service VFS enry-points */
-+ REISER4_ITEM_PLUGIN_TYPE, /* (F) manage items */
-+ REISER4_NODE_PLUGIN_TYPE, /* (S) manage formatted nodes */
-+ REISER4_HASH_PLUGIN_TYPE, /* (F) compute hash */
-+ REISER4_FIBRATION_PLUGIN_TYPE, /* (F) directory fibrations */
-+ REISER4_FORMATTING_PLUGIN_TYPE, /* (F) tail-packing policy */
-+ REISER4_PERM_PLUGIN_TYPE, /* stub (vacancy) */
-+ REISER4_SD_EXT_PLUGIN_TYPE, /* (A) stat-data extensions */
-+ REISER4_FORMAT_PLUGIN_TYPE, /* (S) specify disk format */
-+ REISER4_JNODE_PLUGIN_TYPE, /* (A) in-memory node headers */
-+ REISER4_CIPHER_PLUGIN_TYPE, /* (F) cipher transform algs */
-+ REISER4_DIGEST_PLUGIN_TYPE, /* (F) digest transform algs */
-+ REISER4_COMPRESSION_PLUGIN_TYPE, /* (F) compression tfm algs */
-+ REISER4_COMPRESSION_MODE_PLUGIN_TYPE, /* (F) compression heuristic */
-+ REISER4_CLUSTER_PLUGIN_TYPE, /* (F) size of logical cluster */
++ REISER4_FILE_PLUGIN_TYPE, /* manage VFS objects */
++ REISER4_DIR_PLUGIN_TYPE, /* manage directories */
++ REISER4_ITEM_PLUGIN_TYPE, /* manage items */
++ REISER4_NODE_PLUGIN_TYPE, /* manage formatted nodes */
++ REISER4_HASH_PLUGIN_TYPE, /* hash methods */
++ REISER4_FIBRATION_PLUGIN_TYPE, /* directory fibrations */
++ REISER4_FORMATTING_PLUGIN_TYPE, /* dispatching policy */
++ REISER4_PERM_PLUGIN_TYPE, /* stub (vacancy) */
++ REISER4_SD_EXT_PLUGIN_TYPE, /* manage stat-data extensions */
++ REISER4_FORMAT_PLUGIN_TYPE, /* disk format specifications */
++ REISER4_JNODE_PLUGIN_TYPE, /* manage in-memory headers */
++ REISER4_CIPHER_PLUGIN_TYPE, /* cipher transform methods */
++ REISER4_DIGEST_PLUGIN_TYPE, /* digest transform methods */
++ REISER4_COMPRESSION_PLUGIN_TYPE, /* compression methods */
++ REISER4_COMPRESSION_MODE_PLUGIN_TYPE, /* dispatching policies */
++ REISER4_CLUSTER_PLUGIN_TYPE, /* manage logical clusters */
+ REISER4_PLUGIN_TYPES
+} reiser4_plugin_type;
+
+ * fill-column: 79
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/plugin/plugin_set.c
---- /dev/null
-+++ a/fs/reiser4/plugin/plugin_set.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/plugin_set.c linux-2.6.35/fs/reiser4/plugin/plugin_set.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/plugin_set.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/plugin_set.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,380 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ * fill-column: 120
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/plugin/plugin_set.h
---- /dev/null
-+++ a/fs/reiser4/plugin/plugin_set.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/plugin_set.h linux-2.6.35/fs/reiser4/plugin/plugin_set.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/plugin_set.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/plugin_set.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,78 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/security/Makefile
---- /dev/null
-+++ a/fs/reiser4/plugin/security/Makefile
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/security/Makefile linux-2.6.35/fs/reiser4/plugin/security/Makefile
+--- linux-2.6.35.orig/fs/reiser4/plugin/security/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/security/Makefile 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,4 @@
+obj-$(CONFIG_REISER4_FS) += security_plugins.o
+
+security_plugins-objs := \
+ perm.o
-diff -puN /dev/null fs/reiser4/plugin/security/perm.c
---- /dev/null
-+++ a/fs/reiser4/plugin/security/perm.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/security/perm.c linux-2.6.35/fs/reiser4/plugin/security/perm.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/security/perm.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/security/perm.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,33 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ * fill-column: 79
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/plugin/security/perm.h
---- /dev/null
-+++ a/fs/reiser4/plugin/security/perm.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/security/perm.h linux-2.6.35/fs/reiser4/plugin/security/perm.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/security/perm.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/security/perm.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,38 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/space/Makefile
---- /dev/null
-+++ a/fs/reiser4/plugin/space/Makefile
-@@ -0,0 +1,4 @@
-+obj-$(CONFIG_REISER4_FS) += space_plugins.o
-+
-+space_plugins-objs := \
-+ bitmap.o
-diff -puN /dev/null fs/reiser4/plugin/space/bitmap.c
---- /dev/null
-+++ a/fs/reiser4/plugin/space/bitmap.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/space/bitmap.c linux-2.6.35/fs/reiser4/plugin/space/bitmap.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/space/bitmap.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/space/bitmap.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,1585 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ * scroll-step: 1
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/plugin/space/bitmap.h
---- /dev/null
-+++ a/fs/reiser4/plugin/space/bitmap.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/space/bitmap.h linux-2.6.35/fs/reiser4/plugin/space/bitmap.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/space/bitmap.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/space/bitmap.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,47 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/space/space_allocator.h
---- /dev/null
-+++ a/fs/reiser4/plugin/space/space_allocator.h
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/space/Makefile linux-2.6.35/fs/reiser4/plugin/space/Makefile
+--- linux-2.6.35.orig/fs/reiser4/plugin/space/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/space/Makefile 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,4 @@
++obj-$(CONFIG_REISER4_FS) += space_plugins.o
++
++space_plugins-objs := \
++ bitmap.o
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/space/space_allocator.h linux-2.6.35/fs/reiser4/plugin/space/space_allocator.h
+--- linux-2.6.35.orig/fs/reiser4/plugin/space/space_allocator.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/space/space_allocator.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,80 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/plugin/tail_policy.c
---- /dev/null
-+++ a/fs/reiser4/plugin/tail_policy.c
+diff -urN linux-2.6.35.orig/fs/reiser4/plugin/tail_policy.c linux-2.6.35/fs/reiser4/plugin/tail_policy.c
+--- linux-2.6.35.orig/fs/reiser4/plugin/tail_policy.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/plugin/tail_policy.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,113 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ * fill-column: 79
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/pool.c
---- /dev/null
-+++ a/fs/reiser4/pool.c
+diff -urN linux-2.6.35.orig/fs/reiser4/pool.c linux-2.6.35/fs/reiser4/pool.c
+--- linux-2.6.35.orig/fs/reiser4/pool.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/pool.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,231 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/pool.h
---- /dev/null
-+++ a/fs/reiser4/pool.h
+diff -urN linux-2.6.35.orig/fs/reiser4/pool.h linux-2.6.35/fs/reiser4/pool.h
+--- linux-2.6.35.orig/fs/reiser4/pool.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/pool.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,57 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/readahead.c
---- /dev/null
-+++ a/fs/reiser4/readahead.c
+diff -urN linux-2.6.35.orig/fs/reiser4/readahead.c linux-2.6.35/fs/reiser4/readahead.c
+--- linux-2.6.35.orig/fs/reiser4/readahead.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/readahead.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,140 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 80
+ End:
+*/
-diff -puN /dev/null fs/reiser4/readahead.h
---- /dev/null
-+++ a/fs/reiser4/readahead.h
+diff -urN linux-2.6.35.orig/fs/reiser4/readahead.h linux-2.6.35/fs/reiser4/readahead.h
+--- linux-2.6.35.orig/fs/reiser4/readahead.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/readahead.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,52 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/reiser4.h
---- /dev/null
-+++ a/fs/reiser4/reiser4.h
-@@ -0,0 +1,270 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/README linux-2.6.35/fs/reiser4/README
+--- linux-2.6.35.orig/fs/reiser4/README 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/README 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,128 @@
++[LICENSING]
++
++Reiser4 is hereby licensed under the GNU General
++Public License version 2.
++
++Source code files that contain the phrase "licensing governed by
++reiser4/README" are "governed files" throughout this file. Governed
++files are licensed under the GPL. The portions of them owned by Hans
++Reiser, or authorized to be licensed by him, have been in the past,
++and likely will be in the future, licensed to other parties under
++other licenses. If you add your code to governed files, and don't
++want it to be owned by Hans Reiser, put your copyright label on that
++code so the poor blight and his customers can keep things straight.
++All portions of governed files not labeled otherwise are owned by Hans
++Reiser, and by adding your code to it, widely distributing it to
++others or sending us a patch, and leaving the sentence in stating that
++licensing is governed by the statement in this file, you accept this.
++It will be a kindness if you identify whether Hans Reiser is allowed
++to license code labeled as owned by you on your behalf other than
++under the GPL, because he wants to know if it is okay to do so and put
++a check in the mail to you (for non-trivial improvements) when he
++makes his next sale. He makes no guarantees as to the amount if any,
++though he feels motivated to motivate contributors, and you can surely
++discuss this with him before or after contributing. You have the
++right to decline to allow him to license your code contribution other
++than under the GPL.
++
++Further licensing options are available for commercial and/or other
++interests directly from Hans Reiser: reiser@namesys.com. If you interpret
++the GPL as not allowing those additional licensing options, you read
++it wrongly, and Richard Stallman agrees with me, when carefully read
++you can see that those restrictions on additional terms do not apply
++to the owner of the copyright, and my interpretation of this shall
++govern for this license.
++
++[END LICENSING]
++
++Reiser4 is a file system based on dancing tree algorithms, and is
++described at http://www.namesys.com
++
++mkfs.reiser4 and other utilities are on our webpage or wherever your
++Linux provider put them. You really want to be running the latest
++version off the website if you use fsck.
++
++Yes, if you update your reiser4 kernel module you do have to
++recompile your kernel, most of the time. The errors you get will be
++quite cryptic if your forget to do so.
++
++Hideous Commercial Pitch: Spread your development costs across other OS
++vendors. Select from the best in the world, not the best in your
++building, by buying from third party OS component suppliers. Leverage
++the software component development power of the internet. Be the most
++aggressive in taking advantage of the commercial possibilities of
++decentralized internet development, and add value through your branded
++integration that you sell as an operating system. Let your competitors
++be the ones to compete against the entire internet by themselves. Be
++hip, get with the new economic trend, before your competitors do. Send
++email to reiser@namesys.com
++
++Hans Reiser was the primary architect of Reiser4, but a whole team
++chipped their ideas in. He invested everything he had into Namesys
++for 5.5 dark years of no money before Reiser3 finally started to work well
++enough to bring in money. He owns the copyright.
++
++DARPA was the primary sponsor of Reiser4. DARPA does not endorse
++Reiser4, it merely sponsors it. DARPA is, in solely Hans's personal
++opinion, unique in its willingness to invest into things more
++theoretical than the VC community can readily understand, and more
++longterm than allows them to be sure that they will be the ones to
++extract the economic benefits from. DARPA also integrated us into a
++security community that transformed our security worldview.
++
++Vladimir Saveliev is our lead programmer, with us from the beginning,
++and he worked long hours writing the cleanest code. This is why he is
++now the lead programmer after years of commitment to our work. He
++always made the effort to be the best he could be, and to make his
++code the best that it could be. What resulted was quite remarkable. I
++don't think that money can ever motivate someone to work the way he
++did, he is one of the most selfless men I know.
++
++Alexander Lyamin was our sysadmin, and helped to educate us in
++security issues. Moscow State University and IMT were very generous
++in the internet access they provided us, and in lots of other little
++ways that a generous institution can be.
++
++Alexander Zarochentcev (sometimes known as zam, or sasha), wrote the
++locking code, the block allocator, and finished the flushing code.
++His code is always crystal clean and well structured.
++
++Nikita Danilov wrote the core of the balancing code, the core of the
++plugins code, and the directory code. He worked a steady pace of long
++hours that produced a whole lot of well abstracted code. He is our
++senior computer scientist.
++
++Vladimir Demidov wrote the parser. Writing an in kernel parser is
++something very few persons have the skills for, and it is thanks to
++him that we can say that the parser is really not so big compared to
++various bits of our other code, and making a parser work in the kernel
++was not so complicated as everyone would imagine mainly because it was
++him doing it...
++
++Joshua McDonald wrote the transaction manager, and the flush code.
++The flush code unexpectedly turned out be extremely hairy for reasons
++you can read about on our web page, and he did a great job on an
++extremely difficult task.
++
++Nina Reiser handled our accounting, government relations, and much
++more.
++
++Ramon Reiser developed our website.
++
++Beverly Palmer drew our graphics.
++
++Vitaly Fertman developed librepair, userspace plugins repair code, fsck
++and worked with Umka on developing libreiser4 and userspace plugins.
++
++Yury Umanets (aka Umka) developed libreiser4, userspace plugins and
++userspace tools (reiser4progs).
++
++Oleg Drokin (aka Green) is the release manager who fixes everything.
++It is so nice to have someone like that on the team. He (plus Chris
++and Jeff) make it possible for the entire rest of the Namesys team to
++focus on Reiser4, and he fixed a whole lot of Reiser4 bugs also. It
++is just amazing to watch his talent for spotting bugs in action.
++
++Edward Shishkin wrote cryptcompress file plugin (which manages files
++built of encrypted and(or) compressed bodies) and other plugins related
++to transparent encryption and compression support.
+diff -urN linux-2.6.35.orig/fs/reiser4/reiser4.h linux-2.6.35/fs/reiser4/reiser4.h
+--- linux-2.6.35.orig/fs/reiser4/reiser4.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/reiser4.h 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,259 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+/* definitions of common constants used by reiser4 */
+
-+#if !defined(__REISER4_H__)
++#if !defined( __REISER4_H__ )
+#define __REISER4_H__
+
+#include <asm/param.h> /* for HZ */
+#define REISER4_DEBUG (0)
+#endif
+
-+#if defined(CONFIG_ZLIB_INFLATE)
-+/* turn on zlib */
-+#define REISER4_ZLIB (1)
-+#else
-+#define REISER4_ZLIB (0)
-+#endif
-+
-+#if defined(CONFIG_CRYPTO_SHA256)
-+#define REISER4_SHA256 (1)
-+#else
+#define REISER4_SHA256 (0)
-+#endif
+
+/*
+ * Turn on large keys mode. In his mode (which is default), reiser4 key has 4
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/safe_link.c
---- /dev/null
-+++ a/fs/reiser4/safe_link.c
+diff -urN linux-2.6.35.orig/fs/reiser4/safe_link.c linux-2.6.35/fs/reiser4/safe_link.c
+--- linux-2.6.35.orig/fs/reiser4/safe_link.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/safe_link.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,354 @@
+/* Copyright 2003, 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/safe_link.h
---- /dev/null
-+++ a/fs/reiser4/safe_link.h
+diff -urN linux-2.6.35.orig/fs/reiser4/safe_link.h linux-2.6.35/fs/reiser4/safe_link.h
+--- linux-2.6.35.orig/fs/reiser4/safe_link.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/safe_link.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,29 @@
+/* Copyright 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/seal.c
---- /dev/null
-+++ a/fs/reiser4/seal.c
+diff -urN linux-2.6.35.orig/fs/reiser4/seal.c linux-2.6.35/fs/reiser4/seal.c
+--- linux-2.6.35.orig/fs/reiser4/seal.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/seal.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,218 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+/* Seals implementation. */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/seal.h
---- /dev/null
-+++ a/fs/reiser4/seal.h
+diff -urN linux-2.6.35.orig/fs/reiser4/seal.h linux-2.6.35/fs/reiser4/seal.h
+--- linux-2.6.35.orig/fs/reiser4/seal.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/seal.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,49 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/search.c
---- /dev/null
-+++ a/fs/reiser4/search.c
+diff -urN linux-2.6.35.orig/fs/reiser4/search.c linux-2.6.35/fs/reiser4/search.c
+--- linux-2.6.35.orig/fs/reiser4/search.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/search.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,1612 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/status_flags.c
---- /dev/null
-+++ a/fs/reiser4/status_flags.c
+diff -urN linux-2.6.35.orig/fs/reiser4/status_flags.c linux-2.6.35/fs/reiser4/status_flags.c
+--- linux-2.6.35.orig/fs/reiser4/status_flags.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/status_flags.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,174 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ get_super_private(sb)->status_bio = NULL;
+ return 0;
+}
-diff -puN /dev/null fs/reiser4/status_flags.h
---- /dev/null
-+++ a/fs/reiser4/status_flags.h
+diff -urN linux-2.6.35.orig/fs/reiser4/status_flags.h linux-2.6.35/fs/reiser4/status_flags.h
+--- linux-2.6.35.orig/fs/reiser4/status_flags.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/status_flags.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,47 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+int reiser4_status_finish(void);
+
+#endif
-diff -puN /dev/null fs/reiser4/super.c
---- /dev/null
-+++ a/fs/reiser4/super.c
+diff -urN linux-2.6.35.orig/fs/reiser4/super.c linux-2.6.35/fs/reiser4/super.c
+--- linux-2.6.35.orig/fs/reiser4/super.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/super.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,306 @@
+/* Copyright 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ reserved += reserved_for_gid(super, gid);
+ if (REISER4_SUPPORT_UID_SPACE_RESERVATION)
+ reserved += reserved_for_uid(super, uid);
-+ if (REISER4_SUPPORT_ROOT_SPACE_RESERVATION && capable(CAP_SYS_RESOURCE))
++ if (REISER4_SUPPORT_ROOT_SPACE_RESERVATION && (uid == 0))
+ reserved += reserved_for_root(super);
+ return reserved;
+}
+
+/* get/set value of/to grabbed blocks counter */
-+__u64 reiser4_grabbed_blocks(const struct super_block *super)
++__u64 reiser4_grabbed_blocks(const struct super_block * super)
+{
+ assert("zam-512", super != NULL);
+ assert("zam-513", is_reiser4_super(super));
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/super.h
---- /dev/null
-+++ a/fs/reiser4/super.h
+diff -urN linux-2.6.35.orig/fs/reiser4/super.h linux-2.6.35/fs/reiser4/super.h
+--- linux-2.6.35.orig/fs/reiser4/super.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/super.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,466 @@
+/* Copyright 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ * fill-column: 120
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/super_ops.c
---- /dev/null
-+++ a/fs/reiser4/super_ops.c
-@@ -0,0 +1,725 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/super_ops.c linux-2.6.35/fs/reiser4/super_ops.c
+--- linux-2.6.35.orig/fs/reiser4/super_ops.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/super_ops.c 2010-08-04 17:01:34.000000000 +0200
+@@ -0,0 +1,737 @@
+/* Copyright 2005 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+
+ truncate_inode_pages(&inode->i_data, 0);
+ inode->i_blocks = 0;
-+ clear_inode(inode);
++ end_writeback(inode);
+ reiser4_exit_context(ctx);
+}
+
+}
+
+/**
-+ * reiser4_sync_inodes - sync_inodes of super operations
++ * reiser4_writeback_inodes - writeback_inodes of super operations
+ * @super:
++ * @wb:
+ * @wbc:
+ *
+ * This method is called by background and non-backgound writeback. Reiser4's
-+ * implementation uses generic_sync_sb_inodes to call reiser4_writepages for
-+ * each of dirty inodes. Reiser4_writepages handles pages dirtied via shared
-+ * mapping - dirty pages get into atoms. Writeout is called to flush some
-+ * atoms.
++ * implementation uses generic_writeback_sb_inodes to call reiser4_writepages
++ * for each of dirty inodes. reiser4_writepages handles pages dirtied via shared
++ * mapping - dirty pages get into atoms. Writeout is called to flush some atoms.
+ */
-+static void reiser4_sync_inodes(struct super_block *super,
-+ struct writeback_control *wbc)
++static int reiser4_writeback_inodes(struct super_block *super,
++ struct bdi_writeback *wb,
++ struct writeback_control *wbc,
++ bool only_this_sb)
+{
-+ reiser4_context *ctx;
++ int ret;
+ long to_write;
++ reiser4_context *ctx;
+
+ if (wbc->for_kupdate)
+ /* reiser4 has its own means of periodical write-out */
-+ return;
-+
-+ to_write = wbc->nr_to_write;
++ goto skip;
+ assert("vs-49", wbc->older_than_this == NULL);
+
++ spin_unlock(&inode_lock);
+ ctx = reiser4_init_context(super);
+ if (IS_ERR(ctx)) {
+ warning("vs-13", "failed to init context");
-+ return;
++ spin_lock(&inode_lock);
++ goto skip;
+ }
-+
++ to_write = wbc->nr_to_write;
+ /*
-+ * call reiser4_writepages for each of dirty inodes to turn dirty pages
-+ * into transactions if they were not yet.
++ * call reiser4_writepages for each of dirty inodes to turn
++ * dirty pages into transactions if they were not yet.
+ */
-+ generic_sync_sb_inodes(super, wbc);
++ spin_lock(&inode_lock);
++ ret = generic_writeback_sb_inodes(super, wb, wbc, only_this_sb);
++ spin_unlock(&inode_lock);
+
-+ /* flush goes here */
+ wbc->nr_to_write = to_write;
++
++ /* flush goes here */
+ reiser4_writeout(super, wbc);
+
-+ /* avoid recursive calls to ->sync_inodes */
++ /* avoid recursive calls to ->writeback_inodes */
+ context_set_commit_async(ctx);
+ reiser4_exit_context(ctx);
++ spin_lock(&inode_lock);
++
++ return wbc->nr_to_write <= 0 ? 1 : ret;
++ skip:
++ writeback_skip_sb_inodes(super, wb);
++ return 0;
+}
+
+/**
+ .alloc_inode = reiser4_alloc_inode,
+ .destroy_inode = reiser4_destroy_inode,
+ .dirty_inode = reiser4_dirty_inode,
-+ .delete_inode = reiser4_delete_inode,
++ .evict_inode = reiser4_delete_inode,
+ .put_super = reiser4_put_super,
+ .write_super = reiser4_write_super,
+ .statfs = reiser4_statfs,
-+ .clear_inode = reiser4_clear_inode,
-+ .sync_inodes = reiser4_sync_inodes,
++// .clear_inode = reiser4_clear_inode,
++ .writeback_inodes = reiser4_writeback_inodes,
+ .show_options = reiser4_show_options
+};
+
+ * fill-column: 79
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/tap.c
---- /dev/null
-+++ a/fs/reiser4/tap.c
+diff -urN linux-2.6.35.orig/fs/reiser4/tap.c linux-2.6.35/fs/reiser4/tap.c
+--- linux-2.6.35.orig/fs/reiser4/tap.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/tap.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,376 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/tap.h
---- /dev/null
-+++ a/fs/reiser4/tap.h
+diff -urN linux-2.6.35.orig/fs/reiser4/tap.h linux-2.6.35/fs/reiser4/tap.h
+--- linux-2.6.35.orig/fs/reiser4/tap.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/tap.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,70 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/tree.c
---- /dev/null
-+++ a/fs/reiser4/tree.c
+diff -urN linux-2.6.35.orig/fs/reiser4/tree.c linux-2.6.35/fs/reiser4/tree.c
+--- linux-2.6.35.orig/fs/reiser4/tree.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/tree.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,1878 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/tree.h
---- /dev/null
-+++ a/fs/reiser4/tree.h
+diff -urN linux-2.6.35.orig/fs/reiser4/tree.h linux-2.6.35/fs/reiser4/tree.h
+--- linux-2.6.35.orig/fs/reiser4/tree.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/tree.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,577 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/tree_mod.c
---- /dev/null
-+++ a/fs/reiser4/tree_mod.c
+diff -urN linux-2.6.35.orig/fs/reiser4/tree_mod.c linux-2.6.35/fs/reiser4/tree_mod.c
+--- linux-2.6.35.orig/fs/reiser4/tree_mod.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/tree_mod.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,386 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/tree_mod.h
---- /dev/null
-+++ a/fs/reiser4/tree_mod.h
+diff -urN linux-2.6.35.orig/fs/reiser4/tree_mod.h linux-2.6.35/fs/reiser4/tree_mod.h
+--- linux-2.6.35.orig/fs/reiser4/tree_mod.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/tree_mod.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,29 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/tree_walk.c
---- /dev/null
-+++ a/fs/reiser4/tree_walk.c
+diff -urN linux-2.6.35.orig/fs/reiser4/tree_walk.c linux-2.6.35/fs/reiser4/tree_walk.c
+--- linux-2.6.35.orig/fs/reiser4/tree_walk.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/tree_walk.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,927 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 80
+ End:
+*/
-diff -puN /dev/null fs/reiser4/tree_walk.h
---- /dev/null
-+++ a/fs/reiser4/tree_walk.h
+diff -urN linux-2.6.35.orig/fs/reiser4/tree_walk.h linux-2.6.35/fs/reiser4/tree_walk.h
+--- linux-2.6.35.orig/fs/reiser4/tree_walk.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/tree_walk.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,125 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/txnmgr.c
---- /dev/null
-+++ a/fs/reiser4/txnmgr.c
-@@ -0,0 +1,3164 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/txnmgr.c linux-2.6.35/fs/reiser4/txnmgr.c
+--- linux-2.6.35.orig/fs/reiser4/txnmgr.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/txnmgr.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,3165 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+ * Write throttling is case of no one atom can be
+ * flushed/committed.
+ */
-+ if (!current_is_pdflush() && !wbc->nonblocking) {
++ if (!current_is_flush_bd_task() && !wbc->nonblocking) {
+ list_for_each_entry(atom, &tmgr->atoms_list, atom_link) {
+ spin_lock_atom(atom);
+ /* Repeat the check from the above. */
+
+ JF_SET(node, JNODE_DIRTY);
+
-+ get_current_context()->nr_marked_dirty++;
++ if (!JF_ISSET(node, JNODE_CLUSTER_PAGE))
++ get_current_context()->nr_marked_dirty++;
+
+ /* We grab2flush_reserve one additional block only if node was
+ not CREATED and jnode_flush did not sort it into neither
+ spin_unlock_jnode(node);
+ /* reiser4 file write code calls set_page_dirty for
+ * unformatted nodes, for formatted nodes we do it here. */
-+ reiser4_set_page_dirty_internal(page);
++ set_page_dirty_notag(page);
+ page_cache_release(page);
+ /* bump version counter in znode */
+ z->version = znode_build_version(jnode_get_tree(node));
+ * fill-column: 79
+ * End:
+ */
-diff -puN /dev/null fs/reiser4/txnmgr.h
---- /dev/null
-+++ a/fs/reiser4/txnmgr.h
+diff -urN linux-2.6.35.orig/fs/reiser4/txnmgr.h linux-2.6.35/fs/reiser4/txnmgr.h
+--- linux-2.6.35.orig/fs/reiser4/txnmgr.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/txnmgr.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,701 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/type_safe_hash.h
---- /dev/null
-+++ a/fs/reiser4/type_safe_hash.h
+diff -urN linux-2.6.35.orig/fs/reiser4/type_safe_hash.h linux-2.6.35/fs/reiser4/type_safe_hash.h
+--- linux-2.6.35.orig/fs/reiser4/type_safe_hash.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/type_safe_hash.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,320 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/vfs_ops.c
---- /dev/null
-+++ a/fs/reiser4/vfs_ops.c
-@@ -0,0 +1,259 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/vfs_ops.c linux-2.6.35/fs/reiser4/vfs_ops.c
+--- linux-2.6.35.orig/fs/reiser4/vfs_ops.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/vfs_ops.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,267 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+ * requested page itself - start flush from
+ * that page
+ */
-+ node = jref(ent->cur_request->node);
++ node = ent->cur_request->node;
+ }
+
+ result = flush_some_atom(node, &nr_submitted, wbc,
+ if (result != 0)
+ warning("nikita-31001", "Flush failed: %i", result);
+ if (node)
++ /* drop the reference aquired
++ in find_or_create_extent() */
+ jput(node);
+ if (!nr_submitted)
+ break;
+ } while (wbc->nr_to_write > 0);
+}
+
-+void reiser4_throttle_write(struct inode *inode)
++/* tell VM how many pages were dirtied */
++void reiser4_throttle_write(struct inode *inode, int nrpages)
+{
-+ reiser4_txn_restart_current();
-+ balance_dirty_pages_ratelimited(inode->i_mapping);
++ reiser4_context *ctx;
++
++ ctx = get_current_context();
++ reiser4_txn_restart(ctx);
++ current->journal_info = NULL;
++ balance_dirty_pages_ratelimited_nr(inode->i_mapping, nrpages);
++ current->journal_info = ctx;
+}
+
+const char *REISER4_SUPER_MAGIC_STRING = "ReIsEr4";
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/vfs_ops.h
---- /dev/null
-+++ a/fs/reiser4/vfs_ops.h
+diff -urN linux-2.6.35.orig/fs/reiser4/vfs_ops.h linux-2.6.35/fs/reiser4/vfs_ops.h
+--- linux-2.6.35.orig/fs/reiser4/vfs_ops.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/vfs_ops.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,53 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+extern int reiser4_del_nlink(struct inode *, struct inode *, int);
+
+extern int reiser4_start_up_io(struct page *page);
-+extern void reiser4_throttle_write(struct inode *);
++extern void reiser4_throttle_write(struct inode *, int nrpages);
+extern int jnode_is_releasable(jnode *);
+
+#define CAPTURE_APAGE_BURST (1024l)
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/wander.c
---- /dev/null
-+++ a/fs/reiser4/wander.c
-@@ -0,0 +1,1797 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/wander.c linux-2.6.35/fs/reiser4/wander.c
+--- linux-2.6.35.orig/fs/reiser4/wander.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/wander.c 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,1798 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+ This code guarantees that those blocks that are defined to be part of an
+ atom either all take effect or none of them take effect.
+
-+ Relocate set nodes are submitted to write by the jnode_flush() routine, and
-+ the overwrite set is submitted by reiser4_write_log(). This is because with
-+ the overwrite set we seek to optimize writes, and with the relocate set we
-+ seek to cause disk order to correlate with the parent first pre-order.
++ The "relocate set" of nodes are submitted to write by the jnode_flush()
++ routine, and the "overwrite set" is submitted by reiser4_write_log().
++ This is because with the overwrite set we seek to optimize writes, and
++ with the relocate set we seek to cause disk order to correlate with the
++ "parent first order" (preorder).
+
+ reiser4_write_log() allocates and writes wandered blocks and maintains
+ additional on-disk structures of the atom as wander records (each wander
+ fill-column: 80
+ End:
+*/
-diff -puN /dev/null fs/reiser4/wander.h
---- /dev/null
-+++ a/fs/reiser4/wander.h
+diff -urN linux-2.6.35.orig/fs/reiser4/wander.h linux-2.6.35/fs/reiser4/wander.h
+--- linux-2.6.35.orig/fs/reiser4/wander.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/wander.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,135 @@
+/* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
+
+ scroll-step: 1
+ End:
+*/
-diff -puN /dev/null fs/reiser4/writeout.h
---- /dev/null
-+++ a/fs/reiser4/writeout.h
+diff -urN linux-2.6.35.orig/fs/reiser4/writeout.h linux-2.6.35/fs/reiser4/writeout.h
+--- linux-2.6.35.orig/fs/reiser4/writeout.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/writeout.h 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,21 @@
+/* Copyright 2002, 2003, 2004 by Hans Reiser, licensing governed by reiser4/README */
+
+ fill-column: 80
+ End:
+*/
-diff -puN /dev/null fs/reiser4/znode.c
---- /dev/null
-+++ a/fs/reiser4/znode.c
+diff -urN linux-2.6.35.orig/fs/reiser4/znode.c linux-2.6.35/fs/reiser4/znode.c
+--- linux-2.6.35.orig/fs/reiser4/znode.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/znode.c 2010-08-04 15:44:57.000000000 +0200
@@ -0,0 +1,1029 @@
+/* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
+ * reiser4/README */
+ fill-column: 120
+ End:
+*/
-diff -puN /dev/null fs/reiser4/znode.h
---- /dev/null
-+++ a/fs/reiser4/znode.h
-@@ -0,0 +1,434 @@
+diff -urN linux-2.6.35.orig/fs/reiser4/znode.h linux-2.6.35/fs/reiser4/znode.h
+--- linux-2.6.35.orig/fs/reiser4/znode.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.35/fs/reiser4/znode.h 2010-08-04 15:44:57.000000000 +0200
+@@ -0,0 +1,433 @@
+/* Copyright 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
+ * reiser4/README */
+
+
+#include <linux/types.h>
+#include <linux/spinlock.h>
-+#include <linux/semaphore.h>
+#include <linux/pagemap.h> /* for PAGE_CACHE_SIZE */
+#include <asm/atomic.h>
+
+ fill-column: 120
+ End:
+*/
-_
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-. adjust reiser4 to the new aops (->write_begin, ->write_end)
-. add support of loop devices over cryptcompress files.
-
-Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/as_ops.c | 18 ----
- fs/reiser4/page_cache.c | 4 -
- fs/reiser4/plugin/file/cryptcompress.c | 56 +++++++++++---
- fs/reiser4/plugin/file/file.c | 61 +++------------
- fs/reiser4/plugin/file/file.h | 31 ++++---
- fs/reiser4/plugin/file/file_conversion.c | 83 +++++++++++++++++++++
- fs/reiser4/plugin/file_ops.c | 47 -----------
- fs/reiser4/plugin/object.c | 16 ++--
- fs/reiser4/plugin/object.h | 3
- fs/reiser4/plugin/plugin.h | 8 +-
- 10 files changed, 175 insertions(+), 152 deletions(-)
-
-diff -puN fs/reiser4/as_ops.c~reiser4-adjust-to-the-new-aops fs/reiser4/as_ops.c
---- a/fs/reiser4/as_ops.c~reiser4-adjust-to-the-new-aops
-+++ a/fs/reiser4/as_ops.c
-@@ -347,24 +347,6 @@ int reiser4_writepages(struct address_sp
- return inode_file_plugin(mapping->host)->writepages(mapping, wbc);
- }
-
--int reiser4_prepare_write(struct file *file, struct page *page,
-- unsigned from, unsigned to)
--{
-- return inode_file_plugin(file->f_dentry->d_inode)->prepare_write(file,
-- page,
-- from,
-- to);
--}
--
--int reiser4_commit_write(struct file *file, struct page *page,
-- unsigned from, unsigned to)
--{
-- return inode_file_plugin(file->f_dentry->d_inode)->commit_write(file,
-- page,
-- from,
-- to);
--}
--
- /* Make Linus happy.
- Local variables:
- c-indentation-style: "K&R"
-diff -puN fs/reiser4/page_cache.c~reiser4-adjust-to-the-new-aops fs/reiser4/page_cache.c
---- a/fs/reiser4/page_cache.c~reiser4-adjust-to-the-new-aops
-+++ a/fs/reiser4/page_cache.c
-@@ -560,8 +560,8 @@ static struct address_space_operations f
- .set_page_dirty = formatted_set_page_dirty,
- /* used for read-ahead. Not applicable */
- .readpages = NULL,
-- .prepare_write = NULL,
-- .commit_write = NULL,
-+ .write_begin = NULL,
-+ .write_end = NULL,
- .bmap = NULL,
- /* called just before page is being detached from inode mapping and
- removed from memory. Called on truncate, cut/squeeze, and
-diff -puN fs/reiser4/plugin/file/cryptcompress.c~reiser4-adjust-to-the-new-aops fs/reiser4/plugin/file/cryptcompress.c
---- a/fs/reiser4/plugin/file/cryptcompress.c~reiser4-adjust-to-the-new-aops
-+++ a/fs/reiser4/plugin/file/cryptcompress.c
-@@ -3405,11 +3405,12 @@ static int cryptcompress_truncate(struct
- return result;
- }
-
--/* Capture an anonymous pager cluster. (Page cluser is
-- * anonymous if it contains at least one anonymous page
-+/**
-+ * Capture a pager cluster.
-+ * @clust must be set up by a caller.
- */
--static int capture_anon_page_cluster(struct cluster_handle * clust,
-- struct inode * inode)
-+static int capture_page_cluster(struct cluster_handle * clust,
-+ struct inode * inode)
- {
- int result;
+diff -urN linux-2.6.35.orig/include/linux/fs.h linux-2.6.35/include/linux/fs.h
+--- linux-2.6.35.orig/include/linux/fs.h 2010-08-02 00:11:14.000000000 +0200
++++ linux-2.6.35/include/linux/fs.h 2010-08-04 18:01:31.000000000 +0200
+@@ -514,6 +514,7 @@
+ struct page;
+ struct address_space;
+ struct writeback_control;
++struct bdi_writeback;
-@@ -3420,6 +3421,7 @@ static int capture_anon_page_cluster(str
- result = prepare_logical_cluster(inode, 0, 0, clust, LC_APPOV);
- if (result)
- return result;
-+
- set_cluster_pages_dirty(clust, inode);
- result = checkin_logical_cluster(clust, inode);
- put_hint_cluster(clust, inode, ZNODE_WRITE_LOCK);
-@@ -3502,7 +3504,7 @@ static int capture_anon_pages(struct add
- break;
- }
- move_cluster_forward(&clust, inode, pages[0]->index);
-- result = capture_anon_page_cluster(&clust, inode);
-+ result = capture_page_cluster(&clust, inode);
-
- put_found_pages(pages, found); /* find_anon_page_cluster */
- if (result)
-@@ -3743,18 +3745,48 @@ int release_cryptcompress(struct inode *
- }
-
- /* plugin->prepare_write */
--int prepare_write_cryptcompress(struct file *file, struct page *page,
-- unsigned from, unsigned to)
-+int write_begin_cryptcompress(struct file *file, struct page *page,
-+ unsigned from, unsigned to)
- {
-- return -EINVAL;
-+ return do_prepare_write(file, page, from, to);
- }
-
- /* plugin->commit_write */
--int commit_write_cryptcompress(struct file *file, struct page *page,
-- unsigned from, unsigned to)
-+int write_end_cryptcompress(struct file *file, struct page *page,
-+ unsigned from, unsigned to)
- {
-- BUG();
-- return 0;
-+ int ret;
-+ hint_t *hint;
-+ lock_handle *lh;
-+ struct inode * inode;
-+ struct cluster_handle clust;
-+
-+ unlock_page(page);
-+
-+ inode = page->mapping->host;
-+ hint = kmalloc(sizeof(*hint), reiser4_ctx_gfp_mask_get());
-+ if (hint == NULL)
-+ return RETERR(-ENOMEM);
-+ hint_init_zero(hint);
-+ lh = &hint->lh;
-+
-+ cluster_init_read(&clust, NULL);
-+ clust.hint = hint;
-+
-+ ret = alloc_cluster_pgset(&clust, cluster_nrpages(inode));
-+ if (ret)
-+ goto out;
-+ clust.index = pg_to_clust(page->index, inode);
-+ ret = capture_page_cluster(&clust, inode);
-+ if (ret)
-+ warning("edward-1557",
-+ "Capture failed (inode %llu, result=%i)",
-+ (unsigned long long)get_inode_oid(inode), ret);
-+ out:
-+ done_lh(lh);
-+ kfree(hint);
-+ put_cluster_handle(&clust);
-+ return ret;
- }
-
- /* plugin->bmap */
-diff -puN fs/reiser4/plugin/file/file.c~reiser4-adjust-to-the-new-aops fs/reiser4/plugin/file/file.c
---- a/fs/reiser4/plugin/file/file.c~reiser4-adjust-to-the-new-aops
-+++ a/fs/reiser4/plugin/file/file.c
-@@ -889,36 +889,12 @@ static int capture_page_and_create_exten
- return result;
- }
-
--/* this is implementation of method commit_write of struct
-- address_space_operations for unix file plugin */
--int
--commit_write_unix_file(struct file *file, struct page *page,
-- unsigned from, unsigned to)
-+/* plugin->write_end() */
-+int write_end_unix_file(struct file *file, struct page *page,
-+ unsigned from, unsigned to)
- {
-- reiser4_context *ctx;
-- struct inode *inode;
-- int result;
--
-- assert("umka-3101", file != NULL);
-- assert("umka-3102", page != NULL);
-- assert("umka-3093", PageLocked(page));
--
-- SetPageUptodate(page);
--
-- inode = page->mapping->host;
-- ctx = reiser4_init_context(page->mapping->host->i_sb);
-- if (IS_ERR(ctx))
-- return PTR_ERR(ctx);
-- page_cache_get(page);
- unlock_page(page);
-- result = capture_page_and_create_extent(page);
-- lock_page(page);
-- page_cache_release(page);
--
-- /* don't commit transaction under inode semaphore */
-- context_set_commit_async(ctx);
-- reiser4_exit_context(ctx);
-- return result;
-+ return capture_page_and_create_extent(page);
- }
-
- /*
-@@ -2687,32 +2663,23 @@ int delete_object_unix_file(struct inode
- return reiser4_delete_object_common(inode);
- }
-
--int
--prepare_write_unix_file(struct file *file, struct page *page,
-- unsigned from, unsigned to)
-+/* plugin->write_begin() */
-+int write_begin_unix_file(struct file *file, struct page *page,
-+ unsigned from, unsigned to)
- {
-- reiser4_context *ctx;
-- struct unix_file_info *uf_info;
- int ret;
-+ struct unix_file_info *info;
-
-- ctx = reiser4_init_context(file->f_dentry->d_inode->i_sb);
-- if (IS_ERR(ctx))
-- return PTR_ERR(ctx);
--
-- uf_info = unix_file_inode_data(file->f_dentry->d_inode);
-- get_exclusive_access(uf_info);
-- ret = find_file_state(file->f_dentry->d_inode, uf_info);
-- if (ret == 0) {
-- if (uf_info->container == UF_CONTAINER_TAILS)
-+ info = unix_file_inode_data(file->f_dentry->d_inode);
-+ get_exclusive_access(info);
-+ ret = find_file_state(file->f_dentry->d_inode, info);
-+ if (likely(ret == 0)) {
-+ if (info->container == UF_CONTAINER_TAILS)
- ret = -EINVAL;
- else
- ret = do_prepare_write(file, page, from, to);
- }
-- drop_exclusive_access(uf_info);
+ struct iov_iter {
+ const struct iovec *iov;
+@@ -1572,7 +1573,12 @@
+ int (*remount_fs) (struct super_block *, int *, char *);
+ void (*clear_inode) (struct inode *);
+ void (*umount_begin) (struct super_block *);
-
-- /* don't commit transaction under inode semaphore */
-- context_set_commit_async(ctx);
-- reiser4_exit_context(ctx);
-+ drop_exclusive_access(info);
- return ret;
- }
-
-diff -puN fs/reiser4/plugin/file/file.h~reiser4-adjust-to-the-new-aops fs/reiser4/plugin/file/file.h
---- a/fs/reiser4/plugin/file/file.h~reiser4-adjust-to-the-new-aops
-+++ a/fs/reiser4/plugin/file/file.h
-@@ -59,10 +59,14 @@ int reiser4_readpage(struct file *, stru
- int reiser4_readpages(struct file*, struct address_space*, struct list_head*,
- unsigned);
- int reiser4_writepages(struct address_space *, struct writeback_control *);
--int reiser4_prepare_write(struct file *, struct page *, unsigned from,
-- unsigned to);
--int reiser4_commit_write(struct file *, struct page *, unsigned from,
-- unsigned to);
-+int reiser4_write_begin_careful(struct file *file,
-+ struct address_space *mapping,
-+ loff_t pos, unsigned len, unsigned flags,
-+ struct page **pagep, void **fsdata);
-+int reiser4_write_end_careful(struct file *file,
-+ struct address_space *mapping,
-+ loff_t pos, unsigned len, unsigned copied,
-+ struct page *page, void *fsdata);
- sector_t reiser4_bmap_careful(struct address_space *, sector_t lblock);
-
- /*
-@@ -87,12 +91,13 @@ int release_unix_file(struct inode *, st
-
- /* private address space operations */
- int readpage_unix_file(struct file *, struct page *);
--int readpages_unix_file(struct file*, struct address_space*, struct list_head*, unsigned);
-+int readpages_unix_file(struct file*, struct address_space*, struct list_head*,
-+ unsigned);
- int writepages_unix_file(struct address_space *, struct writeback_control *);
--int prepare_write_unix_file(struct file *, struct page *, unsigned from,
-- unsigned to);
--int commit_write_unix_file(struct file *, struct page *, unsigned from,
-- unsigned to);
-+int write_begin_unix_file(struct file *file, struct page *page,
-+ unsigned from, unsigned to);
-+int write_end_unix_file(struct file *file, struct page *page,
-+ unsigned from, unsigned to);
- sector_t bmap_unix_file(struct address_space *, sector_t lblock);
-
- /* other private methods */
-@@ -129,10 +134,10 @@ int readpages_cryptcompress(struct file*
- struct list_head*, unsigned);
- int writepages_cryptcompress(struct address_space *,
- struct writeback_control *);
--int prepare_write_cryptcompress(struct file *, struct page *, unsigned from,
-- unsigned to);
--int commit_write_cryptcompress(struct file *, struct page *, unsigned from,
-- unsigned to);
-+int write_begin_cryptcompress(struct file *file, struct page *page,
-+ unsigned from, unsigned to);
-+int write_end_cryptcompress(struct file *file, struct page *page,
-+ unsigned from, unsigned to);
- sector_t bmap_cryptcompress(struct address_space *, sector_t lblock);
++ int (*writeback_inodes)(struct super_block *sb,
++ struct bdi_writeback *wb,
++ struct writeback_control *wbc,
++ bool only_this_sb);
++ void (*sync_inodes) (struct super_block *sb,
++ struct writeback_control *wbc);
+ int (*show_options)(struct seq_file *, struct vfsmount *);
+ int (*show_stats)(struct seq_file *, struct vfsmount *);
+ #ifdef CONFIG_QUOTA
+@@ -2088,6 +2094,12 @@
+ extern int invalidate_inode_pages2_range(struct address_space *mapping,
+ pgoff_t start, pgoff_t end);
+ extern int write_inode_now(struct inode *, int);
++extern void writeback_skip_sb_inodes(struct super_block *sb,
++ struct bdi_writeback *wb);
++extern int generic_writeback_sb_inodes(struct super_block *sb,
++ struct bdi_writeback *wb,
++ struct writeback_control *wbc,
++ bool only_this_sb);
+ extern int filemap_fdatawrite(struct address_space *);
+ extern int filemap_flush(struct address_space *);
+ extern int filemap_fdatawait(struct address_space *);
+diff -urN linux-2.6.35.orig/include/linux/mm.h linux-2.6.35/include/linux/mm.h
+--- linux-2.6.35.orig/include/linux/mm.h 2010-08-02 00:11:14.000000000 +0200
++++ linux-2.6.35/include/linux/mm.h 2010-08-04 15:44:57.000000000 +0200
+@@ -857,6 +857,7 @@
+ void account_page_dirtied(struct page *page, struct address_space *mapping);
+ int set_page_dirty(struct page *page);
+ int set_page_dirty_lock(struct page *page);
++int set_page_dirty_notag(struct page *page);
+ int clear_page_dirty_for_io(struct page *page);
- /* other private methods */
-diff -puN fs/reiser4/plugin/file/file_conversion.c~reiser4-adjust-to-the-new-aops fs/reiser4/plugin/file/file_conversion.c
---- a/fs/reiser4/plugin/file/file_conversion.c~reiser4-adjust-to-the-new-aops
-+++ a/fs/reiser4/plugin/file/file_conversion.c
-@@ -667,6 +667,89 @@ sector_t reiser4_bmap_careful(struct add
- return PROT_PASSIVE(sector_t, bmap, (mapping, lblock));
- }
+ extern unsigned long move_page_tables(struct vm_area_struct *vma,
+diff -urN linux-2.6.35.orig/include/linux/writeback.h linux-2.6.35/include/linux/writeback.h
+--- linux-2.6.35.orig/include/linux/writeback.h 2010-08-02 00:11:14.000000000 +0200
++++ linux-2.6.35/include/linux/writeback.h 2010-08-04 15:44:57.000000000 +0200
+@@ -13,6 +13,12 @@
+ extern struct list_head inode_in_use;
+ extern struct list_head inode_unused;
-+int reiser4_write_begin_careful(struct file *file,
-+ struct address_space *mapping,
-+ loff_t pos,
-+ unsigned len,
-+ unsigned flags,
-+ struct page **pagep,
-+ void **fsdata)
-+{
-+ int ret = 0;
-+ unsigned start, end;
-+ struct page *page;
-+ pgoff_t index;
-+ reiser4_context *ctx;
-+ struct inode * inode = file->f_dentry->d_inode;
-+
-+ index = pos >> PAGE_CACHE_SHIFT;
-+ start = pos & (PAGE_CACHE_SIZE - 1);
-+ end = start + len;
-+
-+ page = __grab_cache_page(mapping, index);
-+ *pagep = page;
-+ if (!page)
-+ return -ENOMEM;
-+
-+ ctx = reiser4_init_context(file->f_dentry->d_inode->i_sb);
-+ if (IS_ERR(ctx)) {
-+ ret = PTR_ERR(ctx);
-+ goto out;
-+ }
-+ ret = PROT_PASSIVE(int, write_begin, (file, page, start, end));
-+
-+ /* don't commit transaction under inode semaphore */
-+ context_set_commit_async(ctx);
-+ reiser4_exit_context(ctx);
-+ out:
-+ if (unlikely(ret)) {
-+ unlock_page(page);
-+ page_cache_release(page);
-+ }
-+ return ret;
-+}
-+
-+int reiser4_write_end_careful(struct file *file,
-+ struct address_space *mapping,
-+ loff_t pos,
-+ unsigned len,
-+ unsigned copied,
-+ struct page *page,
-+ void *fsdata)
++static inline int is_flush_bd_task(struct task_struct *task)
+{
-+ int ret;
-+ reiser4_context *ctx;
-+ unsigned start, end;
-+ struct inode *inode = page->mapping->host;
-+
-+ assert("umka-3101", file != NULL);
-+ assert("umka-3102", page != NULL);
-+ assert("umka-3093", PageLocked(page));
-+
-+ start = pos & (PAGE_CACHE_SIZE - 1);
-+ end = start + len;
-+
-+ flush_dcache_page(page);
-+ SetPageUptodate(page);
-+
-+ ctx = reiser4_init_context(page->mapping->host->i_sb);
-+ if (IS_ERR(ctx)){
-+ unlock_page(page);
-+ ret = PTR_ERR(ctx);
-+ goto out;
-+ }
-+ ret = PROT_PASSIVE(int, write_end, (file, page, start, end));
-+
-+ /* don't commit transaction under inode semaphore */
-+ context_set_commit_async(ctx);
-+ reiser4_exit_context(ctx);
-+ out:
-+ page_cache_release(page);
-+ if (!ret)
-+ ret = copied;
-+ return ret;
++ return task->flags & PF_FLUSHER;
+}
++#define current_is_flush_bd_task() is_flush_bd_task(current)
+
/*
- * Wrappers without protection for:
- *
-diff -puN fs/reiser4/plugin/file_ops.c~reiser4-adjust-to-the-new-aops fs/reiser4/plugin/file_ops.c
---- a/fs/reiser4/plugin/file_ops.c~reiser4-adjust-to-the-new-aops
-+++ a/fs/reiser4/plugin/file_ops.c
-@@ -95,55 +95,12 @@ int reiser4_sync_file_common(struct file
- return 0;
- }
-
--/* this is common implementation of vfs's sendfile method of struct
-- file_operations
--
-- Reads @count bytes from @file and calls @actor for every page read. This is
-- needed for loop back devices support.
--*/
--#if 0
--ssize_t
--sendfile_common(struct file *file, loff_t *ppos, size_t count,
-- read_actor_t actor, void *target)
--{
-- reiser4_context *ctx;
-- ssize_t result;
--
-- ctx = reiser4_init_context(file->f_dentry->d_inode->i_sb);
-- if (IS_ERR(ctx))
-- return PTR_ERR(ctx);
-- result = generic_file_sendfile(file, ppos, count, actor, target);
-- reiser4_exit_context(ctx);
-- return result;
--}
--#endif /* 0 */
-
- /* address space operations */
-
--/* this is common implementation of vfs's prepare_write method of struct
-- address_space_operations
--*/
--int
--prepare_write_common(struct file *file, struct page *page, unsigned from,
-- unsigned to)
--{
-- reiser4_context *ctx;
-- int result;
-
-- ctx = reiser4_init_context(page->mapping->host->i_sb);
-- result = do_prepare_write(file, page, from, to);
--
-- /* don't commit transaction under inode semaphore */
-- context_set_commit_async(ctx);
-- reiser4_exit_context(ctx);
--
-- return result;
--}
--
--/* this is helper for prepare_write_common and prepare_write_unix_file
-- */
--int
--do_prepare_write(struct file *file, struct page *page, unsigned from,
-+/* this is helper for plugin->write_begin() */
-+int do_prepare_write(struct file *file, struct page *page, unsigned from,
- unsigned to)
- {
- int result;
-diff -puN fs/reiser4/plugin/object.c~reiser4-adjust-to-the-new-aops fs/reiser4/plugin/object.c
---- a/fs/reiser4/plugin/object.c~reiser4-adjust-to-the-new-aops
-+++ a/fs/reiser4/plugin/object.c
-@@ -114,8 +114,8 @@ static struct address_space_operations r
- .writepages = reiser4_writepages,
- .set_page_dirty = reiser4_set_page_dirty,
- .readpages = reiser4_readpages,
-- .prepare_write = reiser4_prepare_write,
-- .commit_write = reiser4_commit_write,
-+ .write_begin = reiser4_write_begin_careful,
-+ .write_end = reiser4_write_end_careful,
- .bmap = reiser4_bmap_careful,
- .invalidatepage = reiser4_invalidatepage,
- .releasepage = reiser4_releasepage
-@@ -165,8 +165,8 @@ static struct address_space_operations d
- .writepages = dummyop,
- .set_page_dirty = bugop,
- .readpages = bugop,
-- .prepare_write = bugop,
-- .commit_write = bugop,
-+ .write_begin = bugop,
-+ .write_end = bugop,
- .bmap = bugop,
- .invalidatepage = bugop,
- .releasepage = bugop
-@@ -209,8 +209,8 @@ file_plugin file_plugins[LAST_FILE_PLUGI
- .readpage = readpage_unix_file,
- .readpages = readpages_unix_file,
- .writepages = writepages_unix_file,
-- .prepare_write = prepare_write_unix_file,
-- .commit_write = commit_write_unix_file,
-+ .write_begin = write_begin_unix_file,
-+ .write_end = write_end_unix_file,
- /*
- * private a_ops
- */
-@@ -403,8 +403,8 @@ file_plugin file_plugins[LAST_FILE_PLUGI
- .readpage = readpage_cryptcompress,
- .readpages = readpages_cryptcompress,
- .writepages = writepages_cryptcompress,
-- .prepare_write = prepare_write_cryptcompress,
-- .commit_write = commit_write_cryptcompress,
-+ .write_begin = write_begin_cryptcompress,
-+ .write_end = write_end_cryptcompress,
-
- .bmap = bmap_cryptcompress,
-
-diff -puN fs/reiser4/plugin/object.h~reiser4-adjust-to-the-new-aops fs/reiser4/plugin/object.h
---- a/fs/reiser4/plugin/object.h~reiser4-adjust-to-the-new-aops
-+++ a/fs/reiser4/plugin/object.h
-@@ -36,9 +36,6 @@ int reiser4_readdir_common(struct file *
- int reiser4_release_dir_common(struct inode *, struct file *);
- int reiser4_sync_common(struct file *, struct dentry *, int datasync);
-
--/* common implementations of address space operations */
--int prepare_write_common(struct file *, struct page *, unsigned from,
-- unsigned to);
-
- /* file plugin operations: common implementations */
- int write_sd_by_inode_common(struct inode *);
-diff -puN fs/reiser4/plugin/plugin.h~reiser4-adjust-to-the-new-aops fs/reiser4/plugin/plugin.h
---- a/fs/reiser4/plugin/plugin.h~reiser4-adjust-to-the-new-aops
-+++ a/fs/reiser4/plugin/plugin.h
-@@ -248,10 +248,10 @@ typedef struct file_plugin {
- struct list_head *pages, unsigned nr_pages);
- int (*writepages)(struct address_space *mapping,
- struct writeback_control *wbc);
-- int (*prepare_write)(struct file *file, struct page *page,
-- unsigned from, unsigned to);
-- int (*commit_write)(struct file *file, struct page *page,
-- unsigned from, unsigned to);
-+ int (*write_begin)(struct file *file, struct page *page,
-+ unsigned from, unsigned to);
-+ int (*write_end)(struct file *file, struct page *page,
-+ unsigned from, unsigned to);
- sector_t (*bmap) (struct address_space * mapping, sector_t lblock);
- /* other private methods */
- /* save inode cached stat-data onto disk. It was called
-_
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Make sure that reiser4_write_begin() is not called for interruptible
-copies.
-
-Signed-off-by: Edward Shishkin<edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/plugin/file/file_conversion.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff -puN fs/reiser4/plugin/file/file_conversion.c~reiser4-adjust-to-the-new-aops-fixup fs/reiser4/plugin/file/file_conversion.c
---- a/fs/reiser4/plugin/file/file_conversion.c~reiser4-adjust-to-the-new-aops-fixup
-+++ a/fs/reiser4/plugin/file/file_conversion.c
-@@ -682,6 +682,12 @@ int reiser4_write_begin_careful(struct f
- reiser4_context *ctx;
- struct inode * inode = file->f_dentry->d_inode;
-
-+ /**
-+ * reiser4_write_end() can not cope with
-+ * short writes for now
-+ */
-+ BUG_ON(!(flags & AOP_FLAG_UNINTERRUPTIBLE));
-+
- index = pos >> PAGE_CACHE_SHIFT;
- start = pos & (PAGE_CACHE_SIZE - 1);
- end = start + len;
-_
-From: Laurent Riffard <laurent.riffard@free.fr>
-
-Reiser4 can't be built as a module when EXPORT_UNUSED_SYMBOL is not set.
-
-It's broken because reiser4_write_extent is calling
-simple_prepare_write() and commit
-4e02ed4b4a2fae34aae766a5bb93ae235f60adb8 scheduled it for unexporting.
-
-Signed-off-by: Laurent Riffard <laurent.riffard@free.fr>
-Acked-by: Edward Shishkin <edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/plugin/item/extent_file_ops.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff -puN fs/reiser4/plugin/item/extent_file_ops.c~reiser4-remove-simple_prepare_write-usage fs/reiser4/plugin/item/extent_file_ops.c
---- a/fs/reiser4/plugin/item/extent_file_ops.c~reiser4-remove-simple_prepare_write-usage
-+++ a/fs/reiser4/plugin/item/extent_file_ops.c
-@@ -1059,8 +1059,9 @@ ssize_t reiser4_write_extent(struct file
-
- lock_page(page);
- if (!PageUptodate(page) && to_page != PAGE_CACHE_SIZE)
-- simple_prepare_write(file, page, page_off,
-- page_off + to_page);
-+ zero_user_segments(page, 0, page_off,
-+ page_off + to_page,
-+ PAGE_CACHE_SIZE);
-
- written = filemap_copy_from_user(page, page_off, buf, to_page);
- if (unlikely(written != to_page)) {
-_
-From: Andrew Morton <akpm@linux-foundation.org>
-
-ERROR: code indent should use tabs where possible
-#27: FILE: fs/reiser4/plugin/item/extent_file_ops.c:1063:
-+^I^I^I page_off + to_page,$
-
-ERROR: code indent should use tabs where possible
-#28: FILE: fs/reiser4/plugin/item/extent_file_ops.c:1064:
-+^I^I^I PAGE_CACHE_SIZE);$
-
-total: 2 errors, 0 warnings, 11 lines checked
-
-./patches/reiser4-remove-simple_prepare_write-usage.patch has style problems, please review. If any of these errors
-are false positives report them to the maintainer, see
-CHECKPATCH in MAINTAINERS.
-
-Please run checkpatch prior to sending patches
-
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-Cc: Laurent Riffard <laurent.riffard@free.fr>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/plugin/item/extent_file_ops.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff -puN fs/reiser4/plugin/item/extent_file_ops.c~reiser4-remove-simple_prepare_write-usage-checkpatch-fixes fs/reiser4/plugin/item/extent_file_ops.c
---- a/fs/reiser4/plugin/item/extent_file_ops.c~reiser4-remove-simple_prepare_write-usage-checkpatch-fixes
-+++ a/fs/reiser4/plugin/item/extent_file_ops.c
-@@ -1060,8 +1060,8 @@ ssize_t reiser4_write_extent(struct file
- lock_page(page);
- if (!PageUptodate(page) && to_page != PAGE_CACHE_SIZE)
- zero_user_segments(page, 0, page_off,
-- page_off + to_page,
-- PAGE_CACHE_SIZE);
-+ page_off + to_page,
-+ PAGE_CACHE_SIZE);
-
- written = filemap_copy_from_user(page, page_off, buf, to_page);
- if (unlikely(written != to_page)) {
-_
-From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
-
-build fix.
-
-Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
-Cc: Nick Piggin <npiggin@suse.de>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/plugin/file/file_conversion.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff -puN fs/reiser4/plugin/file/file_conversion.c~fs-symlink-write_begin-allocation-context-fix-reiser4-fix fs/reiser4/plugin/file/file_conversion.c
---- a/fs/reiser4/plugin/file/file_conversion.c~fs-symlink-write_begin-allocation-context-fix-reiser4-fix
-+++ a/fs/reiser4/plugin/file/file_conversion.c
-@@ -692,7 +692,8 @@ int reiser4_write_begin_careful(struct f
- start = pos & (PAGE_CACHE_SIZE - 1);
- end = start + len;
-
-- page = __grab_cache_page(mapping, index);
-+ page = grab_cache_page_write_begin(mapping, index,
-+ flags & AOP_FLAG_NOFS);
- *pagep = page;
- if (!page)
- return -ENOMEM;
-_
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-. Fix up incorrect handling errors reterned by d_obtain_alias.
-. Make quilt, checkpatch happy:
- remove comment with "joke not for everyone".
-
-Signed-off-by: Edward Shishkin<edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/plugin/dir_plugin_common.c | 10 +---------
- fs/reiser4/plugin/file_plugin_common.c | 5 +----
- 2 files changed, 2 insertions(+), 13 deletions(-)
-
-diff -puN fs/reiser4/plugin/dir_plugin_common.c~reiser4-handling-error-returned-by-d_obtain_alias-fixup fs/reiser4/plugin/dir_plugin_common.c
---- a/fs/reiser4/plugin/dir_plugin_common.c~reiser4-handling-error-returned-by-d_obtain_alias-fixup
-+++ a/fs/reiser4/plugin/dir_plugin_common.c
-@@ -56,10 +56,7 @@ struct dentry *get_parent_common(struct
- check_light_weight(parent, child);
- reiser4_iget_complete(parent);
- dentry = d_obtain_alias(parent);
-- if (dentry == NULL) {
-- iput(parent);
-- dentry = ERR_PTR(RETERR(-ENOMEM));
-- } else
-+ if (!IS_ERR(dentry))
- dentry->d_op = &get_super_private(s)->ops.dentry;
- } else if (PTR_ERR(parent) == -ENOENT)
- dentry = ERR_PTR(RETERR(-ESTALE));
-@@ -353,11 +350,6 @@ int reiser4_dir_done_common(struct inode
- result = reiser4_rem_entry_common(object, &goodby_dots, &entry);
- reiser4_free_dentry_fsdata(&goodby_dots);
- if (unlikely(result != 0 && result != -ENOMEM && result != -ENOENT))
-- /* only worth a warning
--
-- "values of \ eB\ f will give rise to dom!\n"
-- -- v6src/s2/mv.c:89
-- */
- warning("nikita-2252", "Cannot remove dot of %lli: %i",
- (unsigned long long)get_inode_oid(object), result);
- return 0;
-diff -puN fs/reiser4/plugin/file_plugin_common.c~reiser4-handling-error-returned-by-d_obtain_alias-fixup fs/reiser4/plugin/file_plugin_common.c
---- a/fs/reiser4/plugin/file_plugin_common.c~reiser4-handling-error-returned-by-d_obtain_alias-fixup
-+++ a/fs/reiser4/plugin/file_plugin_common.c
-@@ -476,10 +476,7 @@ struct dentry *wire_get_common(struct su
- if (!IS_ERR(inode)) {
- reiser4_iget_complete(inode);
- dentry = d_obtain_alias(inode);
-- if (dentry == NULL) {
-- iput(inode);
-- dentry = ERR_PTR(-ENOMEM);
-- } else
-+ if (!IS_ERR(dentry))
- dentry->d_op = &get_super_private(sb)->ops.dentry;
- } else if (PTR_ERR(inode) == -ENOENT)
- /*
-_
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Update names of quota methods
-
-Signed-off-by: Edward Shishkin<edward.shishkin@gmail.com>
-Acked-by: Jan Kara <jack@suse.cz>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/plugin/file_plugin_common.c | 4 ++--
- fs/reiser4/plugin/inode_ops.c | 20 ++++++++++----------
- fs/reiser4/plugin/item/cde.c | 4 ++--
- fs/reiser4/plugin/item/extent_file_ops.c | 10 ++++++----
- fs/reiser4/plugin/item/extent_item_ops.c | 2 +-
- fs/reiser4/plugin/item/sde.c | 4 ++--
- fs/reiser4/plugin/item/tail.c | 16 ++++++++--------
- 7 files changed, 31 insertions(+), 29 deletions(-)
-
-diff -puN fs/reiser4/plugin/file_plugin_common.c~reiser4-update-names-of-quota-methods fs/reiser4/plugin/file_plugin_common.c
---- a/fs/reiser4/plugin/file_plugin_common.c~reiser4-update-names-of-quota-methods
-+++ a/fs/reiser4/plugin/file_plugin_common.c
-@@ -944,8 +944,8 @@ common_object_delete_no_reserve(struct i
- if (!reiser4_inode_get_flag(inode, REISER4_NO_SD)) {
- reiser4_key sd_key;
-
-- DQUOT_FREE_INODE(inode);
-- DQUOT_DROP(inode);
-+ vfs_dq_free_inode(inode);
-+ vfs_dq_drop(inode);
-
- build_sd_key(inode, &sd_key);
- result =
-diff -puN fs/reiser4/plugin/inode_ops.c~reiser4-update-names-of-quota-methods fs/reiser4/plugin/inode_ops.c
---- a/fs/reiser4/plugin/inode_ops.c~reiser4-update-names-of-quota-methods
-+++ a/fs/reiser4/plugin/inode_ops.c
-@@ -453,7 +453,7 @@ int reiser4_setattr_common(struct dentry
- if ((attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid)
- || (attr->ia_valid & ATTR_GID
- && attr->ia_gid != inode->i_gid)) {
-- result = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0;
-+ result = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0;
- if (result) {
- context_set_commit_async(ctx);
- reiser4_exit_context(ctx);
-@@ -593,8 +593,8 @@ static int do_create_vfs_child(reiser4_o
- /* So that on error iput will be called. */
- *retobj = object;
-
-- if (DQUOT_ALLOC_INODE(object)) {
-- DQUOT_DROP(object);
-+ if (vfs_dq_alloc_inode(object)) {
-+ vfs_dq_drop(object);
- object->i_flags |= S_NOQUOTA;
- return RETERR(-EDQUOT);
- }
-@@ -608,7 +608,7 @@ static int do_create_vfs_child(reiser4_o
- if (result) {
- warning("nikita-431", "Cannot install plugin %i on %llx",
- data->id, (unsigned long long)get_inode_oid(object));
-- DQUOT_FREE_INODE(object);
-+ vfs_dq_free_inode(object);
- object->i_flags |= S_NOQUOTA;
- return result;
- }
-@@ -617,7 +617,7 @@ static int do_create_vfs_child(reiser4_o
- obj_plug = inode_file_plugin(object);
-
- if (obj_plug->create_object == NULL) {
-- DQUOT_FREE_INODE(object);
-+ vfs_dq_free_inode(object);
- object->i_flags |= S_NOQUOTA;
- return RETERR(-EPERM);
- }
-@@ -636,7 +636,7 @@ static int do_create_vfs_child(reiser4_o
- warning("nikita-432", "Cannot inherit from %llx to %llx",
- (unsigned long long)get_inode_oid(parent),
- (unsigned long long)get_inode_oid(object));
-- DQUOT_FREE_INODE(object);
-+ vfs_dq_free_inode(object);
- object->i_flags |= S_NOQUOTA;
- return result;
- }
-@@ -652,7 +652,7 @@ static int do_create_vfs_child(reiser4_o
- /* obtain directory plugin (if any) for new object. */
- obj_dir = inode_dir_plugin(object);
- if (obj_dir != NULL && obj_dir->init == NULL) {
-- DQUOT_FREE_INODE(object);
-+ vfs_dq_free_inode(object);
- object->i_flags |= S_NOQUOTA;
- return RETERR(-EPERM);
- }
-@@ -661,7 +661,7 @@ static int do_create_vfs_child(reiser4_o
-
- reserve = estimate_create_vfs_object(parent, object);
- if (reiser4_grab_space(reserve, BA_CAN_COMMIT)) {
-- DQUOT_FREE_INODE(object);
-+ vfs_dq_free_inode(object);
- object->i_flags |= S_NOQUOTA;
- return RETERR(-ENOSPC);
- }
-@@ -692,7 +692,7 @@ static int do_create_vfs_child(reiser4_o
- warning("nikita-2219",
- "Failed to create sd for %llu",
- (unsigned long long)get_inode_oid(object));
-- DQUOT_FREE_INODE(object);
-+ vfs_dq_free_inode(object);
- object->i_flags |= S_NOQUOTA;
- return result;
- }
-@@ -735,7 +735,7 @@ static int do_create_vfs_child(reiser4_o
- */
- reiser4_update_sd(object);
- if (result != 0) {
-- DQUOT_FREE_INODE(object);
-+ vfs_dq_free_inode(object);
- object->i_flags |= S_NOQUOTA;
- /* if everything was ok (result == 0), parent stat-data is
- * already updated above (update_parent_dir()) */
-diff -puN fs/reiser4/plugin/item/cde.c~reiser4-update-names-of-quota-methods fs/reiser4/plugin/item/cde.c
---- a/fs/reiser4/plugin/item/cde.c~reiser4-update-names-of-quota-methods
-+++ a/fs/reiser4/plugin/item/cde.c
-@@ -932,7 +932,7 @@ int add_entry_cde(struct inode *dir /* d
- data.length = estimate_cde(result ? coord : NULL, &data);
-
- /* NOTE-NIKITA quota plugin? */
-- if (DQUOT_ALLOC_SPACE_NODIRTY(dir, cde_bytes(result, &data)))
-+ if (vfs_dq_alloc_space_nodirty(dir, cde_bytes(result, &data)))
- return RETERR(-EDQUOT);
-
- if (result)
-@@ -983,7 +983,7 @@ int rem_entry_cde(struct inode *dir /* d
- kill_node_content(coord, &shadow, NULL, NULL, NULL, NULL, NULL, 0);
- if (result == 0) {
- /* NOTE-NIKITA quota plugin? */
-- DQUOT_FREE_SPACE_NODIRTY(dir, length);
-+ vfs_dq_free_space_nodirty(dir, length);
- }
- return result;
- }
-diff -puN fs/reiser4/plugin/item/extent_file_ops.c~reiser4-update-names-of-quota-methods fs/reiser4/plugin/item/extent_file_ops.c
---- a/fs/reiser4/plugin/item/extent_file_ops.c~reiser4-update-names-of-quota-methods
-+++ a/fs/reiser4/plugin/item/extent_file_ops.c
-@@ -260,8 +260,8 @@ static int append_last_extent(uf_coord_t
-
- assert("", get_key_offset(key) == (loff_t)index_jnode(jnodes[0]) * PAGE_CACHE_SIZE);
-
-- result = DQUOT_ALLOC_BLOCK_NODIRTY(mapping_jnode(jnodes[0])->host,
-- count);
-+ result = vfs_dq_alloc_block_nodirty(mapping_jnode(jnodes[0])->host,
-+ count);
- BUG_ON(result != 0);
-
- switch (state_of_extent(ext)) {
-@@ -408,7 +408,8 @@ static int insert_first_extent(uf_coord_
- if (count == 0)
- return 0;
-
-- result = DQUOT_ALLOC_BLOCK_NODIRTY(mapping_jnode(jnodes[0])->host, count);
-+ result = vfs_dq_alloc_block_nodirty(mapping_jnode(jnodes[0])->host,
-+ count);
- BUG_ON(result != 0);
-
- /*
-@@ -622,7 +623,8 @@ static int overwrite_one_block(uf_coord_
- break;
-
- case HOLE_EXTENT:
-- result = DQUOT_ALLOC_BLOCK_NODIRTY(mapping_jnode(node)->host, 1);
-+ result = vfs_dq_alloc_block_nodirty(mapping_jnode(node)->host,
-+ 1);
- BUG_ON(result != 0);
- result = plug_hole(uf_coord, key, &how);
- if (result)
-diff -puN fs/reiser4/plugin/item/extent_item_ops.c~reiser4-update-names-of-quota-methods fs/reiser4/plugin/item/extent_item_ops.c
---- a/fs/reiser4/plugin/item/extent_item_ops.c~reiser4-update-names-of-quota-methods
-+++ a/fs/reiser4/plugin/item/extent_item_ops.c
-@@ -468,7 +468,7 @@ kill_hook_extent(const coord_t * coord,
- length = to_off - offset;
- }
-
-- DQUOT_FREE_BLOCK_NODIRTY(inode, length);
-+ vfs_dq_free_block_nodirty(inode, length);
-
- if (state_of_extent(ext) == UNALLOCATED_EXTENT) {
- /* some jnodes corresponding to this unallocated extent */
-diff -puN fs/reiser4/plugin/item/sde.c~reiser4-update-names-of-quota-methods fs/reiser4/plugin/item/sde.c
---- a/fs/reiser4/plugin/item/sde.c~reiser4-update-names-of-quota-methods
-+++ a/fs/reiser4/plugin/item/sde.c
-@@ -120,7 +120,7 @@ int add_entry_de(struct inode *dir /* di
- data.iplug = item_plugin_by_id(SIMPLE_DIR_ENTRY_ID);
-
- /* NOTE-NIKITA quota plugin */
-- if (DQUOT_ALLOC_SPACE_NODIRTY(dir, data.length))
-+ if (vfs_dq_alloc_space_nodirty(dir, data.length))
- return -EDQUOT;
-
- result = insert_by_coord(coord, &data, &entry->key, lh, 0 /*flags */ );
-@@ -168,7 +168,7 @@ int rem_entry_de(struct inode *dir /* di
- kill_node_content(coord, &shadow, NULL, NULL, NULL, NULL, NULL, 0);
- if (result == 0) {
- /* NOTE-NIKITA quota plugin */
-- DQUOT_FREE_SPACE_NODIRTY(dir, length);
-+ vfs_dq_free_space_nodirty(dir, length);
- }
- return result;
- }
-diff -puN fs/reiser4/plugin/item/tail.c~reiser4-update-names-of-quota-methods fs/reiser4/plugin/item/tail.c
---- a/fs/reiser4/plugin/item/tail.c~reiser4-update-names-of-quota-methods
-+++ a/fs/reiser4/plugin/item/tail.c
-@@ -494,11 +494,11 @@ static ssize_t insert_first_tail(struct
- * were real data which are all zeros. Therefore we have to
- * allocate quota here as well
- */
-- if (DQUOT_ALLOC_SPACE_NODIRTY(inode, flow->length))
-+ if (vfs_dq_alloc_space_nodirty(inode, flow->length))
- return RETERR(-EDQUOT);
- result = reiser4_insert_flow(coord, lh, flow);
- if (flow->length)
-- DQUOT_FREE_SPACE_NODIRTY(inode, flow->length);
-+ vfs_dq_free_space_nodirty(inode, flow->length);
-
- uf_info = unix_file_inode_data(inode);
-
-@@ -518,13 +518,13 @@ static ssize_t insert_first_tail(struct
- }
-
- /* check quota before appending data */
-- if (DQUOT_ALLOC_SPACE_NODIRTY(inode, flow->length))
-+ if (vfs_dq_alloc_space_nodirty(inode, flow->length))
- return RETERR(-EDQUOT);
-
- to_write = flow->length;
- result = reiser4_insert_flow(coord, lh, flow);
- if (flow->length)
-- DQUOT_FREE_SPACE_NODIRTY(inode, flow->length);
-+ vfs_dq_free_space_nodirty(inode, flow->length);
- return (to_write - flow->length) ? (to_write - flow->length) : result;
- }
-
-@@ -553,22 +553,22 @@ static ssize_t append_tail(struct inode
- * were real data which are all zeros. Therefore we have to
- * allocate quota here as well
- */
-- if (DQUOT_ALLOC_SPACE_NODIRTY(inode, flow->length))
-+ if (vfs_dq_alloc_space_nodirty(inode, flow->length))
- return RETERR(-EDQUOT);
- result = reiser4_insert_flow(coord, lh, flow);
- if (flow->length)
-- DQUOT_FREE_SPACE_NODIRTY(inode, flow->length);
-+ vfs_dq_free_space_nodirty(inode, flow->length);
- return result;
- }
-
- /* check quota before appending data */
-- if (DQUOT_ALLOC_SPACE_NODIRTY(inode, flow->length))
-+ if (vfs_dq_alloc_space_nodirty(inode, flow->length))
- return RETERR(-EDQUOT);
-
- to_write = flow->length;
- result = reiser4_insert_flow(coord, lh, flow);
- if (flow->length)
-- DQUOT_FREE_SPACE_NODIRTY(inode, flow->length);
-+ vfs_dq_free_space_nodirty(inode, flow->length);
- return (to_write - flow->length) ? (to_write - flow->length) : result;
- }
-
-_
-From: Jiri Slaby <jirislaby@gmail.com>
-
-Change !X & Y to !(X & Y) to avoid compiler confusion and fix a bug.
-
-Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/carry_ops.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff -puN fs/reiser4/carry_ops.c~fs-reiser4-add-parenths-around-x-y fs/reiser4/carry_ops.c
---- a/fs/reiser4/carry_ops.c~fs-reiser4-add-parenths-around-x-y
-+++ a/fs/reiser4/carry_ops.c
-@@ -79,7 +79,7 @@ static carry_node *find_left_neighbor(ca
- left->free = 1;
-
- flags = GN_TRY_LOCK;
-- if (!op->u.insert.flags & COPI_LOAD_LEFT)
-+ if (!(op->u.insert.flags & COPI_LOAD_LEFT))
- flags |= GN_NO_ALLOC;
-
- /* then, feeling lucky, peek left neighbor in the cache. */
-@@ -203,7 +203,7 @@ static carry_node *find_right_neighbor(c
- read_unlock_tree(tree);
-
- flags = GN_CAN_USE_UPPER_LEVELS;
-- if (!op->u.insert.flags & COPI_LOAD_RIGHT)
-+ if (!(op->u.insert.flags & COPI_LOAD_RIGHT))
- flags = GN_NO_ALLOC;
-
- /* then, try to lock right neighbor */
-_
-From: Andrew Morton <akpm@linux-foundation.org>
-
-No longer in linux-next.
-
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/context.c | 3 +--
- fs/reiser4/txnmgr.c | 2 +-
- 2 files changed, 2 insertions(+), 3 deletions(-)
-
-diff -puN fs/reiser4/context.c~fs-reiser4-contextc-current_is_pdflush-got-removed fs/reiser4/context.c
---- a/fs/reiser4/context.c~fs-reiser4-contextc-current_is_pdflush-got-removed
-+++ a/fs/reiser4/context.c
-@@ -151,8 +151,7 @@ static void balance_dirty_pages_at(reise
- */
- if (sbinfo != NULL && sbinfo->fake != NULL &&
- context->nr_marked_dirty != 0 &&
-- !(current->flags & PF_MEMALLOC) &&
-- !current_is_pdflush())
-+ !(current->flags & PF_MEMALLOC))
- balance_dirty_pages_ratelimited(sbinfo->fake->i_mapping);
- }
-
-diff -puN fs/reiser4/txnmgr.c~fs-reiser4-contextc-current_is_pdflush-got-removed fs/reiser4/txnmgr.c
---- a/fs/reiser4/txnmgr.c~fs-reiser4-contextc-current_is_pdflush-got-removed
-+++ a/fs/reiser4/txnmgr.c
-@@ -1410,7 +1410,7 @@ flush_some_atom(jnode * start, long *nr_
- * Write throttling is case of no one atom can be
- * flushed/committed.
- */
-- if (!current_is_pdflush() && !wbc->nonblocking) {
-+ if (!wbc->nonblocking) {
- list_for_each_entry(atom, &tmgr->atoms_list, atom_link) {
- spin_lock_atom(atom);
- /* Repeat the check from the above. */
-_
-From: Andrew Morton <akpm@linux-foundation.org>
-
-generic_sync_sb_indeos() changed
-
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/entd.c | 2 +-
- fs/reiser4/super_ops.c | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff -puN fs/reiser4/entd.c~reiser4-fix fs/reiser4/entd.c
---- a/fs/reiser4/entd.c~reiser4-fix
-+++ a/fs/reiser4/entd.c
-@@ -241,7 +241,7 @@ static void entd_flush(struct super_bloc
- if (rq->wbc->nr_to_write > 0) {
- rq->wbc->range_start = 0;
- rq->wbc->range_end = LLONG_MAX;
-- generic_sync_sb_inodes(super, rq->wbc);
-+ generic_sync_sb_inodes(rq->wbc);
- }
- rq->wbc->nr_to_write = ENTD_CAPTURE_APAGE_BURST;
- reiser4_writeout(super, rq->wbc);
-diff -puN fs/reiser4/super_ops.c~reiser4-fix fs/reiser4/super_ops.c
---- a/fs/reiser4/super_ops.c~reiser4-fix
-+++ a/fs/reiser4/super_ops.c
-@@ -412,7 +412,7 @@ static void reiser4_sync_inodes(struct s
- * call reiser4_writepages for each of dirty inodes to turn dirty pages
- * into transactions if they were not yet.
- */
-- generic_sync_sb_inodes(super, wbc);
-+ generic_sync_sb_inodes(wbc);
-
- /* flush goes here */
- wbc->nr_to_write = to_write;
-_
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-. Rename confusing "psched" to "dispatch";
-. Cleanups.
-
-Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/plugin/file/cryptcompress.c | 27 +---
- fs/reiser4/plugin/file/cryptcompress.h | 8 -
- fs/reiser4/plugin/file/file.c | 6
- fs/reiser4/plugin/file/file.h | 20 +--
- fs/reiser4/plugin/file/file_conversion.c | 136 ++++++++-------------
- fs/reiser4/plugin/plugin.h | 2
- 6 files changed, 83 insertions(+), 116 deletions(-)
-
-diff -puN fs/reiser4/plugin/file/cryptcompress.c~reiser4-rename-psched-to-dispatch fs/reiser4/plugin/file/cryptcompress.c
---- a/fs/reiser4/plugin/file/cryptcompress.c~reiser4-rename-psched-to-dispatch
-+++ a/fs/reiser4/plugin/file/cryptcompress.c
-@@ -2642,7 +2642,7 @@ void reset_cluster_params(struct cluster
- /* the heart of write_cryptcompress */
- static loff_t do_write_cryptcompress(struct file *file, struct inode *inode,
- const char __user *buf, size_t to_write,
-- loff_t pos, struct psched_context *cont)
-+ loff_t pos, struct dispatch_context *cont)
- {
- int i;
- hint_t *hint;
-@@ -2683,10 +2683,8 @@ static loff_t do_write_cryptcompress(str
- if (next_window_stat(&win) == HOLE_WINDOW) {
- /* write hole in this iteration
- separated from the loop below */
-- result = write_pschedule_hook(file, inode,
-- pos,
-- &clust,
-- cont);
-+ result = write_dispatch_hook(file, inode,
-+ pos, &clust, cont);
- if (result)
- goto out;
- result = prepare_logical_cluster(inode, pos, count, &clust,
-@@ -2700,14 +2698,13 @@ static loff_t do_write_cryptcompress(str
-
- assert("edward-750", reiser4_schedulable());
-
-- result = write_pschedule_hook(file, inode,
-- pos + to_write - count,
-- &clust,
-- cont);
-+ result = write_dispatch_hook(file, inode,
-+ pos + to_write - count,
-+ &clust, cont);
- if (result)
- goto out;
-- if (cont->state == PSCHED_ASSIGNED_NEW)
-- /* done_lh was called in write_pschedule_hook */
-+ if (cont->state == DISPATCH_ASSIGNED_NEW)
-+ /* done_lh was called in write_dispatch_hook */
- goto out_no_longterm_lock;
-
- result = prepare_logical_cluster(inode, pos, count, &clust,
-@@ -2787,7 +2784,7 @@ static loff_t do_write_cryptcompress(str
- put_cluster_handle(&clust);
- assert("edward-195",
- ergo((to_write == count),
-- (result < 0 || cont->state == PSCHED_ASSIGNED_NEW)));
-+ (result < 0 || cont->state == DISPATCH_ASSIGNED_NEW)));
- return (to_write - count) ? (to_write - count) : result;
- }
-
-@@ -2800,7 +2797,7 @@ static loff_t do_write_cryptcompress(str
- */
- ssize_t write_cryptcompress(struct file *file, const char __user *buf,
- size_t count, loff_t *off,
-- struct psched_context *cont)
-+ struct dispatch_context *cont)
- {
- ssize_t result;
- struct inode *inode;
-@@ -2808,7 +2805,7 @@ ssize_t write_cryptcompress(struct file
- loff_t pos = *off;
- struct cryptcompress_info *info;
-
-- assert("edward-1449", cont->state == PSCHED_INVAL_STATE);
-+ assert("edward-1449", cont->state == DISPATCH_INVAL_STATE);
-
- inode = file->f_dentry->d_inode;
- assert("edward-196", cryptcompress_inode_ok(inode));
-@@ -3701,7 +3698,7 @@ int setattr_cryptcompress(struct dentry
- ctx = reiser4_init_context(dentry->d_inode->i_sb);
- if (IS_ERR(ctx))
- return PTR_ERR(ctx);
-- result = setattr_pschedule_hook(inode);
-+ result = setattr_dispatch_hook(inode);
- if (result) {
- context_set_commit_async(ctx);
- reiser4_exit_context(ctx);
-diff -puN fs/reiser4/plugin/file/cryptcompress.h~reiser4-rename-psched-to-dispatch fs/reiser4/plugin/file/cryptcompress.h
---- a/fs/reiser4/plugin/file/cryptcompress.h~reiser4-rename-psched-to-dispatch
-+++ a/fs/reiser4/plugin/file/cryptcompress.h
-@@ -562,10 +562,10 @@ int bind_cryptcompress(struct inode *chi
- void destroy_inode_cryptcompress(struct inode * inode);
- int grab_page_cluster(struct inode *inode, struct cluster_handle * clust,
- rw_op rw);
--int write_pschedule_hook(struct file *file, struct inode * inode,
-- loff_t pos, struct cluster_handle * clust,
-- struct psched_context * cont);
--int setattr_pschedule_hook(struct inode * inode);
-+int write_dispatch_hook(struct file *file, struct inode * inode,
-+ loff_t pos, struct cluster_handle * clust,
-+ struct dispatch_context * cont);
-+int setattr_dispatch_hook(struct inode * inode);
- struct reiser4_crypto_info * inode_crypto_info(struct inode * inode);
- void inherit_crypto_info_common(struct inode * parent, struct inode * object,
- int (*can_inherit)(struct inode * child,
-diff -puN fs/reiser4/plugin/file/file.c~reiser4-rename-psched-to-dispatch fs/reiser4/plugin/file/file.c
---- a/fs/reiser4/plugin/file/file.c~reiser4-rename-psched-to-dispatch
-+++ a/fs/reiser4/plugin/file/file.c
-@@ -2059,8 +2059,10 @@ static void drop_access(struct unix_file
- * @cont: unused argument, as we don't perform plugin conversion when being
- * managed by unix_file plugin.
- */
--ssize_t write_unix_file(struct file *file, const char __user *buf,
-- size_t count, loff_t *pos, struct psched_context *cont)
-+ssize_t write_unix_file(struct file *file,
-+ const char __user *buf,
-+ size_t count, loff_t *pos,
-+ struct dispatch_context *cont)
- {
- int result;
- reiser4_context *ctx;
-diff -puN fs/reiser4/plugin/file/file.h~reiser4-rename-psched-to-dispatch fs/reiser4/plugin/file/file.h
---- a/fs/reiser4/plugin/file/file.h~reiser4-rename-psched-to-dispatch
-+++ a/fs/reiser4/plugin/file/file.h
-@@ -8,18 +8,18 @@
- #if !defined( __REISER4_FILE_H__ )
- #define __REISER4_FILE_H__
-
--/* possible states when scheduling a new file plugin */
-+/* possible states in dispatching process */
- typedef enum {
-- PSCHED_INVAL_STATE, /* invalid state */
-- PSCHED_SCHED_POINT, /* scheduling point has been achieved */
-- PSCHED_REMAINS_OLD, /* made a decision to be managed by old plugin */
-- PSCHED_ASSIGNED_NEW /* new plugin has been scheduled */
--} psched_state;
-+ DISPATCH_INVAL_STATE, /* invalid state */
-+ DISPATCH_POINT, /* dispatching point has been achieved */
-+ DISPATCH_REMAINS_OLD, /* made a decision to manage by old plugin */
-+ DISPATCH_ASSIGNED_NEW /* a new plugin has been assigned */
-+} dispatch_state;
-
--struct psched_context {
-+struct dispatch_context {
- int nr_pages;
- struct page **pages;
-- psched_state state;
-+ dispatch_state state;
- };
-
- /**
-@@ -82,7 +82,7 @@ int setattr_unix_file(struct dentry *, s
- ssize_t read_unix_file(struct file *, char __user *buf, size_t read_amount,
- loff_t *off);
- ssize_t write_unix_file(struct file *, const char __user *buf, size_t write_amount,
-- loff_t * off, struct psched_context * cont);
-+ loff_t * off, struct dispatch_context * cont);
- int ioctl_unix_file(struct inode *, struct file *, unsigned int cmd,
- unsigned long arg);
- int mmap_unix_file(struct file *, struct vm_area_struct *);
-@@ -121,7 +121,7 @@ ssize_t read_cryptcompress(struct file *
- size_t count, loff_t *off);
- ssize_t write_cryptcompress(struct file *, const char __user *buf,
- size_t count, loff_t * off,
-- struct psched_context *cont);
-+ struct dispatch_context *cont);
- int ioctl_cryptcompress(struct inode *, struct file *, unsigned int cmd,
- unsigned long arg);
- int mmap_cryptcompress(struct file *, struct vm_area_struct *);
-diff -puN fs/reiser4/plugin/file/file_conversion.c~reiser4-rename-psched-to-dispatch fs/reiser4/plugin/file/file_conversion.c
---- a/fs/reiser4/plugin/file/file_conversion.c~reiser4-rename-psched-to-dispatch
-+++ a/fs/reiser4/plugin/file/file_conversion.c
-@@ -2,62 +2,30 @@
- licensing governed by reiser4/README */
-
- /**
-- * This file contains plugin schedule hooks, and plugin conversion methods.
-+ * This file contains dispatching hooks, and conversion methods, which
-+ * implement transitions in the FILE interface.
- *
-- * Plugin schedule hook makes a decision (at plugin schedule point) about the
-- * most reasonable plugins for managing a regular file. Usually such decisions
-- * is made by some O(1)-heuristic.
-- *
-- * By default we assign a unix_file plugin id when writing incompressible file
-- * managed by cryptcompress plugin id. Currently used heuristic for estimating
-- * compressibility is very simple: if first complete logical cluster (64K by
-- * default) of a file is incompressible, then we make a decision, that the whole
-- * file is incompressible (*).
-- *
-- * To enable a conversion we install a special "magic" compression mode plugin
-- * (CONVX_COMPRESSION_MODE_ID, see plugin/compress/compress_mode.c for details)
-- * at file creation time (**).
-- *
-- * Note, that we don't perform back conversion (unix_file->cryptcompress)
-- * because of compatibility reasons (see http://dev.namesys.com/Version4.X.Y
-- * for details).
-- *
-- * The conversion is accompanied by rebuilding disk structures of a file, so it
-- * is important to protect them from being interacted with other plugins which
-- * don't expect them to be in such inconsistent state. For this to be protected
-- * we serialize readers and writers of a file's conversion set (FCS).
-- *
-- * We define FCS as a file plugin installed in inode's pset plus file's data
-- * and metadata that this file plugin manipulates with (items, etc).
-- * Note, that FCS is defined per file.
-- * FCS reader is defined as a set of instruction of the following type:
-- * {inode_file_plugin(inode)->method()} (I.e. retrieving a file plugin id
-- * conjoined with all method's instructions should be atomic).
-- * FCS writer is a set of instructions that perform file plugin conversion
-- * (convert items, update pset, etc).
-- * Example:
-- * reiser4_write_careful() supplied to VFS as a ->write() file operation is
-- * composed of the following (optional) instructions:
-- * 1 2 3
-- * *********************** ####### -------------------------------------------->
-- *
-- * 1) "****" are instructions performed on behalf of cryptcompress file plugin;
-- * 2) "####" is a FCS writer (performing a conversion cryptcompress->unix_file);
-- * 3) "----" are instructions performed on behalf of unix_file plugin;
-- * Here (1) and (3) are FCS readers.
-- *
-- * In this example FCS readers and writers are already serialized (by design),
-- * however there can be readers and writers executing at the same time in
-- * different contexts, so we need a common mechanism of serialization.
-- *
-- * Currently serialization of FCS readers and writers is performed via acquiring
-- * a special per-inode rw-semaphore (conv_sem). And yes, {down, up}_read is for
-- * FCS readers, and {down, up}_write is for FCS writers, see the macros below
-- * for passive/active protection.
-- *
-- * ---
-- * (*) This heuristic can be changed to a better one (benchmarking is needed).
-- * (**) Such technique allows to keep enable/disable state on disk.
-+ * Dispatching hook makes a decision (at dispatching point) about the
-+ * most reasonable plugin. Such decision is made in accordance with some
-+ * O(1)-heuristic.
-+ *
-+ * We implement a transition CRYPTCOMPRESS -> UNIX_FILE for files with
-+ * incompressible data. Current heuristic to estimate compressibility is
-+ * very simple: if first complete logical cluster (64K by default) of a
-+ * file is incompressible, then we make a decision, that the whole file
-+ * is incompressible.
-+ *
-+ * To enable dispatching we install a special "magic" compression mode
-+ * plugin CONVX_COMPRESSION_MODE_ID at file creation time.
-+ *
-+ * Note, that we don't perform back conversion (UNIX_FILE->CRYPTCOMPRESS)
-+ * because of compatibility reasons).
-+ *
-+ * In conversion time we protect CS, the conversion set (file's (meta)data
-+ * and plugin table (pset)) via special per-inode rw-semaphore (conv_sem).
-+ * The methods which implement conversion are CS writers. The methods of FS
-+ * interface (file_operations, inode_operations, address_space_operations)
-+ * are CS readers.
- */
-
- #include "../../inode.h"
-@@ -212,11 +180,11 @@ static int disable_conversion(struct ino
- /**
- * Check if we really have achieved plugin scheduling point
- */
--static int check_psched_point(struct inode * inode,
-- loff_t pos /* position in the
-- file to write from */,
-- struct cluster_handle * clust,
-- struct psched_context * cont)
-+static int check_dispatch_point(struct inode * inode,
-+ loff_t pos /* position in the
-+ file to write from */,
-+ struct cluster_handle * clust,
-+ struct dispatch_context * cont)
- {
- assert("edward-1505", conversion_enabled(inode));
- /*
-@@ -241,9 +209,9 @@ static int check_psched_point(struct ino
- pos == inode->i_size &&
- pos == inode_cluster_size(inode));
- assert("edward-1539", cont != NULL);
-- assert("edward-1540", cont->state == PSCHED_INVAL_STATE);
-+ assert("edward-1540", cont->state == DISPATCH_INVAL_STATE);
-
-- cont->state = PSCHED_SCHED_POINT;
-+ cont->state = DISPATCH_POINT;
- return 0;
- }
-
-@@ -301,14 +269,14 @@ static int prepped_dclust_ok(hint_t * hi
- */
- static int read_check_compressibility(struct inode * inode,
- struct cluster_handle * clust,
-- struct psched_context * cont)
-+ struct dispatch_context * cont)
- {
- int i;
- int result;
- __u32 dst_len;
- hint_t tmp_hint;
- hint_t * cur_hint = clust->hint;
-- assert("edward-1541", cont->state == PSCHED_SCHED_POINT);
-+ assert("edward-1541", cont->state == DISPATCH_POINT);
-
- start_check_compressibility(inode, clust, &tmp_hint);
-
-@@ -373,8 +341,8 @@ static int read_check_compressibility(st
- finish_check_compressibility(inode, clust, cur_hint);
- cont->state =
- (data_is_compressible(dst_len, inode_cluster_size(inode)) ?
-- PSCHED_REMAINS_OLD :
-- PSCHED_ASSIGNED_NEW);
-+ DISPATCH_REMAINS_OLD :
-+ DISPATCH_ASSIGNED_NEW);
- return 0;
- error:
- put_page_cluster(clust, inode, READ_OP);
-@@ -433,8 +401,8 @@ static int reserve_cryptcompress2unixfil
- /**
- * Convert cryptcompress file plugin to unix_file plugin.
+ * fs/fs-writeback.c
*/
--static int cryptcompress2unixfile(struct file * file, struct inode * inode,
-- struct psched_context * cont)
-+static int cryptcompress2unixfile(struct file *file, struct inode *inode,
-+ struct dispatch_context *cont)
- {
- int i;
- int result = 0;
-@@ -490,28 +458,28 @@ static int cryptcompress2unixfile(struct
- * Make a decision about the most reasonable file plugin id to manage
- * the file.
- */
--int write_pschedule_hook(struct file * file, struct inode * inode,
-- loff_t pos, struct cluster_handle * clust,
-- struct psched_context * cont)
-+int write_dispatch_hook(struct file *file, struct inode *inode,
-+ loff_t pos, struct cluster_handle *clust,
-+ struct dispatch_context *cont)
- {
- int result;
- if (!conversion_enabled(inode))
- return 0;
-- result = check_psched_point(inode, pos, clust, cont);
-- if (result || cont->state != PSCHED_SCHED_POINT)
-+ result = check_dispatch_point(inode, pos, clust, cont);
-+ if (result || cont->state != DISPATCH_POINT)
- return result;
- result = read_check_compressibility(inode, clust, cont);
- if (result)
- return result;
-- if (cont->state == PSCHED_REMAINS_OLD) {
-+ if (cont->state == DISPATCH_REMAINS_OLD) {
- put_page_cluster(clust, inode, READ_OP);
- return disable_conversion(inode);
+diff -urN linux-2.6.35.orig/mm/filemap.c linux-2.6.35/mm/filemap.c
+--- linux-2.6.35.orig/mm/filemap.c 2010-08-02 00:11:14.000000000 +0200
++++ linux-2.6.35/mm/filemap.c 2010-08-04 17:20:40.000000000 +0200
+@@ -139,6 +139,7 @@
+ dec_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE);
}
-- assert("edward-1543", cont->state == PSCHED_ASSIGNED_NEW);
-+ assert("edward-1543", cont->state == DISPATCH_ASSIGNED_NEW);
- /*
- * page cluster is grabbed and uptodate. It will be
- * released with a pgset after plugin conversion is
-- * finished, see put_psched_context().
-+ * finished, see put_dispatch_context().
- */
- reiser4_unset_hint(clust->hint);
- move_cluster_pgset(clust, &cont->pages, &cont->nr_pages);
-@@ -521,20 +489,20 @@ int write_pschedule_hook(struct file * f
- /**
- * This is called by ->setattr() method of cryptcompress file plugin.
- */
--int setattr_pschedule_hook(struct inode * inode)
-+int setattr_dispatch_hook(struct inode * inode)
- {
- if (conversion_enabled(inode))
- return disable_conversion(inode);
- return 0;
- }
-
--static inline void init_psched_context(struct psched_context * cont)
-+static inline void init_dispatch_context(struct dispatch_context * cont)
- {
- memset(cont, 0, sizeof(*cont));
- }
-
--static inline void done_psched_context(struct psched_context * cont,
-- struct inode * inode)
-+static inline void done_dispatch_context(struct dispatch_context * cont,
-+ struct inode * inode)
- {
- if (cont->pages) {
- __put_page_cluster(0, cont->nr_pages, cont->pages, inode);
-@@ -564,13 +532,13 @@ ssize_t reiser4_write_careful(struct fil
- reiser4_context *ctx;
- ssize_t written_old = 0; /* bytes written with initial plugin */
- ssize_t written_new = 0; /* bytes written with new plugin */
-- struct psched_context cont;
-+ struct dispatch_context cont;
- struct inode * inode = file->f_dentry->d_inode;
-
- ctx = reiser4_init_context(inode->i_sb);
- if (IS_ERR(ctx))
- return PTR_ERR(ctx);
-- init_psched_context(&cont);
-+ init_dispatch_context(&cont);
- mutex_lock(&inode->i_mutex);
- /**
- * First step.
-@@ -582,7 +550,7 @@ ssize_t reiser4_write_careful(struct fil
- count,
- off,
- &cont);
-- if (cont.state != PSCHED_ASSIGNED_NEW || written_old < 0)
-+ if (cont.state != DISPATCH_ASSIGNED_NEW || written_old < 0)
- goto exit;
- /**
- * Second step.
-@@ -616,7 +584,7 @@ ssize_t reiser4_write_careful(struct fil
- NULL);
- exit:
- mutex_unlock(&inode->i_mutex);
-- done_psched_context(&cont, inode);
-+ done_dispatch_context(&cont, inode);
- reiser4_exit_context(ctx);
-
- return written_old + (written_new < 0 ? 0 : written_new);
-diff -puN fs/reiser4/plugin/plugin.h~reiser4-rename-psched-to-dispatch fs/reiser4/plugin/plugin.h
---- a/fs/reiser4/plugin/plugin.h~reiser4-rename-psched-to-dispatch
-+++ a/fs/reiser4/plugin/plugin.h
-@@ -235,7 +235,7 @@ typedef struct file_plugin {
- * in @cont */
- ssize_t (*write) (struct file *, const char __user *buf,
- size_t write_amount, loff_t * off,
-- struct psched_context * cont);
-+ struct dispatch_context * cont);
- int (*ioctl) (struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
- int (*mmap) (struct file *, struct vm_area_struct *);
-_
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-1. Fix up the problem:
-Reiser4 steps to the journal code of other journalling file systems:
-
-EXT3 complaints: "called recursively, non-PF_MEMALLOC"
-Call Trace:
- [<c0535873>] ext3_write_inode+0x1e/0x3a
- [<c04b16bc>] __writeback_single_inode+0x193/0x2ad
- [<c0508d86>] ? flush_some_atom+0x427/0x44d
- [<c04b1bb5>] ? generic_sync_sb_inodes+0x27c/0x338
- [<c04b1b68>] generic_sync_sb_inodes+0x22f/0x338
- [<c04b1c8e>] sync_sb_inodes+0x1d/0x20
- [<c04b1e1e>] writeback_inodes+0x79/0xb9
- [<c047c76a>] balance_dirty_pages_ratelimited_nr+0x119/0x21d
- [<c0504803>] reiser4_exit_context+0x5f/0xf6
- [<c051e5a3>] reiser4_write_careful+0x3ba/0x3cc
- [<c049bc3c>] ? do_sync_read+0xab/0xe9
- [<c0613dae>] ? selinux_file_permission+0x44/0x48
- [<c060fea6>] ? security_file_permission+0xf/0x11
- [<c051e1e9>] ? reiser4_write_careful+0x0/0x3cc
- [<c049c494>] vfs_write+0x84/0xdf
- [<c049c588>] sys_write+0x3b/0x60
- [<c0403178>] sysenter_do_call+0x12/0x2d
-
-Solution:
-Drop current->journal_info before calling
-balance_dirty_pages_ratelimited().
-
-2. Update comments in plugin_header.h
-
-Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/context.c | 13 +++---
- fs/reiser4/plugin/file/cryptcompress.c | 3 -
- fs/reiser4/plugin/file/file.c | 9 +---
- fs/reiser4/plugin/file/tail_conversion.c | 14 +++++--
- fs/reiser4/plugin/item/tail.h | 2 -
- fs/reiser4/plugin/plugin_header.h | 42 ++++++++-------------
- fs/reiser4/txnmgr.c | 3 +
- fs/reiser4/vfs_ops.c | 12 ++++--
- fs/reiser4/vfs_ops.h | 2 -
- 9 files changed, 49 insertions(+), 51 deletions(-)
-
-diff -puN fs/reiser4/context.c~reiser4-drop-journal-info fs/reiser4/context.c
---- a/fs/reiser4/context.c~reiser4-drop-journal-info
-+++ a/fs/reiser4/context.c
-@@ -37,8 +37,8 @@
- #include "debug.h"
- #include "super.h"
- #include "context.h"
-+#include "vfs_ops.h" /* for reiser4_throttle_write() */
-
--#include <linux/writeback.h> /* balance_dirty_pages() */
- #include <linux/hardirq.h>
-
- static void _reiser4_init_context(reiser4_context * context,
-@@ -139,7 +139,7 @@ int is_in_reiser4_context(void)
- * because some important lock (like ->i_mutex on the parent directory) is
- * held. To achieve this, ->nobalance flag can be set in the current context.
- */
--static void balance_dirty_pages_at(reiser4_context *context)
-+static void reiser4_throttle_write_at(reiser4_context *context)
- {
- reiser4_super_info_data *sbinfo = get_super_private(context->super);
-
-@@ -152,7 +152,8 @@ static void balance_dirty_pages_at(reise
- if (sbinfo != NULL && sbinfo->fake != NULL &&
- context->nr_marked_dirty != 0 &&
- !(current->flags & PF_MEMALLOC))
-- balance_dirty_pages_ratelimited(sbinfo->fake->i_mapping);
-+ /* FIXME-EDWARD: throttle with nr_marked_dirty? */
-+ reiser4_throttle_write(sbinfo->fake, 1);
- }
-
- /* release resources associated with context.
-@@ -225,10 +226,8 @@ void reiser4_exit_context(reiser4_contex
- assert("nikita-3021", reiser4_schedulable());
-
- if (context->nr_children == 0) {
-- if (!context->nobalance) {
-- reiser4_txn_restart(context);
-- balance_dirty_pages_at(context);
-- }
-+ if (!context->nobalance)
-+ reiser4_throttle_write_at(context);
-
- /* if filesystem is mounted with -o sync or -o dirsync - commit
- transaction. FIXME: TXNH_DONT_COMMIT is used to avoid
-diff -puN fs/reiser4/plugin/file/cryptcompress.c~reiser4-drop-journal-info fs/reiser4/plugin/file/cryptcompress.c
---- a/fs/reiser4/plugin/file/cryptcompress.c~reiser4-drop-journal-info
-+++ a/fs/reiser4/plugin/file/cryptcompress.c
-@@ -1973,8 +1973,7 @@ static int balance_dirty_page_cluster(st
- info = cryptcompress_inode_data(inode);
-
- mutex_unlock(&info->checkin_mutex);
-- reiser4_txn_restart_current();
-- balance_dirty_pages_ratelimited_nr(inode->i_mapping, nr_dirtied);
-+ reiser4_throttle_write(inode, nr_dirtied);
- mutex_lock(&info->checkin_mutex);
- return 0;
- }
-diff -puN fs/reiser4/plugin/file/file.c~reiser4-drop-journal-info fs/reiser4/plugin/file/file.c
---- a/fs/reiser4/plugin/file/file.c~reiser4-drop-journal-info
-+++ a/fs/reiser4/plugin/file/file.c
-@@ -2227,16 +2227,13 @@ ssize_t write_unix_file(struct file *fil
- }
- drop_access(uf_info);
- ea = NEITHER_OBTAINED;
-- reiser4_txn_restart(ctx);
-- current->journal_info = NULL;
-+
- /*
- * tell VM how many pages were dirtied. Maybe number of pages
- * which were dirty already should not be counted
- */
-- balance_dirty_pages_ratelimited_nr(inode->i_mapping,
-- (written + PAGE_CACHE_SIZE - 1) / PAGE_CACHE_SIZE);
-- current->journal_info = ctx;
--
-+ reiser4_throttle_write(inode,
-+ (written + PAGE_CACHE_SIZE - 1) / PAGE_CACHE_SIZE);
- left -= written;
- buf += written;
- *pos += written;
-diff -puN fs/reiser4/plugin/file/tail_conversion.c~reiser4-drop-journal-info fs/reiser4/plugin/file/tail_conversion.c
---- a/fs/reiser4/plugin/file/tail_conversion.c~reiser4-drop-journal-info
-+++ a/fs/reiser4/plugin/file/tail_conversion.c
-@@ -486,8 +486,10 @@ int tail2extent(struct unix_file_info *u
- * on partially converted files.
- */
- drop_exclusive_access(uf_info);
-- /* throttle the conversion */
-- reiser4_throttle_write(inode);
-+ /* throttle the conversion
-+ FIXME-EDWARD: Pass the precise number of pages
-+ that was dirtied */
-+ reiser4_throttle_write(inode, 1);
- get_exclusive_access(uf_info);
-
- /*
-@@ -685,8 +687,12 @@ int extent2tail(struct file * file, stru
- page_cache_release(page);
-
- drop_exclusive_access(uf_info);
-- /* throttle the conversion */
-- reiser4_throttle_write(inode);
-+ /*
-+ * throttle the conversion.
-+ * FIXME-EDWARD: Calculate and pass the precise number
-+ * of pages that was dirtied
-+ */
-+ reiser4_throttle_write(inode, 1);
- get_exclusive_access(uf_info);
- /*
- * nobody is allowed to complete conversion but a process which
-diff -puN fs/reiser4/plugin/item/tail.h~reiser4-drop-journal-info fs/reiser4/plugin/item/tail.h
---- a/fs/reiser4/plugin/item/tail.h~reiser4-drop-journal-info
-+++ a/fs/reiser4/plugin/item/tail.h
-@@ -40,8 +40,6 @@ int readpage_tail(void *vp, struct page
- reiser4_key *append_key_tail(const coord_t *, reiser4_key *);
- void init_coord_extension_tail(uf_coord_t *, loff_t offset);
- int get_block_address_tail(const coord_t *, sector_t, sector_t *);
--int item_balance_dirty_pages(struct address_space *, const flow_t *,
-- hint_t *, int back_to_dirty, int set_hint);
-
- /* __REISER4_TAIL_H__ */
- #endif
-diff -puN fs/reiser4/plugin/plugin_header.h~reiser4-drop-journal-info fs/reiser4/plugin/plugin_header.h
---- a/fs/reiser4/plugin/plugin_header.h~reiser4-drop-journal-info
-+++ a/fs/reiser4/plugin/plugin_header.h
-@@ -10,32 +10,24 @@
- #include "../debug.h"
- #include "../dformat.h"
-
--/* Every plugin type can be considered as a class of virtual objects
-- {(type, i) | i = 0, 1, ...}, which has one the following categories
-- of virtualization:
-- A - no virtualization;
-- F - per-file virtualization;
-- S - per-superblock virtualization;
-- FIXME-EDWARD: Define every such category */
--
--/* Supported plugin types: (id, (virtualization category), short description) */
-+/* The list of Reiser4 interfaces */
- typedef enum {
-- REISER4_FILE_PLUGIN_TYPE, /* (F) service VFS enry-points */
-- REISER4_DIR_PLUGIN_TYPE, /* (F) service VFS enry-points */
-- REISER4_ITEM_PLUGIN_TYPE, /* (F) manage items */
-- REISER4_NODE_PLUGIN_TYPE, /* (S) manage formatted nodes */
-- REISER4_HASH_PLUGIN_TYPE, /* (F) compute hash */
-- REISER4_FIBRATION_PLUGIN_TYPE, /* (F) directory fibrations */
-- REISER4_FORMATTING_PLUGIN_TYPE, /* (F) tail-packing policy */
-- REISER4_PERM_PLUGIN_TYPE, /* stub (vacancy) */
-- REISER4_SD_EXT_PLUGIN_TYPE, /* (A) stat-data extensions */
-- REISER4_FORMAT_PLUGIN_TYPE, /* (S) specify disk format */
-- REISER4_JNODE_PLUGIN_TYPE, /* (A) in-memory node headers */
-- REISER4_CIPHER_PLUGIN_TYPE, /* (F) cipher transform algs */
-- REISER4_DIGEST_PLUGIN_TYPE, /* (F) digest transform algs */
-- REISER4_COMPRESSION_PLUGIN_TYPE, /* (F) compression tfm algs */
-- REISER4_COMPRESSION_MODE_PLUGIN_TYPE, /* (F) compression heuristic */
-- REISER4_CLUSTER_PLUGIN_TYPE, /* (F) size of logical cluster */
-+ REISER4_FILE_PLUGIN_TYPE, /* manage VFS objects */
-+ REISER4_DIR_PLUGIN_TYPE, /* manage directories */
-+ REISER4_ITEM_PLUGIN_TYPE, /* manage items */
-+ REISER4_NODE_PLUGIN_TYPE, /* manage formatted nodes */
-+ REISER4_HASH_PLUGIN_TYPE, /* hash methods */
-+ REISER4_FIBRATION_PLUGIN_TYPE, /* directory fibrations */
-+ REISER4_FORMATTING_PLUGIN_TYPE, /* dispatching policy */
-+ REISER4_PERM_PLUGIN_TYPE, /* stub (vacancy) */
-+ REISER4_SD_EXT_PLUGIN_TYPE, /* manage stat-data extensions */
-+ REISER4_FORMAT_PLUGIN_TYPE, /* disk format specifications */
-+ REISER4_JNODE_PLUGIN_TYPE, /* manage in-memory headers */
-+ REISER4_CIPHER_PLUGIN_TYPE, /* cipher transform methods */
-+ REISER4_DIGEST_PLUGIN_TYPE, /* digest transform methods */
-+ REISER4_COMPRESSION_PLUGIN_TYPE, /* compression methods */
-+ REISER4_COMPRESSION_MODE_PLUGIN_TYPE, /* dispatching policies */
-+ REISER4_CLUSTER_PLUGIN_TYPE, /* manage logical clusters */
- REISER4_PLUGIN_TYPES
- } reiser4_plugin_type;
-
-diff -puN fs/reiser4/txnmgr.c~reiser4-drop-journal-info fs/reiser4/txnmgr.c
---- a/fs/reiser4/txnmgr.c~reiser4-drop-journal-info
-+++ a/fs/reiser4/txnmgr.c
-@@ -2328,7 +2328,8 @@ static void do_jnode_make_dirty(jnode *
-
- JF_SET(node, JNODE_DIRTY);
-
-- get_current_context()->nr_marked_dirty++;
-+ if (!JF_ISSET(node, JNODE_CLUSTER_PAGE))
-+ get_current_context()->nr_marked_dirty++;
-
- /* We grab2flush_reserve one additional block only if node was
- not CREATED and jnode_flush did not sort it into neither
-diff -puN fs/reiser4/vfs_ops.c~reiser4-drop-journal-info fs/reiser4/vfs_ops.c
---- a/fs/reiser4/vfs_ops.c~reiser4-drop-journal-info
-+++ a/fs/reiser4/vfs_ops.c
-@@ -201,10 +201,16 @@ void reiser4_writeout(struct super_block
- } while (wbc->nr_to_write > 0);
- }
-
--void reiser4_throttle_write(struct inode *inode)
-+/* tell VM how many pages were dirtied */
-+void reiser4_throttle_write(struct inode *inode, int nrpages)
- {
-- reiser4_txn_restart_current();
-- balance_dirty_pages_ratelimited(inode->i_mapping);
-+ reiser4_context *ctx;
-+
-+ ctx = get_current_context();
-+ reiser4_txn_restart(ctx);
-+ current->journal_info = NULL;
-+ balance_dirty_pages_ratelimited_nr(inode->i_mapping, nrpages);
-+ current->journal_info = ctx;
- }
-
- const char *REISER4_SUPER_MAGIC_STRING = "ReIsEr4";
-diff -puN fs/reiser4/vfs_ops.h~reiser4-drop-journal-info fs/reiser4/vfs_ops.h
---- a/fs/reiser4/vfs_ops.h~reiser4-drop-journal-info
-+++ a/fs/reiser4/vfs_ops.h
-@@ -30,7 +30,7 @@ extern int reiser4_add_nlink(struct inod
- extern int reiser4_del_nlink(struct inode *, struct inode *, int);
-
- extern int reiser4_start_up_io(struct page *page);
--extern void reiser4_throttle_write(struct inode *);
-+extern void reiser4_throttle_write(struct inode *, int nrpages);
- extern int jnode_is_releasable(jnode *);
-
- #define CAPTURE_APAGE_BURST (1024l)
-_
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-This is a multi-part message in MIME format.
---------------020703030905060904070706
-Content-Type: text/plain; charset=ISO-8859-1; format=flowed
-Content-Transfer-Encoding: 7bit
-
---------------020703030905060904070706
-Content-Type: text/plain;
- name="reiser4-fix-compile-warnings.patch"
-Content-Transfer-Encoding: 7bit
-Content-Disposition: inline;
- filename="reiser4-fix-compile-warnings.patch"
-
-Fix compile warnings.
-
-Prepared by: Brandon Berhent <cheater1034@gmail.com>
-Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/plugin/compress/compress.c | 16 ++++++++--------
- fs/reiser4/plugin/file/cryptcompress.c | 4 ++--
- fs/reiser4/plugin/file/file_conversion.c | 2 +-
- fs/reiser4/plugin/item/item.h | 4 ++--
- fs/reiser4/plugin/plugin.h | 8 ++++----
- 5 files changed, 17 insertions(+), 17 deletions(-)
-
-diff -puN fs/reiser4/plugin/compress/compress.c~reiser4-fix-compile-warnings fs/reiser4/plugin/compress/compress.c
---- a/fs/reiser4/plugin/compress/compress.c~reiser4-fix-compile-warnings
-+++ a/fs/reiser4/plugin/compress/compress.c
-@@ -122,8 +122,8 @@ static int gzip1_min_size_deflate(void)
}
++EXPORT_SYMBOL(__remove_from_page_cache);
- static void
--gzip1_compress(coa_t coa, __u8 * src_first, unsigned src_len,
-- __u8 * dst_first, unsigned *dst_len)
-+gzip1_compress(coa_t coa, __u8 * src_first, size_t src_len,
-+ __u8 * dst_first, size_t *dst_len)
- {
- #if REISER4_ZLIB
- int ret = 0;
-@@ -166,8 +166,8 @@ gzip1_compress(coa_t coa, __u8 * src_fir
- }
-
- static void
--gzip1_decompress(coa_t coa, __u8 * src_first, unsigned src_len,
-- __u8 * dst_first, unsigned *dst_len)
-+gzip1_decompress(coa_t coa, __u8 * src_first, size_t src_len,
-+ __u8 * dst_first, size_t *dst_len)
+ void remove_from_page_cache(struct page *page)
{
- #if REISER4_ZLIB
- int ret = 0;
-@@ -278,8 +278,8 @@ static int lzo1_min_size_deflate(void)
- }
-
- static void
--lzo1_compress(coa_t coa, __u8 * src_first, unsigned src_len,
-- __u8 * dst_first, unsigned *dst_len)
-+lzo1_compress(coa_t coa, __u8 * src_first, size_t src_len,
-+ __u8 * dst_first, size_t *dst_len)
+@@ -955,6 +956,7 @@
{
- int result;
-
-@@ -302,8 +302,8 @@ lzo1_compress(coa_t coa, __u8 * src_firs
+ ra->ra_pages /= 4;
}
++EXPORT_SYMBOL(find_get_pages);
- static void
--lzo1_decompress(coa_t coa, __u8 * src_first, unsigned src_len,
-- __u8 * dst_first, unsigned *dst_len)
-+lzo1_decompress(coa_t coa, __u8 * src_first, size_t src_len,
-+ __u8 * dst_first, size_t *dst_len)
- {
- int result;
-
-diff -puN fs/reiser4/plugin/file/cryptcompress.c~reiser4-fix-compile-warnings fs/reiser4/plugin/file/cryptcompress.c
---- a/fs/reiser4/plugin/file/cryptcompress.c~reiser4-fix-compile-warnings
-+++ a/fs/reiser4/plugin/file/cryptcompress.c
-@@ -1014,7 +1014,7 @@ int reiser4_deflate_cluster(struct clust
- coplug = inode_compression_plugin(inode);
- if (should_compress(tc, clust->index, inode)) {
- /* try to compress, discard bad results */
-- __u32 dst_len;
-+ size_t dst_len;
- compression_mode_plugin * mplug =
- inode_compression_mode_plugin(inode);
- assert("edward-602", coplug != NULL);
-@@ -1164,7 +1164,7 @@ int reiser4_inflate_cluster(struct clust
- transformed = 1;
- }
- if (need_inflate(clust, inode, 0)) {
-- unsigned dst_len = inode_cluster_size(inode);
-+ size_t dst_len = inode_cluster_size(inode);
- if(transformed)
- alternate_streams(tc);
-
-diff -puN fs/reiser4/plugin/file/file_conversion.c~reiser4-fix-compile-warnings fs/reiser4/plugin/file/file_conversion.c
---- a/fs/reiser4/plugin/file/file_conversion.c~reiser4-fix-compile-warnings
-+++ a/fs/reiser4/plugin/file/file_conversion.c
-@@ -273,7 +273,7 @@ static int read_check_compressibility(st
- {
- int i;
- int result;
-- __u32 dst_len;
-+ size_t dst_len;
- hint_t tmp_hint;
- hint_t * cur_hint = clust->hint;
- assert("edward-1541", cont->state == DISPATCH_POINT);
-diff -puN fs/reiser4/plugin/item/item.h~reiser4-fix-compile-warnings fs/reiser4/plugin/item/item.h
---- a/fs/reiser4/plugin/item/item.h~reiser4-fix-compile-warnings
-+++ a/fs/reiser4/plugin/item/item.h
-@@ -233,8 +233,8 @@ struct dir_entry_iops {
-
- /* operations specific to items regular (unix) file metadata are built of */
- struct file_iops{
-- int (*write) (struct file *, struct inode *,
-- const char __user *, size_t, loff_t *pos);
-+ ssize_t (*write) (struct file *, struct inode *,
-+ const char __user *, size_t, loff_t *pos);
- int (*read) (struct file *, flow_t *, hint_t *);
- int (*readpage) (void *, struct page *);
- int (*get_block) (const coord_t *, sector_t, sector_t *);
-diff -puN fs/reiser4/plugin/plugin.h~reiser4-fix-compile-warnings fs/reiser4/plugin/plugin.h
---- a/fs/reiser4/plugin/plugin.h~reiser4-fix-compile-warnings
-+++ a/fs/reiser4/plugin/plugin.h
-@@ -560,10 +560,10 @@ typedef struct compression_plugin {
- int (*min_size_deflate) (void);
- __u32(*checksum) (char *data, __u32 length);
- /* main transform procedures */
-- void (*compress) (coa_t coa, __u8 *src_first, unsigned src_len,
-- __u8 *dst_first, unsigned *dst_len);
-- void (*decompress) (coa_t coa, __u8 *src_first, unsigned src_len,
-- __u8 *dst_first, unsigned *dst_len);
-+ void (*compress) (coa_t coa, __u8 *src_first, size_t src_len,
-+ __u8 *dst_first, size_t *dst_len);
-+ void (*decompress) (coa_t coa, __u8 *src_first, size_t src_len,
-+ __u8 *dst_first, size_t *dst_len);
- } compression_plugin;
-
- typedef struct compression_mode_plugin {
-_
-From: Edward Shishkin <edward.shishkin@gmail.com>
-
-Address a gcc warning for x86_64 about large frame size.
-Add a new function push_sb_field_opts().
-
-Signed-off-by Edward Shsihkin <edward.shishkin@gmail.com>
-
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/init_super.c | 126 +++++++++++++++++++-------------------
- 1 file changed, 66 insertions(+), 60 deletions(-)
-
-diff -puN fs/reiser4/init_super.c~reiser4-reduce-frame-size-of-reiser4_init_super_data fs/reiser4/init_super.c
---- a/fs/reiser4/init_super.c~reiser4-reduce-frame-size-of-reiser4_init_super_data
-+++ a/fs/reiser4/init_super.c
-@@ -292,66 +292,6 @@ static int parse_options(char *opt_strin
-
- #define MAX_NR_OPTIONS (30)
-
--/**
-- * reiser4_init_super_data - initialize reiser4 private super block
-- * @super: super block to initialize
-- * @opt_string: list of reiser4 mount options
-- *
-- * Sets various reiser4 parameters to default values. Parses mount options and
-- * overwrites default settings.
-- */
--int reiser4_init_super_data(struct super_block *super, char *opt_string)
--{
-- int result;
-- struct opt_desc *opts, *p;
-- reiser4_super_info_data *sbinfo = get_super_private(super);
--
-- /* initialize super, export, dentry operations */
-- sbinfo->ops.super = reiser4_super_operations;
-- sbinfo->ops.export = reiser4_export_operations;
-- sbinfo->ops.dentry = reiser4_dentry_operations;
-- super->s_op = &sbinfo->ops.super;
-- super->s_export_op = &sbinfo->ops.export;
--
-- /* initialize transaction manager parameters to default values */
-- sbinfo->tmgr.atom_max_size = totalram_pages / 4;
-- sbinfo->tmgr.atom_max_age = REISER4_ATOM_MAX_AGE / HZ;
-- sbinfo->tmgr.atom_min_size = 256;
-- sbinfo->tmgr.atom_max_flushers = ATOM_MAX_FLUSHERS;
--
-- /* initialize cbk cache parameter */
-- sbinfo->tree.cbk_cache.nr_slots = CBK_CACHE_SLOTS;
--
-- /* initialize flush parameters */
-- sbinfo->flush.relocate_threshold = FLUSH_RELOCATE_THRESHOLD;
-- sbinfo->flush.relocate_distance = FLUSH_RELOCATE_DISTANCE;
-- sbinfo->flush.written_threshold = FLUSH_WRITTEN_THRESHOLD;
-- sbinfo->flush.scan_maxnodes = FLUSH_SCAN_MAXNODES;
--
-- sbinfo->optimal_io_size = REISER4_OPTIMAL_IO_SIZE;
--
-- /* preliminary tree initializations */
-- sbinfo->tree.super = super;
-- sbinfo->tree.carry.new_node_flags = REISER4_NEW_NODE_FLAGS;
-- sbinfo->tree.carry.new_extent_flags = REISER4_NEW_EXTENT_FLAGS;
-- sbinfo->tree.carry.paste_flags = REISER4_PASTE_FLAGS;
-- sbinfo->tree.carry.insert_flags = REISER4_INSERT_FLAGS;
-- rwlock_init(&(sbinfo->tree.tree_lock));
-- spin_lock_init(&(sbinfo->tree.epoch_lock));
--
-- /* initialize default readahead params */
-- sbinfo->ra_params.max = num_physpages / 4;
-- sbinfo->ra_params.flags = 0;
--
-- /* allocate memory for structure describing reiser4 mount options */
-- opts = kmalloc(sizeof(struct opt_desc) * MAX_NR_OPTIONS,
-- reiser4_ctx_gfp_mask_get());
-- if (opts == NULL)
-- return RETERR(-ENOMEM);
--
-- /* initialize structure describing reiser4 mount options */
-- p = opts;
--
- #if REISER4_DEBUG
- # define OPT_ARRAY_CHECK if ((p) > (opts) + MAX_NR_OPTIONS) { \
- warning("zam-1046", "opt array is overloaded"); break; \
-@@ -370,6 +310,10 @@ do { \
- #define PUSH_SB_FIELD_OPT(field, format) PUSH_OPT(SB_FIELD_OPT(field, format))
- #define PUSH_BIT_OPT(name, bit) PUSH_OPT(BIT_OPT(name, bit))
+ /**
+ * do_generic_file_read - generic file read routine
+diff -urN linux-2.6.35.orig/mm/page-writeback.c linux-2.6.35/mm/page-writeback.c
+--- linux-2.6.35.orig/mm/page-writeback.c 2010-08-02 00:11:14.000000000 +0200
++++ linux-2.6.35/mm/page-writeback.c 2010-08-04 15:44:57.000000000 +0200
+@@ -1142,6 +1142,32 @@
+ EXPORT_SYMBOL(__set_page_dirty_nobuffers);
-+static noinline void push_sb_field_opts(struct opt_desc *p,
-+ struct opt_desc *opts,
-+ reiser4_super_info_data *sbinfo)
-+{
- /*
- * tmgr.atom_max_size=N
- * Atoms containing more than N blocks will be forced to commit. N is
-@@ -435,7 +379,69 @@ do { \
- */
- PUSH_SB_FIELD_OPT(altsuper, "%lu");
- #endif
-+}
-+
-+/**
-+ * reiser4_init_super_data - initialize reiser4 private super block
-+ * @super: super block to initialize
-+ * @opt_string: list of reiser4 mount options
+ /*
++ * set_page_dirty_notag() -- similar to __set_page_dirty_nobuffers()
++ * except it doesn't tag the page dirty in the page-cache radix tree.
++ * This means that the address space using this cannot use the regular
++ * filemap ->writepages() helpers and must provide its own means of
++ * tracking and finding non-tagged dirty pages.
+ *
-+ * Sets various reiser4 parameters to default values. Parses mount options and
-+ * overwrites default settings.
++ * NOTE: furthermore, this version also doesn't handle truncate races.
+ */
-+int reiser4_init_super_data(struct super_block *super, char *opt_string)
++int set_page_dirty_notag(struct page *page)
+{
-+ int result;
-+ struct opt_desc *opts, *p;
-+ reiser4_super_info_data *sbinfo = get_super_private(super);
-+
-+ /* initialize super, export, dentry operations */
-+ /* sbinfo->ops.super = reiser4_super_operations; */
-+ sbinfo->ops.export = reiser4_export_operations;
-+ sbinfo->ops.dentry = reiser4_dentry_operations;
-+ super->s_op = &reiser4_super_operations; /*super->s_op = &sbinfo->ops.super;*/
-+ super->s_export_op = &sbinfo->ops.export;
-+
-+ /* initialize transaction manager parameters to default values */
-+ sbinfo->tmgr.atom_max_size = totalram_pages / 4;
-+ sbinfo->tmgr.atom_max_age = REISER4_ATOM_MAX_AGE / HZ;
-+ sbinfo->tmgr.atom_min_size = 256;
-+ sbinfo->tmgr.atom_max_flushers = ATOM_MAX_FLUSHERS;
-+
-+ /* initialize cbk cache parameter */
-+ sbinfo->tree.cbk_cache.nr_slots = CBK_CACHE_SLOTS;
-+
-+ /* initialize flush parameters */
-+ sbinfo->flush.relocate_threshold = FLUSH_RELOCATE_THRESHOLD;
-+ sbinfo->flush.relocate_distance = FLUSH_RELOCATE_DISTANCE;
-+ sbinfo->flush.written_threshold = FLUSH_WRITTEN_THRESHOLD;
-+ sbinfo->flush.scan_maxnodes = FLUSH_SCAN_MAXNODES;
-+
-+ sbinfo->optimal_io_size = REISER4_OPTIMAL_IO_SIZE;
-+
-+ /* preliminary tree initializations */
-+ sbinfo->tree.super = super;
-+ sbinfo->tree.carry.new_node_flags = REISER4_NEW_NODE_FLAGS;
-+ sbinfo->tree.carry.new_extent_flags = REISER4_NEW_EXTENT_FLAGS;
-+ sbinfo->tree.carry.paste_flags = REISER4_PASTE_FLAGS;
-+ sbinfo->tree.carry.insert_flags = REISER4_INSERT_FLAGS;
-+ rwlock_init(&(sbinfo->tree.tree_lock));
-+ spin_lock_init(&(sbinfo->tree.epoch_lock));
-+
-+ /* initialize default readahead params */
-+ sbinfo->ra_params.max = num_physpages / 4;
-+ sbinfo->ra_params.flags = 0;
-+
-+ /* allocate memory for structure describing reiser4 mount options */
-+ opts = kmalloc(sizeof(struct opt_desc) * MAX_NR_OPTIONS,
-+ reiser4_ctx_gfp_mask_get());
-+ if (opts == NULL)
-+ return RETERR(-ENOMEM);
-+
-+ /* initialize structure describing reiser4 mount options */
-+ p = opts;
-
-+ push_sb_field_opts(p, opts, sbinfo);
- /* turn on BSD-style gid assignment */
- PUSH_BIT_OPT("bsdgroups", REISER4_BSD_GID);
- /* turn on 32 bit times */
-_
-
-This is a multi-part message in MIME format.
---------------010200050204000200080203
-Content-Type: text/plain; charset=ISO-8859-1; format=flowed
-Content-Transfer-Encoding: 7bit
-
-Laurent Riffard wrote:
-> Hi Edward,
->
-
-Hello Laurent.
-
-> This patch is buggy, isn't it ?
->
-
-Yes, sorry, my fault..
-I have sent the fixup already to the list yesterday..
-Resending for you and Akpm.
-Andrew, please apply.
-
-Thanks.
-Edward.
-
-> I've got 2 reiser4 FS in my /etc/fstab:
->
-> /dev/vglinux1/lvkernel-r4 /home/laurent/kernel reiser4 defaults,noatime,nodiratime,tmgr.atom_max_size=2048 0 0
-> /dev/disk/by-uuid/b8dbe880-b664-49aa-8050-bddc91fd5e49 /mnt/diske reiser4 noauto,users,noatime,nodiratime 0 0
->
-> The first FS can't be mounted:
->
-> [ 235.078342] reiser4[mount(4205)]: parse_options (fs/reiser4/init_super.c:253)[nikita-2307]:
-> [ 235.078345] WARNING: Unrecognized option: "tmgr.atom_max_size=2048"
->
-
---------------010200050204000200080203
-Content-Type: text/plain;
- name="reiser4-reduce-frame-size-fix.patch"
-Content-Transfer-Encoding: 7bit
-Content-Disposition: inline;
- filename="reiser4-reduce-frame-size-fix.patch"
-
-. Fix up the bug in reiser4_init_super_data():
- The pointer "p" to opt_desc structure is not
- incremented.
- Pass "&p" instead of "p" to push_sb_field_opts(),
- which is supposed to increment the pointer.
-. Modify macros PUSH_OPT, OPT_ARRAY_CHECK to accept
- arguments.
-
-Signed-off-by Edward Shsihkin <edward.shishkin@gmail.com>
----
- 1 file changed, 16 insertions(+), 12 deletions(-)
-
-
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/init_super.c | 28 ++++++++++++++++------------
- 1 file changed, 16 insertions(+), 12 deletions(-)
-
-diff -puN fs/reiser4/init_super.c~reiser4-reduce-frame-size-of-reiser4_init_super_data-fixup fs/reiser4/init_super.c
---- a/fs/reiser4/init_super.c~reiser4-reduce-frame-size-of-reiser4_init_super_data-fixup
-+++ a/fs/reiser4/init_super.c
-@@ -293,27 +293,27 @@ static int parse_options(char *opt_strin
- #define MAX_NR_OPTIONS (30)
-
- #if REISER4_DEBUG
--# define OPT_ARRAY_CHECK if ((p) > (opts) + MAX_NR_OPTIONS) { \
-+# define OPT_ARRAY_CHECK(opt, array) \
-+ if ((opt) > (array) + MAX_NR_OPTIONS) { \
- warning("zam-1046", "opt array is overloaded"); break; \
- }
- #else
--# define OPT_ARRAY_CHECK noop
-+# define OPT_ARRAY_CHECK(opt, array) noop
- #endif
-
--#define PUSH_OPT(...) \
-+#define PUSH_OPT(opt, array, ...) \
- do { \
- struct opt_desc o = __VA_ARGS__; \
-- OPT_ARRAY_CHECK; \
-- *p ++ = o; \
-+ OPT_ARRAY_CHECK(opt, array); \
-+ *(opt) ++ = o; \
- } while (0)
-
--#define PUSH_SB_FIELD_OPT(field, format) PUSH_OPT(SB_FIELD_OPT(field, format))
--#define PUSH_BIT_OPT(name, bit) PUSH_OPT(BIT_OPT(name, bit))
--
--static noinline void push_sb_field_opts(struct opt_desc *p,
-+static noinline void push_sb_field_opts(struct opt_desc **p,
- struct opt_desc *opts,
- reiser4_super_info_data *sbinfo)
- {
-+#define PUSH_SB_FIELD_OPT(field, format) \
-+ PUSH_OPT(*p, opts, SB_FIELD_OPT(field, format))
- /*
- * tmgr.atom_max_size=N
- * Atoms containing more than N blocks will be forced to commit. N is
-@@ -441,8 +441,12 @@ int reiser4_init_super_data(struct super
- /* initialize structure describing reiser4 mount options */
- p = opts;
-
-- push_sb_field_opts(p, opts, sbinfo);
-+ push_sb_field_opts(&p, opts, sbinfo);
- /* turn on BSD-style gid assignment */
++ struct address_space *mapping = page->mapping;
+
-+#define PUSH_BIT_OPT(name, bit) \
-+ PUSH_OPT(p, opts, BIT_OPT(name, bit))
++ if (!TestSetPageDirty(page)) {
++ unsigned long flags;
++ WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page));
++ local_irq_save(flags);
++ account_page_dirtied(page, mapping);
++ local_irq_restore(flags);
++ __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
++ return 1;
++ }
++ return 0;
++}
++EXPORT_SYMBOL(set_page_dirty_notag);
+
- PUSH_BIT_OPT("bsdgroups", REISER4_BSD_GID);
- /* turn on 32 bit times */
- PUSH_BIT_OPT("32bittimes", REISER4_32_BIT_TIMES);
-@@ -456,7 +460,7 @@ int reiser4_init_super_data(struct super
- /* disable use of write barriers in the reiser4 log writer. */
- PUSH_BIT_OPT("no_write_barrier", REISER4_NO_WRITE_BARRIER);
-
-- PUSH_OPT(
-+ PUSH_OPT(p, opts,
- {
- /*
- * tree traversal readahead parameters:
-@@ -482,7 +486,7 @@ int reiser4_init_super_data(struct super
- );
-
- /* What to do in case of fs error */
-- PUSH_OPT(
-+ PUSH_OPT(p, opts,
- {
- .name = "onerror",
- .type = OPT_ONEOF,
-_
-From: Johannes Buchner <buchner.johannes@gmx.at>
-
-> from
-> http://www.kernel.org/pub/linux/kernel/people/edward/reiser4/reiser4-for-2.6/
-I'm sorry, I did not see half of this is already covered by
-vfs-take-2add-set_page_dirty_notag.patch. With that part removed,
-this patch is only cosmetics now.
-
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/carry.c | 2 +-
- fs/reiser4/carry_ops.c | 2 +-
- fs/reiser4/znode.h | 1 -
- mm/filemap.c | 2 +-
- 4 files changed, 3 insertions(+), 4 deletions(-)
-
-diff -puN fs/reiser4/carry.c~reiser4-some-changes-from-reiser4-2631-patch fs/reiser4/carry.c
---- a/fs/reiser4/carry.c~reiser4-some-changes-from-reiser4-2631-patch
-+++ a/fs/reiser4/carry.c
-@@ -1095,7 +1095,7 @@ static void fatal_carry_error(carry_leve
- *
- * This function itself only manages changes in carry structures and delegates
- * all hard work (allocation of znode for new root, changes of parent and
-- * sibling pointers to the reiser4_add_tree_root().
-+ * sibling pointers) to the reiser4_add_tree_root().
- *
- * Locking: old tree root is locked by carry at this point. Fake znode is also
- * locked.
-diff -puN fs/reiser4/carry_ops.c~reiser4-some-changes-from-reiser4-2631-patch fs/reiser4/carry_ops.c
---- a/fs/reiser4/carry_ops.c~reiser4-some-changes-from-reiser4-2631-patch
-+++ a/fs/reiser4/carry_ops.c
-@@ -2015,7 +2015,7 @@ static int carry_estimate_bitmaps(void)
- int bytes;
-
- bytes = capped_height() * (0 + /* bnode should be added, but
-- * its is private to bitmap.c,
-+ * it is private to bitmap.c,
- * skip for now. */
- 2 * sizeof(jnode));
- /* working and commit jnodes */
-diff -puN fs/reiser4/znode.h~reiser4-some-changes-from-reiser4-2631-patch fs/reiser4/znode.h
---- a/fs/reiser4/znode.h~reiser4-some-changes-from-reiser4-2631-patch
-+++ a/fs/reiser4/znode.h
-@@ -18,7 +18,6 @@
-
- #include <linux/types.h>
- #include <linux/spinlock.h>
--#include <linux/semaphore.h>
- #include <linux/pagemap.h> /* for PAGE_CACHE_SIZE */
- #include <asm/atomic.h>
-
-diff -puN mm/filemap.c~reiser4-some-changes-from-reiser4-2631-patch mm/filemap.c
---- a/mm/filemap.c~reiser4-some-changes-from-reiser4-2631-patch
-+++ a/mm/filemap.c
-@@ -779,7 +779,6 @@ repeat:
- rcu_read_unlock();
- return ret;
- }
--EXPORT_SYMBOL(find_get_pages);
-
- /**
- * find_get_pages_contig - gang contiguous pagecache lookup
-@@ -949,6 +948,7 @@ static void shrink_readahead_size_eio(st
- {
- ra->ra_pages /= 4;
- }
-+EXPORT_SYMBOL(find_get_pages);
-
- /**
- * do_generic_file_read - generic file read routine
-_
-From: Johannes Buchner <buchner.johannes@gmx.at>
-
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/context.c | 2 +-
- fs/reiser4/txnmgr.c | 4 ++--
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
-diff -puN fs/reiser4/context.c~reiser4-some-comments-were-still-mentioning-pdflush fs/reiser4/context.c
---- a/fs/reiser4/context.c~reiser4-some-comments-were-still-mentioning-pdflush
-+++ a/fs/reiser4/context.c
-@@ -147,7 +147,7 @@ static void reiser4_throttle_write_at(re
- * call balance_dirty_pages_ratelimited() to process formatted nodes
- * dirtied during this system call. Do that only if we are not in mount
- * and there were nodes dirtied in this context and we are not in
-- * writepage (to avoid deadlock) and not in pdflush
-+ * writepage (to avoid deadlock)
- */
- if (sbinfo != NULL && sbinfo->fake != NULL &&
- context->nr_marked_dirty != 0 &&
-diff -puN fs/reiser4/txnmgr.c~reiser4-some-comments-were-still-mentioning-pdflush fs/reiser4/txnmgr.c
---- a/fs/reiser4/txnmgr.c~reiser4-some-comments-were-still-mentioning-pdflush
-+++ a/fs/reiser4/txnmgr.c
-@@ -1360,7 +1360,7 @@ static int txn_try_to_fuse_small_atom(tx
- code tries to flush current atom.
-
- flush_some_atom() is called as part of memory clearing process. It is
-- invoked from balance_dirty_pages(), pdflushd, and entd.
-+ invoked from balance_dirty_pages() and entd.
-
- If we can flush no nodes, atom is committed, because this frees memory.
-
-@@ -1469,7 +1469,7 @@ flush_some_atom(jnode * start, long *nr_
- * or atom is too old/large,
- * we force current atom to commit */
- /* wait for commit completion but only if this
-- * wouldn't stall pdflushd and ent thread. */
-+ * wouldn't stall ent thread. */
- if (!wbc->nonblocking && !ctx->entd)
- txnh->flags |= TXNH_WAIT_COMMIT;
- atom->flags |= ATOM_FORCE_COMMIT;
-_
-From: Johannes Buchner <buchner.johannes@gmx.at>
-
-> generic_sync_sb_inodes was removed in d8a8559cd7a9cc,
-> writeback_inodes_sb and sync_inodes_sb should replace them.
-Second version, now also fixes the last comments relating to
-generic_sync_sb_inodes.
-
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/context.h | 2 +-
- fs/reiser4/entd.c | 4 +++-
- fs/reiser4/super_ops.c | 6 ++++--
- 3 files changed, 8 insertions(+), 4 deletions(-)
-
-diff -puN fs/reiser4/context.h~reiser4-generic_sync_sb_inodes-doesnt-exist-anymore fs/reiser4/context.h
---- a/fs/reiser4/context.h~reiser4-generic_sync_sb_inodes-doesnt-exist-anymore
-+++ a/fs/reiser4/context.h
-@@ -66,7 +66,7 @@ struct reiser4_context {
- /* count non-trivial jnode_set_dirty() calls */
- unsigned long nr_marked_dirty;
-
-- /* reiser4_sync_inodes calls (via generic_sync_sb_inodes)
-+ /* reiser4_sync_inodes calls (via writeback/sync_inodes_sb)
- * reiser4_writepages for each of dirty inodes. Reiser4_writepages
- * captures pages. When number of pages captured in one
- * reiser4_sync_inodes reaches some threshold - some atoms get
-diff -puN fs/reiser4/entd.c~reiser4-generic_sync_sb_inodes-doesnt-exist-anymore fs/reiser4/entd.c
---- a/fs/reiser4/entd.c~reiser4-generic_sync_sb_inodes-doesnt-exist-anymore
-+++ a/fs/reiser4/entd.c
-@@ -241,7 +241,9 @@ static void entd_flush(struct super_bloc
- if (rq->wbc->nr_to_write > 0) {
- rq->wbc->range_start = 0;
- rq->wbc->range_end = LLONG_MAX;
-- generic_sync_sb_inodes(rq->wbc);
-+ writeback_inodes_sb(super);
-+ if (rq->wbc->sync_mode == WB_SYNC_ALL)
-+ sync_inodes_sb(super);
- }
- rq->wbc->nr_to_write = ENTD_CAPTURE_APAGE_BURST;
- reiser4_writeout(super, rq->wbc);
-diff -puN fs/reiser4/super_ops.c~reiser4-generic_sync_sb_inodes-doesnt-exist-anymore fs/reiser4/super_ops.c
---- a/fs/reiser4/super_ops.c~reiser4-generic_sync_sb_inodes-doesnt-exist-anymore
-+++ a/fs/reiser4/super_ops.c
-@@ -384,7 +384,7 @@ static void reiser4_clear_inode(struct i
- * @wbc:
- *
- * This method is called by background and non-backgound writeback. Reiser4's
-- * implementation uses generic_sync_sb_inodes to call reiser4_writepages for
-+ * implementation uses writeback/sync_inodes_sb to call reiser4_writepages for
- * each of dirty inodes. Reiser4_writepages handles pages dirtied via shared
- * mapping - dirty pages get into atoms. Writeout is called to flush some
- * atoms.
-@@ -412,7 +412,9 @@ static void reiser4_sync_inodes(struct s
- * call reiser4_writepages for each of dirty inodes to turn dirty pages
- * into transactions if they were not yet.
- */
-- generic_sync_sb_inodes(wbc);
-+ writeback_inodes_sb(super);
-+ if (wbc->sync_mode == WB_SYNC_ALL)
-+ sync_inodes_sb(super);
-
- /* flush goes here */
- wbc->nr_to_write = to_write;
-_
-From: Johannes Buchner <buchner.johannes@gmx.at>
-
-The parameter wbc=NULL caused a NULL pointer dereference in
-reiser4_sync_inodes. This issue was introduced in patch
-reiser4-vfs-add-super_operationssync_inodes
-
-Cc: Edward Shishkin <edward.shishkin@gmail.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- fs/reiser4/super_ops.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff -puN fs/reiser4/super_ops.c~reiser4-fixed-null-pointer-dereference fs/reiser4/super_ops.c
---- a/fs/reiser4/super_ops.c~reiser4-fixed-null-pointer-dereference
-+++ a/fs/reiser4/super_ops.c
-@@ -395,7 +395,7 @@ static void reiser4_sync_inodes(struct s
- reiser4_context *ctx;
- long to_write;
-
-- if (wbc->for_kupdate)
-+ if (wbc == NULL || wbc->for_kupdate)
- /* reiser4 has its own means of periodical write-out */
- return;
-
-_
++/*
+ * When a writepage implementation decides that it doesn't want to write this
+ * page for some reason, it should redirty the locked page via
+ * redirty_page_for_writepage() and it should then unlock the page and return 0