Skip to contentSkip to conversation

fs/reiser4/: possible cleanups

PATCH In review Adrian Bunk 4 participants 6 messages Oct 28, 2005 – Oct 29, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/reiser4/: possible cleanups

This patch contains the following possible cleanups:
- make needlessly global code static
- #if unused code away

---

 fs/reiser4/flush_queue.c               |    2 ++
 fs/reiser4/fsdata.c                    |    9 ++++++---
 fs/reiser4/fsdata.h                    |    3 ---
 fs/reiser4/init_super.c                |    4 +++-
 fs/reiser4/inode.c                     |    2 ++
 fs/reiser4/jnode.c                     |    2 ++
 fs/reiser4/key.c                       |    2 ++
 fs/reiser4/key.h                       |    1 -
 fs/reiser4/lock.c                      |    3 +++
 fs/reiser4/oid.c                       |    2 ++
 fs/reiser4/plugin/file/cryptcompress.c |    4 ++++
 fs/reiser4/plugin/file/file.h          |    3 ---
 fs/reiser4/plugin/plugin.c             |   12 ++++++------
 fs/reiser4/plugin/plugin.h             |    2 --
 fs/reiser4/readahead.c                 |    3 +++
 fs/reiser4/readahead.h                 |    1 -
 fs/reiser4/super.c                     |    2 ++
 fs/reiser4/super.h                     |    4 ----
 fs/reiser4/tree.c                      |    2 +-
 fs/reiser4/tree.h                      |    2 --
 fs/reiser4/tree_walk.c                 |    4 ++++
 fs/reiser4/tree_walk.h                 |    2 --
 fs/reiser4/znode.c                     |    2 ++
 fs/reiser4/znode.h                     |    4 ----
 24 files changed, 44 insertions(+), 33 deletions(-)
fs/reiser4/flush_queue.c renamed from fs/reiser4/flush_queue.c.old +2 -0
@@ -644,6 +644,7 @@
 	INIT_LIST_HEAD(&atom->flush_queues);
 }
 
+#ifdef REISER4_USE_EFLUSH
 /* get a flush queue for an atom pointed by given jnode (spin-locked) ; returns
  * both atom and jnode locked and found and took exclusive access for flush
  * queue object.  */
@@ -707,6 +708,7 @@
 
 	return 0;
 }
+#endif  /*  REISER4_USE_EFLUSH  */
 
 #if REISER4_DEBUG
 
fs/reiser4/fsdata.h renamed from fs/reiser4/fsdata.h.old +0 -3
@@ -135,8 +135,6 @@
 extern void done_file_fsdata(void);
 extern reiser4_file_fsdata *reiser4_get_file_fsdata(struct file *);
 extern void reiser4_free_file_fsdata(struct file *);
-extern reiser4_file_fsdata *create_fsdata(struct file *);
-extern void free_fsdata(reiser4_file_fsdata *);
 
 
 /*
@@ -182,7 +180,6 @@
 extern int init_super_d_info(struct super_block *);
 extern void done_super_d_info(struct super_block *);
 
-extern int file_is_stateless(struct file *);
 extern loff_t get_dir_fpos(struct file *);
 extern int try_to_attach_fsdata(struct file *, struct inode *);
 extern void detach_fsdata(struct file *);
fs/reiser4/fsdata.c renamed from fs/reiser4/fsdata.c.old +6 -3
@@ -18,6 +18,9 @@
 /* spinlock protecting manipulations with dir_cursor's hash table and lists */
 static spinlock_t d_lock = SPIN_LOCK_UNLOCKED;
 
+static reiser4_file_fsdata *create_fsdata(struct file *file);
+static int file_is_stateless(struct file *file);
+static void free_fsdata(reiser4_file_fsdata *fsdata);
 static void kill_cursor(dir_cursor *);
 
 /**
@@ -480,7 +483,7 @@
  * one file system operation. This means that there may be "detached state"
  * for underlying inode.
  */
-int file_is_stateless(struct file *file)
+static int file_is_stateless(struct file *file)
 {
 	return reiser4_get_dentry_fsdata(file->f_dentry)->stateless;
 }
@@ -686,7 +689,7 @@
  *
  * Allocates and initializes reiser4_file_fsdata structure.
  */
-reiser4_file_fsdata *create_fsdata(struct file *file)
+static reiser4_file_fsdata *create_fsdata(struct file *file)
 {
 	reiser4_file_fsdata *fsdata;
 
@@ -706,7 +709,7 @@
  *
  * Dual to create_fsdata(). Free reiser4_file_fsdata.
  */
-void free_fsdata(reiser4_file_fsdata *fsdata)
+static void free_fsdata(reiser4_file_fsdata *fsdata)
 {
 	BUG_ON(fsdata == NULL);
 	kmem_cache_free(file_fsdata_cache, fsdata);
fs/reiser4/super.h renamed from fs/reiser4/super.h.old +0 -4
@@ -428,7 +428,6 @@
 extern __u64 reiser4_free_blocks(const struct super_block *super);
 extern void reiser4_set_free_blocks(const struct super_block *super, __u64 nr);
 extern __u32 reiser4_mkfs_id(const struct super_block *super);
-extern void reiser4_set_mkfs_id(const struct super_block *super, __u32 id);
 
 extern __u64 reiser4_free_committed_blocks(const struct super_block *super);
 
@@ -455,7 +454,6 @@
 				       const reiser4_block_nr * blk);
 extern int reiser4_fill_super(struct super_block *s, void *data, int silent);
 extern int reiser4_done_super(struct super_block *s);
-extern reiser4_plugin * get_default_plugin(pset_member memb);
 
 /* step of fill super */
 extern int init_fs_info(struct super_block *);
@@ -463,7 +461,6 @@
 extern int init_super_data(struct super_block *, char *opt_string);
 extern int init_read_super(struct super_block *, int silent);
 extern int init_root_inode(struct super_block *);
-extern void done_root_inode(struct super_block *);
 
 
 /* Maximal possible object id. */
@@ -477,7 +474,6 @@
 void oid_count_allocated(void);
 void oid_count_released(void);
 long oids_used(const struct super_block *);
-long oids_free(const struct super_block *);
 
 #if REISER4_DEBUG
 void print_fs_info(const char *prefix, const struct super_block *);
fs/reiser4/init_super.c renamed from fs/reiser4/init_super.c.old +3 -1
@@ -665,7 +665,7 @@
 };
 
 /* access to default plugin table */
-reiser4_plugin *get_default_plugin(pset_member memb)
+static reiser4_plugin *get_default_plugin(pset_member memb)
 {
 	return plugin_by_id(default_plugins[memb].type,
 			    default_plugins[memb].id);
@@ -732,6 +732,7 @@
  *
  * Puts inode of root directory.
  */
+#if 0
 void done_root_inode(struct super_block *super)
 {
 	/* remove unused children of the parent dentry */
@@ -742,6 +743,7 @@
 	/* discard all inodes of filesystem */
 	invalidate_inodes(super);
 }
+#endif  /*  0  */
 
 /*
  * Local variables:
fs/reiser4/inode.c renamed from fs/reiser4/inode.c.old +2 -0
@@ -109,6 +109,7 @@
 		return 255;
 }
 
+#ifdef REISER4_USE_COLLISION_LIMIT
 /* Maximal number of hash collisions for this directory. */
 int max_hash_collisions(const struct inode *dir /* inode queried */ )
 {
@@ -120,6 +121,7 @@
 	return ~0;
 #endif
 }
+#endif  /*  REISER4_USE_COLLISION_LIMIT  */
 
 /* Install file, inode, and address_space operation on @inode, depending on
    its mode. */
fs/reiser4/jnode.c renamed from fs/reiser4/jnode.c.old +2 -0
@@ -1927,6 +1927,7 @@
 
 #endif				/* REISER4_DEBUG */
 
+#ifdef REISER4_COPY_ON_CAPTURE
 /* this is only used to created jnode during capture copy */
 jnode *jclone(jnode * node)
 {
@@ -1942,6 +1943,7 @@
 	JF_SET(clone, JNODE_CC);
 	return clone;
 }
+#endif  /*  REISER4_COPY_ON_CAPTURE  */
 
 /* Make Linus happy.
    Local variables:
fs/reiser4/key.h renamed from fs/reiser4/key.h.old +0 -1
@@ -364,7 +364,6 @@
 /* size of a buffer suitable to hold human readable key representation */
 #define KEY_BUF_LEN (80)
 
-extern int sprintf_key(char *buffer, const reiser4_key * key);
 #if REISER4_DEBUG
 extern void print_key(const char *prefix, const reiser4_key * key);
 #else
fs/reiser4/key.c renamed from fs/reiser4/key.c.old +2 -0
@@ -126,6 +126,7 @@
 
 #endif
 
+#if 0
 /* like print_key() but outputs key representation into @buffer. */
 int sprintf_key(char *buffer /* buffer to print key into */ ,
 		const reiser4_key * key /* key to print */ )
@@ -146,6 +147,7 @@
 			       (unsigned long long)get_key_objectid(key),
 			       (unsigned long long)get_key_offset(key));
 }
+#endif  /*  0  */
 
 /* Make Linus happy.
    Local variables:
fs/reiser4/znode.h renamed from fs/reiser4/znode.h.old +0 -4
@@ -238,12 +238,8 @@
 
 #if REISER4_DEBUG
 extern void print_znode(const char *prefix, const znode * node);
-extern void print_znodes(const char *prefix, reiser4_tree * tree);
-extern void print_lock_stack(const char *prefix, lock_stack * owner);
 #else
 #define print_znode( p, n ) noop
-#define print_znodes( p, t ) noop
-#define print_lock_stack( p, o ) noop
 #endif
 
 /* Make it look like various znode functions exist instead of treating znodes as
fs/reiser4/lock.c renamed from fs/reiser4/lock.c.old +3 -0
@@ -1259,6 +1259,8 @@
 }
 
 #if REISER4_DEBUG
+
+#if 0
 /* Debugging help */
 void print_lock_stack(const char *prefix, lock_stack * owner)
 {
@@ -1288,6 +1290,7 @@
 
 	spin_unlock_stack(owner);
 }
+#endif  /*  0  */
 
 /*
  * debugging functions
fs/reiser4/oid.c renamed from fs/reiser4/oid.c.old +2 -0
@@ -100,6 +100,7 @@
 		return (long)-1;
 }
 
+#if 0
 /*
  * return number of "free" oids. This is used by statfs(2) to report "free"
  * inodes.
@@ -119,6 +120,7 @@
 	else
 		return (long)-1;
 }
+#endif  /*  0  */
 
 /*
  * Count oid as allocated in atom. This is done after call to oid_allocate()
fs/reiser4/plugin/file/file.h renamed from fs/reiser4/plugin/file/file.h.old +0 -3
@@ -174,9 +174,6 @@
 extern int readpage_cryptcompress(struct file *, struct page *);
 extern int writepages_cryptcompress(struct address_space *,
 				     struct writeback_control *);
-extern void readpages_cryptcompress(struct file *, struct address_space *,
-				    struct list_head *pages);
-extern sector_t bmap_cryptcompress(struct address_space *, sector_t lblock);
 
 
 /* file plugin operations */
fs/reiser4/plugin/file/cryptcompress.c renamed from fs/reiser4/plugin/file/cryptcompress.c.old +4 -0
@@ -1010,6 +1010,7 @@
 	return result;
 }
 
+#if 0
 /* plugin->readpages() */
 void
 readpages_cryptcompress(struct file *file, struct address_space *mapping,
@@ -1033,6 +1034,7 @@
 
 	return;
 }
+#endif  /*  0  */
 
 /* how much pages will be captured */
 static int cluster_nrpages_to_capture(reiser4_cluster_t * clust)
@@ -3357,6 +3359,7 @@
 /* plugin->u.file.release */
 /* plugin->u.file.get_block */
 
+#if 0
 /* implentation of vfs' bmap method of struct address_space_operations for
    cryptcompress plugin
 */
@@ -3418,6 +3421,7 @@
 		return result;
 	}
 }
+#endif  /*  0  */
 
 /* this is implementation of delete method of file plugin for cryptcompress
  */
fs/reiser4/plugin/plugin.h renamed from fs/reiser4/plugin/plugin.h.old +0 -2
@@ -677,8 +677,6 @@
 /* stores plugin reference in reiser4-specific part of inode */
 extern int set_object_plugin(struct inode *inode, reiser4_plugin_id id);
 extern int setup_plugins(struct super_block *super, reiser4_plugin ** area);
-extern reiser4_plugin *lookup_plugin(const char *type_label,
-				     const char *plug_label);
 extern int init_plugins(void);
 
 /* builtin plugins */
fs/reiser4/plugin/plugin.c renamed from fs/reiser4/plugin/plugin.c.old +6 -6
@@ -186,14 +186,8 @@
 /* initialise plugin sub-system. Just call this once on reiser4 startup. */
 int init_plugins(void);
 int setup_plugins(struct super_block *super, reiser4_plugin ** area);
-reiser4_plugin *lookup_plugin(const char *type_label, const char *plug_label);
 int locate_plugin(struct inode *inode, plugin_locator * loc);
 
-/* internal functions. */
-
-static reiser4_plugin_type find_type(const char *label);
-static reiser4_plugin *find_plugin(reiser4_plugin_type_data * ptype,
-				   const char *label);
 
 /**
  * init_plugins - initialize plugins
@@ -257,6 +251,7 @@
 	return id < plugins[type_id].builtin_num;
 }
 
+#if 0
 /* lookup plugin by scanning tables */
 reiser4_plugin *lookup_plugin(const char *type_label /* plugin type label */ ,
 			      const char *plug_label /* plugin label */ )
@@ -274,6 +269,7 @@
 		result = NULL;
 	return result;
 }
+#endif  /*  0  */
 
 /* return plugin by its @type_id and @id.
 
@@ -329,6 +325,8 @@
 	return &plugins[type_id].plugins_list;
 }
 
+#if 0
+
 /* find plugin type by label */
 static reiser4_plugin_type find_type(const char *label	/* plugin type
 							 * label */ )
@@ -370,6 +368,8 @@
 	return NULL;
 }
 
+#endif  /*  0  */
+
 int grab_plugin(struct inode *self, struct inode *ancestor, pset_member memb)
 {
 	reiser4_plugin *plug;
fs/reiser4/readahead.h renamed from fs/reiser4/readahead.h.old +0 -1
@@ -32,7 +32,6 @@
 	loff_t slow_start;	/* enlarging r/a size algorithm. */
 };
 
-extern int reiser4_file_readahead(struct file *, loff_t, size_t);
 extern void reiser4_readdir_readahead_init(struct inode *dir, tap_t * tap);
 
 /* __READAHEAD_H__ */
fs/reiser4/readahead.c renamed from fs/reiser4/readahead.c.old +3 -0
@@ -112,6 +112,8 @@
 	done_lh(&next_lh);
 }
 
+#if 0
+
 static inline loff_t get_max_readahead(struct reiser4_file_ra_state *ra)
 {
 	/* NOTE: ra->max_window_size is initialized in
@@ -360,6 +362,7 @@
       out:
 	return 0;
 }
+#endif  /*  0  */
 
 void reiser4_readdir_readahead_init(struct inode *dir, tap_t * tap)
 {
fs/reiser4/super.c renamed from fs/reiser4/super.c.old +2 -0
@@ -120,6 +120,7 @@
 	return get_super_private(super)->mkfs_id;
 }
 
+#if 0
 /* set mkfs unique identifier */
 void reiser4_set_mkfs_id(const struct super_block *super, __u32 id)
 {
@@ -127,6 +128,7 @@
 	assert("vpf-224", is_reiser4_super(super));
 	get_super_private(super)->mkfs_id = id;
 }
+#endif  /*  0  */
 
 /* amount of free blocks in file system */
 __u64 reiser4_free_committed_blocks(const struct super_block *super)
fs/reiser4/tree.h renamed from fs/reiser4/tree.h.old +0 -2
@@ -168,8 +168,6 @@
 #define spin_ordering_pred_epoch(tree) (1)
 SPIN_LOCK_FUNCTIONS(epoch, reiser4_tree, epoch_lock);
 
-extern void init_tree_0(reiser4_tree *);
-
 extern int init_tree(reiser4_tree * tree,
 		     const reiser4_block_nr * root_block, tree_level height,
 		     node_plugin * default_plugin);
fs/reiser4/tree.c renamed from fs/reiser4/tree.c.old +1 -1
@@ -1814,7 +1814,7 @@
 }
 
 /* first step of reiser4 tree initialization */
-void init_tree_0(reiser4_tree * tree)
+static void init_tree_0(reiser4_tree * tree)
 {
 	assert("zam-683", tree != NULL);
 	rw_tree_init(tree);
fs/reiser4/tree_walk.h renamed from fs/reiser4/tree_walk.h.old +0 -2
@@ -105,8 +105,6 @@
 	 * node or extent processing functions. */
 	int (*before) (void *);
 };
-extern int tree_walk(const reiser4_key *, int, struct tree_walk_actor *,
-		     void *);
 
 #if REISER4_DEBUG
 int check_sibling_list(znode * node);
fs/reiser4/tree_walk.c renamed from fs/reiser4/tree_walk.c.old +4 -0
@@ -910,6 +910,8 @@
 	assert("nikita-3281", check_sibling_list(before));
 }
 
+#if 0
+
 struct tw_handle {
 	/* A key for tree walking (re)start, updated after each successful tree
 	 * node processing */
@@ -1237,6 +1239,8 @@
 	return ret;
 }
 
+#endif  /*  0  */
+
 /*
    Local variables:
    c-indentation-style: "K&R"
fs/reiser4/znode.c renamed from fs/reiser4/znode.c.old +2 -0
@@ -1031,6 +1031,7 @@
 	printk("\n");
 }
 
+#if 0
 /* print all znodes in @tree */
 void print_znodes(const char *prefix, reiser4_tree * tree)
 {
@@ -1061,6 +1062,7 @@
 	if (tree_lock_taken)
 		WUNLOCK_TREE(tree);
 }
+#endif  /*  0  */
 
 /* return non-0 iff data are loaded into znode */
 int znode_is_loaded(const znode * node /* znode to query */ )
#1 lore raw

When I read the Subject (*[2.6 patch] fs/reiser4/: possible cleanups)* for a second, I thought that this patch was against Linus' tree. I concluded that reiser4 must have been recently merged in mainline, since there's a patch for it. But no, it's a -mm patch. Gah! Shouldn't the Subject be more like [ 2.6-mm patch] as to not mislead us dreamers?

#2 lore raw
Quoted 5 lines · Ioan Ionita

When I read the Subject (*[2.6 patch] fs/reiser4/: possible cleanups)* for a second, I thought that this patch was against Linus' tree. I concluded that reiser4 must have been recently merged in mainline, since there's a patch for it. But no, it's a -mm patch. Gah! Shouldn't the Subject be more like [ 2.6-mm patch] as to not mislead us dreamers?

It should have been [-mm patch], but everyone makes mistakes...

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#3 lore raw

Remember my message where I said reiser4 was preventing my laptop from
shutting down itself ?

Well it turned out that, in fact, it was a stupid shfs-mount process
which would refuse to die. Adding a "killall ssh" in the local.stop script is a bit violent, but perfectly functional way, to bring it back to reason. Everything now works.

But still, I had to fsck --rebuild-tree just because my battery ran out...

#4 lore raw
Quoted 4 lines · PFC

Remember my message where I said reiser4 was preventing my laptop
from shutting down itself ?

Quoted 10 lines

Well it turned out that, in fact, it was a stupid shfs-mount
process which would refuse to die. Adding a "killall ssh" in the local.stop script is a bit violent, but perfectly functional way, to bring it back to reason. Everything now works.

But still, I had to fsck --rebuild-tree just because my battery
ran out...

the battery running out should not have caused you to need to do that.

zam, can you do some testing of how well we handle power cord yanking while under load? There are some guys at stanford who have some test programs for this sort of thing, I wish I could remember their name at the moment....

Hans

#5 lore raw

fsck --rebuild-tree just because my battery ran out...

I do not know if a laptop battery running out behaves the same as a power
cord yanking, but this fact may be interesting :
As I was just reading some document, with no other activity, the
harddrive had spinned down since a while, and was NOT running (as in NOT spinning) when the battery ran out. So it seems, the HD had spinned down, while the FS was in an inconsistent state. Strange.

This happened several times, out of which, once I had to fsck, and the
other to --rebuild-tree.

	linux-2.6.11-cko1-swsusp2
	reiser4
	gentoo
	Centrino Pentium M laptop

cat /proc/sys/vm/laptop_mode
0

/dev/hda:

 multcount    = 16 (on)
 IO_support   =  0 (default 16-bit)
 unmaskirq    =  0 (off)
 using_dma    =  1 (on)
 keepsettings =  0 (off)
 readonly     =  0 (off)
 readahead    = 256 (on)
 geometry     = 65535/16/63, sectors = 60011642880, start = 0

I assume the disk flushes its write cache before going to standby (or else the manufacturers are crazy)...

I hope this can help...

Quoted 22 lines
Quoted 13 lines

Remember my message where I said reiser4 was preventing my laptop
from shutting down itself ?

Well it turned out that, in fact, it was a stupid shfs-mount
process which would refuse to die. Adding a "killall ssh" in the local.stop script is a bit violent, but perfectly functional way, to bring it back to reason. Everything now works.

But still, I had to fsck --rebuild-tree just because my battery
ran out...

the battery running out should not have caused you to need to do that.

zam, can you do some testing of how well we handle power cord yanking while under load? There are some guys at stanford who have some test programs for this sort of thing, I wish I could remember their name at the moment....http://www.materiel.net/details_VA7000BWA.html

Hans