Skip to contentSkip to conversation

reiser4: fixups for 3.7

PATCH New Edward Shishkin 1 participant 1 message Jan 6, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reiser4: fixups for 3.7

This patch is against Linux-3.7 + the following two patches from Ivan Shapovalov:
1) reiser4-3.7-whole.patch
2) 0001-reiser4-add-a-stub-for-address_space_operations-migr.patch

. Ifdef reiser4_migratepage to prevent compilation error
in the case when CONFIG_MIGRATION is not defined;
. Use separate foo_bugop() instead of the common bugop()
to understand in what stub the oops occured;
. Don't set zeros to the body of ctail item in debug mode
(where extra-modifications are highly undesirable);
. Use "dispatch" prefix for file operations, which pass
management to FILE plugins in accordance with inode's plugin table (pset);
. Update comments.

---
 fs/reiser4/as_ops.c                      |   14 +--
 fs/reiser4/context.h                     |   13 +-
 fs/reiser4/plugin/file/file.c            |    2 
 fs/reiser4/plugin/file/file.h            |   64 +++++--------
 fs/reiser4/plugin/file/file_conversion.c |   74 ++++++----------
 fs/reiser4/plugin/file_ops.c             |    4 
 fs/reiser4/plugin/item/ctail.c           |    5 -
 fs/reiser4/plugin/item/extent_file_ops.c |   20 ++--
 fs/reiser4/plugin/item/tail.c            |   17 ++-
 fs/reiser4/plugin/object.c               |  143 +++++++++++++++++++++++++------
 fs/reiser4/plugin/plugin.h               |   11 --
 fs/reiser4/super_ops.c                   |   10 +-
 fs/reiser4/txnmgr.c                      |    2 
 fs/reiser4/vfs_ops.c                     |   10 +-
 fs/reiser4/vfs_ops.h                     |    5 +
 15 files changed, 233 insertions(+), 161 deletions(-)
fs/reiser4/as_ops.c +8 -6
@@ -305,15 +305,17 @@ int reiser4_releasepage(struct page *pag
 	}
 }
 
+#ifdef CONFIG_MIGRATION
 int reiser4_migratepage(struct address_space *mapping, struct page *newpage,
 			struct page *page, enum migrate_mode mode)
 {
-	/* TODO: implement page migration (or prove it to be impossible)
+	/* TODO: implement movable mapping
 	 */
 	return fail_migrate_page(mapping, newpage, page);
 }
+#endif /* CONFIG_MIGRATION */
 
-int reiser4_readpage(struct file *file, struct page *page)
+int reiser4_readpage_dispatch(struct file *file, struct page *page)
 {
 	assert("edward-1533", PageLocked(page));
 	assert("edward-1534", !PageUptodate(page));
@@ -322,15 +324,15 @@ int reiser4_readpage(struct file *file,
 	return inode_file_plugin(page->mapping->host)->readpage(file, page);
 }
 
-int reiser4_readpages(struct file *file, struct address_space *mapping,
-		      struct list_head *pages, unsigned nr_pages)
+int reiser4_readpages_dispatch(struct file *file, struct address_space *mapping,
+			       struct list_head *pages, unsigned nr_pages)
 {
 	return inode_file_plugin(mapping->host)->readpages(file, mapping,
 							   pages, nr_pages);
 }
 
-int reiser4_writepages(struct address_space *mapping,
-		       struct writeback_control *wbc)
+int reiser4_writepages_dispatch(struct address_space *mapping,
+				struct writeback_control *wbc)
 {
 	return inode_file_plugin(mapping->host)->writepages(mapping, wbc);
 }
fs/reiser4/context.h +7 -6
@@ -65,12 +65,13 @@ struct reiser4_context {
 
 	/* count non-trivial jnode_set_dirty() calls */
 	unsigned long nr_marked_dirty;
-
-	/* 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
-	 * flushed */
+	/*
+	 * reiser4_writeback_inodes calls (via generic_writeback_sb_inodes)
+	 * reiser4_writepages_dispatch for each of dirty inodes.
+	 * Reiser4_writepages_dispatch captures pages. When number of pages
+	 * captured in one reiser4_writeback_inodes reaches some threshold -
+	 * some atoms get flushed
+	 */
 	int nr_captured;
 	int nr_children;	/* number of child contexts */
 	struct page *locked_page; /* page that should be unlocked in
fs/reiser4/plugin/file/file.c +1 -1
@@ -1150,7 +1150,7 @@ static int commit_file_atoms(struct inod
 		     * when we are called by
 		     * filemap_fdatawrite->
 		     *    do_writepages()->
-		     *       reiser4_writepages()
+		     *       reiser4_writepages_dispatch()
 		     *
 		     * inode->i_mapping->dirty_pages are spices into
 		     * ->io_pages, leaving ->dirty_pages dirty.
fs/reiser4/plugin/file/file.h +26 -38

78 lines not on this page · raw message

fs/reiser4/plugin/file/file_conversion.c +32 -42

144 lines not on this page · raw message

fs/reiser4/plugin/file_ops.c +2 -2
@@ -69,8 +69,8 @@ int reiser4_sync_common(struct file *fil
  *
  * Situation is complicated by anonymous pages: i.e., extent-less pages
  * dirtied through mmap. Fortunately sys_fsync() first calls
- * filemap_fdatawrite() that will ultimately call reiser4_writepages(), insert
- * all missing extents and capture anonymous pages.
+ * filemap_fdatawrite() that will ultimately call reiser4_writepages_dispatch,
+ * insert all missing extents and capture anonymous pages.
  */
 int reiser4_sync_file_common(struct file *file, loff_t start, loff_t end, int datasync)
 {
fs/reiser4/plugin/item/ctail.c +1 -4
@@ -488,10 +488,7 @@ cut_or_kill_ctail_units(coord_t * coord,
 			   by units got freed */
 			count += sizeof(ctail_item_format);
 		}
-		if (REISER4_DEBUG)
-			memset(item, 0, count);
-	} else if (REISER4_DEBUG)
-		memset(item + sizeof(ctail_item_format) + from, 0, count);
+	}
 	return count;
 }
 
fs/reiser4/plugin/item/extent_file_ops.c +12 -8
@@ -1301,14 +1301,18 @@ int reiser4_read_extent(struct file *fil
 }
 
 /*
-   plugin->s.file.readpage
-   reiser4_read->unix_file_read->page_cache_readahead->reiser4_readpage->unix_file_readpage->extent_readpage
-   or
-   filemap_fault->reiser4_readpage->readpage_unix_file->->readpage_extent
-
-   At the beginning: coord->node is read locked, zloaded, page is
-   locked, coord is set to existing unit inside of extent item (it is not necessary that coord matches to page->index)
-*/
+ * plugin->s.file.readpage
+ *
+ * reiser4_read->unix_file_read->page_cache_readahead->
+ * ->reiser4_readpage_dispatch->readpage_unix_file->readpage_extent
+ * or
+ * filemap_fault->reiser4_readpage_dispatch->readpage_unix_file->
+ * ->readpage_extent
+ *
+ * At the beginning: coord->node is read locked, zloaded, page is
+ * locked, coord is set to existing unit inside of extent item (it
+ * is not necessary that coord matches to page->index)
+ */
 int reiser4_readpage_extent(void *vp, struct page *page)
 {
 	uf_coord_t *uf_coord = vp;
fs/reiser4/plugin/item/tail.c +10 -7
@@ -404,13 +404,16 @@ static int do_readpage_tail(uf_coord_t *
 }
 
 /*
-   plugin->s.file.readpage
-   reiser4_read->unix_file_read->page_cache_readahead->reiser4_readpage->unix_file_readpage->readpage_tail
-   or
-   filemap_fault->reiser4_readpage->readpage_unix_file->->readpage_tail
-
-   At the beginning: coord->node is read locked, zloaded, page is locked, coord is set to existing unit inside of tail
-   item. */
+ * plugin->s.file.readpage
+ *
+ * reiser4_read_dispatch->read_unix_file->page_cache_readahead->
+ * ->reiser4_readpage_dispatch->readpage_unix_file->readpage_tail
+ * or
+ * filemap_fault->reiser4_readpage_dispatch->readpage_unix_file->readpage_tail
+ *
+ * At the beginning: coord->node is read locked, zloaded, page is locked,
+ * coord is set to existing unit inside of tail item.
+ */
 int readpage_tail(void *vp, struct page *page)
 {
 	uf_coord_t *uf_coord = vp;
fs/reiser4/plugin/object.c +116 -27

192 lines not on this page · raw message

fs/reiser4/plugin/plugin.h +1 -10
@@ -201,16 +201,7 @@ typedef struct file_plugin {
 	/* generic fields */
 	plugin_header h;
 
-	/* VFS methods.
-	 * Must be invariant with respect to plugin conversion.
-	 * It can be achieved by using "common" methods, which
-	 * are the same for all plugins that take participation in
-	 * conversion, or by using "generic" or "careful" methods,
-	 * which provide automatic redirection to proper private
-	 * plugin methods ("careful" are the same as "generic",
-	 * but with protection of pset and other disk structures
-	 * from being rebuilt during conversion.
-	 */
+	/* VFS methods */
 	struct inode_operations * inode_ops;
 	struct file_operations * file_ops;
 	struct address_space_operations * as_ops;
fs/reiser4/super_ops.c +6 -4
@@ -343,10 +343,12 @@ static int reiser4_statfs(struct dentry
  * @wb:
  * @wbc:
  *
- * This method is called by background and non-backgound writeback. Reiser4's
- * 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.
+ * This method is called by background and non-backgound writeback.
+ * Reiser4's implementation uses generic_writeback_sb_inodes to call
+ * reiser4_writepages_dispatch for each of dirty inodes.
+ * reiser4_writepages_dispatch handles pages dirtied via shared
+ * mapping - dirty pages get into atoms. Writeout is called to flush
+ * some atoms.
  */
 static long reiser4_writeback_inodes(struct super_block *super,
 				     struct bdi_writeback *wb,
fs/reiser4/txnmgr.c +1 -1
@@ -179,7 +179,7 @@ year old --- define all technical terms
  *
  *     When file is accessed through mmap(2) page is always created during
  *     page fault.
- *     After this (in reiser4_readpage()->reiser4_readpage_extent()):
+ *     After this (in reiser4_readpage_dispatch()->reiser4_readpage_extent()):
  *
  *         1. if access is made to non-hole page new jnode is created, (if
  *         necessary)
fs/reiser4/vfs_ops.c +5 -5
@@ -148,12 +148,12 @@ void reiser4_writeout(struct super_block
 	struct address_space *mapping;
 
 	/*
-	 * Performs early flushing, trying to free some memory. If there is
-	 * nothing to flush, commits some atoms.
+	 * Performs early flushing, trying to free some memory. If there
+	 * is nothing to flush, commits some atoms.
+	 *
+	 * Commit all atoms if reiser4_writepages_dispatch() is called
+	 * from sys_sync() or sys_fsync()
 	 */
-
-	/* Commit all atoms if reiser4_writepages() is called from sys_sync() or
-	   sys_fsync(). */
 	if (wbc->sync_mode != WB_SYNC_NONE) {
 		txnmgr_force_commit_all(sb, 0);
 		return;
fs/reiser4/vfs_ops.h +5 -0
@@ -24,8 +24,13 @@ int reiser4_writepage(struct page *, str
 int reiser4_set_page_dirty(struct page *);
 void reiser4_invalidatepage(struct page *, unsigned long offset);
 int reiser4_releasepage(struct page *, gfp_t);
+
+#ifdef CONFIG_MIGRATION
 int reiser4_migratepage(struct address_space *, struct page *,
 			struct page *, enum migrate_mode);
+#else
+#define reiser4_migratepage NULL
+#endif /* CONFIG_MIGRATION */
 
 extern int reiser4_update_sd(struct inode *);
 extern int reiser4_add_nlink(struct inode *, struct inode *, int);