Skip to contentSkip to conversation

fs/reiser4/: misc cleanups

PATCH In review Adrian Bunk 2 participants 3 messages Jan 5, 2006 – Jan 7, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/reiser4/: misc cleanups

This patch makes some needlessly global code static and #ifdef's some unused code away.

---

 fs/reiser4/debug.c                         |   31 ++++-----
 fs/reiser4/debug.h                         |    2 
 fs/reiser4/entd.c                          |    4 +
 fs/reiser4/entd.h                          |    2 
 fs/reiser4/estimate.c                      |    2 
 fs/reiser4/inode.c                         |    2 
 fs/reiser4/inode.h                         |    1 
 fs/reiser4/jnode.c                         |   62 +++++++++---------
 fs/reiser4/jnode.h                         |    2 
 fs/reiser4/plugin/cluster.h                |    3 
 fs/reiser4/plugin/compress/compress_mode.c |    2 
 fs/reiser4/plugin/file/cryptcompress.c     |   69 +++++++++++++--------
 fs/reiser4/plugin/file/cryptcompress.h     |    7 --
 fs/reiser4/plugin/file/file.h              |    3 
 fs/reiser4/plugin/file/funcs.h             |    2 
 fs/reiser4/plugin/file_ops.c               |    2 
 fs/reiser4/plugin/file_plugin_common.c     |    2 
 fs/reiser4/plugin/item/ctail.c             |    2 
 fs/reiser4/plugin/object.h                 |    3 
 fs/reiser4/plugin/plugin_set.c             |    8 +-
 fs/reiser4/plugin/plugin_set.h             |    5 -
 21 files changed, 106 insertions(+), 110 deletions(-)
fs/reiser4/estimate.c renamed from fs/reiser4/estimate.c.old +1 -1
@@ -70,7 +70,7 @@
 }
 
 /* returnes max number of nodes can be occupied by disk cluster */
-reiser4_block_nr estimate_cluster(struct inode * inode, int unprepped)
+static reiser4_block_nr estimate_cluster(struct inode * inode, int unprepped)
 {
 	int per_cluster;
 	per_cluster = (unprepped ? 1 : cluster_nrpages(inode));
fs/reiser4/debug.h renamed from fs/reiser4/debug.h.old +0 -2
@@ -226,8 +226,6 @@
 
 
 #if REISER4_DEBUG
-extern void print_lock_counters(const char *prefix,
-				const lock_counters_info * info);
 extern int no_counters_are_held(void);
 extern int commit_check_locks(void);
 #else
fs/reiser4/debug.c renamed from fs/reiser4/debug.c.old +14 -17
@@ -123,22 +123,6 @@
 }
 
 #if REISER4_DEBUG
-
-/* check that no spinlocks are held */
-int schedulable(void)
-{
-	if (get_current_context_check() != NULL) {
-		if (!LOCK_CNT_NIL(spin_locked)) {
-			print_lock_counters("in atomic", lock_counters());
-			return 0;
-		}
-	}
-	might_sleep();
-	return 1;
-}
-#endif
-
-#if REISER4_DEBUG
 /* Debugging aid: return struct where information about locks taken by current
    thread is accumulated. This can be used to formulate lock ordering
    constraints and various assertions.
@@ -154,7 +138,8 @@
 /*
  * print human readable information about locks held by the reiser4 context.
  */
-void print_lock_counters(const char *prefix, const lock_counters_info * info)
+static void print_lock_counters(const char *prefix,
+				const lock_counters_info * info)
 {
 	printk("%s: jnode: %i, tree: %i (r:%i,w:%i), dk: %i (r:%i,w:%i)\n"
 	       "jload: %i, "
@@ -187,6 +172,18 @@
 	       info->d_refs, info->x_refs, info->t_refs);
 }
 
+/* check that no spinlocks are held */
+int schedulable(void)
+{
+	if (get_current_context_check() != NULL) {
+		if (!LOCK_CNT_NIL(spin_locked)) {
+			print_lock_counters("in atomic", lock_counters());
+			return 0;
+		}
+	}
+	might_sleep();
+	return 1;
+}
 /*
  * return true, iff no locks are held.
  */
fs/reiser4/entd.h renamed from fs/reiser4/entd.h.old +0 -2
@@ -75,8 +75,6 @@
 extern int wbq_available(void);
 extern void ent_writes_page(struct super_block *, struct page *);
 
-extern struct wbq *get_wbq(struct super_block *);
-extern void put_wbq(struct super_block *, struct wbq *);
 extern jnode *get_jnode_by_wbq(struct super_block *, struct wbq *);
 /* __ENTD_H__ */
 #endif
fs/reiser4/entd.c renamed from fs/reiser4/entd.c.old +4 -0
@@ -86,6 +86,8 @@
 	return wbq;
 }
 
+#if 0
+
 struct wbq * get_wbq(struct super_block * super)
 {
 	struct wbq *result;
@@ -107,6 +109,8 @@
 	spin_unlock(&ent->guard);
 }
 
+#endif  /*  0  */
+
 static void wakeup_all_wbq(entd_context * ent)
 {
 	struct wbq *rq;
fs/reiser4/inode.h renamed from fs/reiser4/inode.h.old +0 -1
@@ -340,7 +340,6 @@
 
 extern file_plugin *inode_file_plugin(const struct inode *inode);
 extern dir_plugin *inode_dir_plugin(const struct inode *inode);
-extern perm_plugin *inode_perm_plugin(const struct inode *inode);
 extern formatting_plugin *inode_formatting_plugin(const struct inode *inode);
 extern hash_plugin *inode_hash_plugin(const struct inode *inode);
 extern fibration_plugin *inode_fibration_plugin(const struct inode *inode);
fs/reiser4/inode.c renamed from fs/reiser4/inode.c.old +2 -0
@@ -521,11 +521,13 @@
 	return reiser4_inode_data(inode)->pset->dir;
 }
 
+#if 0
 perm_plugin *inode_perm_plugin(const struct inode * inode)
 {
 	assert("nikita-1999", inode != NULL);
 	return reiser4_inode_data(inode)->pset->perm;
 }
+#endif  /*  0  */
 
 formatting_plugin *inode_formatting_plugin(const struct inode * inode)
 {
fs/reiser4/jnode.h renamed from fs/reiser4/jnode.h.old +0 -2
@@ -449,12 +449,10 @@
 
 extern int znode_is_any_locked(const znode * node);
 extern void jnode_list_remove(jnode * node);
-extern void info_jnode(const char *prefix, const jnode * node);
 
 #else
 
 #define jnode_list_remove(node) noop
-#define info_jnode(p, n) noop
 
 #endif
 
fs/reiser4/jnode.c renamed from fs/reiser4/jnode.c.old +32 -30

88 lines not on this page · raw message

fs/reiser4/plugin/file/cryptcompress.h renamed from fs/reiser4/plugin/file/cryptcompress.h.old +0 -7
@@ -436,14 +436,11 @@
 	crypto_stat_t *crypt;
 } cryptcompress_info_t;
 
-cryptcompress_info_t *cryptcompress_inode_data(const struct inode *inode);
 int equal_to_rdk(znode *, const reiser4_key *);
 int goto_right_neighbor(coord_t *, lock_handle *);
 int load_file_hint(struct file *, hint_t *);
 void save_file_hint(struct file *, const hint_t *);
 void hint_init_zero(hint_t *);
-int need_cipher (struct inode *);
-int host_allows_crypto_stat(struct inode * inode);
 int crc_inode_ok(struct inode *inode);
 int jnode_of_cluster(const jnode * node, struct page * page);
 extern int ctail_read_disk_cluster (reiser4_cluster_t *, struct inode *, int);
@@ -457,14 +454,10 @@
 void inherit_crypto_stat_common(struct inode * parent, struct inode * object,
 				int (*can_inherit)(struct inode * child,
 						   struct inode * parent));
-crypto_stat_t * create_crypto_stat(struct inode * parent, crypto_data_t * data);
-int crypto_stat_instantiated(crypto_stat_t * info);
 void attach_crypto_stat(struct inode * inode, crypto_stat_t * info);
 void detach_crypto_stat(struct inode * inode);
 void change_crypto_stat(struct inode * inode, crypto_stat_t * new);
-int can_inherit_crypto_crc(struct inode *child, struct inode *parent);
 crypto_stat_t * alloc_crypto_stat (struct inode * inode);
-int switch_compression(struct inode *inode);
 
 
 static inline reiser4_tfma_t *
fs/reiser4/plugin/compress/compress_mode.c renamed from fs/reiser4/plugin/compress/compress_mode.c.old +1 -1
@@ -25,7 +25,7 @@
 }
 
 /* generic turn on/off compression */
-int switch_compression(struct inode *inode)
+static int switch_compression(struct inode *inode)
 {
 	int result;
 
fs/reiser4/plugin/file/file.h renamed from fs/reiser4/plugin/file/file.h.old +0 -3
@@ -192,9 +192,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/cluster.h renamed from fs/reiser4/plugin/cluster.h.old +0 -3
@@ -245,8 +245,6 @@
 int flush_cluster_pages(reiser4_cluster_t *, jnode *, struct inode *);
 int deflate_cluster(reiser4_cluster_t *, struct inode *);
 void truncate_page_cluster(struct inode *inode, cloff_t start);
-void set_hint_cluster(struct inode *inode, hint_t * hint, unsigned long index,
-		      znode_lock_mode mode);
 void invalidate_hint_cluster(reiser4_cluster_t * clust);
 void put_hint_cluster(reiser4_cluster_t * clust, struct inode *inode,
 		      znode_lock_mode mode);
@@ -263,7 +261,6 @@
 int tfm_cluster_is_uptodate(tfm_cluster_t * tc);
 void tfm_cluster_set_uptodate(tfm_cluster_t * tc);
 void tfm_cluster_clr_uptodate(tfm_cluster_t * tc);
-unsigned long clust_by_coord(const coord_t * coord, struct inode *inode);
 
 /* move cluster handle to the target position
    specified by the page of index @pgidx
fs/reiser4/plugin/file/cryptcompress.c renamed from fs/reiser4/plugin/file/cryptcompress.c.old +43 -26

178 lines not on this page · raw message

fs/reiser4/plugin/file/funcs.h renamed from fs/reiser4/plugin/file/funcs.h.old +1 -1
@@ -21,7 +21,7 @@
 int equal_to_ldk(znode *, const reiser4_key *);
 #endif
 
-extern inline int cbk_errored(int cbk_result)
+static inline int cbk_errored(int cbk_result)
 {
 	return (cbk_result != CBK_COORD_NOTFOUND
 		&& cbk_result != CBK_COORD_FOUND);
fs/reiser4/plugin/object.h renamed from fs/reiser4/plugin/object.h.old +0 -3
@@ -34,8 +34,6 @@
 int readdir_common(struct file *, void *dirent, filldir_t);
 int release_dir_common(struct inode *, struct file *);
 int sync_common(struct file *, struct dentry *, int datasync);
-ssize_t sendfile_common(struct file *, loff_t *ppos, size_t count,
-			read_actor_t, void *target);
 
 /* common implementations of address space operations */
 int prepare_write_common(struct file *, struct page *, unsigned from,
@@ -105,7 +103,6 @@
 int do_prepare_write(struct file *, struct page *, unsigned from, unsigned to);
 
 /* merely useful functions */
-int locate_inode_sd(struct inode *, reiser4_key *, coord_t *, lock_handle *);
 int lookup_sd(struct inode *, znode_lock_mode, coord_t *, lock_handle *,
 	      const reiser4_key *, int silent);
 
fs/reiser4/plugin/file_ops.c renamed from fs/reiser4/plugin/file_ops.c.old +2 -0
@@ -64,6 +64,7 @@
    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)
@@ -78,6 +79,7 @@
 	reiser4_exit_context(ctx);
 	return result;
 }
+#endif  /*  0  */
 
 /* address space operations */
 
fs/reiser4/plugin/file_plugin_common.c renamed from fs/reiser4/plugin/file_plugin_common.c.old +1 -1
@@ -709,7 +709,7 @@
 	return result;
 }
 
-int
+static int
 locate_inode_sd(struct inode *inode,
 		reiser4_key * key, coord_t * coord, lock_handle * lh)
 {
fs/reiser4/plugin/item/ctail.c renamed from fs/reiser4/plugin/item/ctail.c.old +1 -1
@@ -68,7 +68,7 @@
 	return (int)cluster_shift_by_coord(coord) == (int)UCTAIL_SHIFT;
 }
 
-cloff_t clust_by_coord(const coord_t * coord, struct inode *inode)
+static cloff_t clust_by_coord(const coord_t * coord, struct inode *inode)
 {
 	int shift;
 
fs/reiser4/plugin/plugin_set.h renamed from fs/reiser4/plugin/plugin_set.h.old +0 -5
@@ -57,13 +57,8 @@
 extern int plugin_set_hash(plugin_set ** set, hash_plugin * plug);
 extern int plugin_set_fibration(plugin_set ** set, fibration_plugin * plug);
 extern int plugin_set_sd(plugin_set ** set, item_plugin * plug);
-extern int plugin_set_cipher(plugin_set ** set, cipher_plugin * plug);
-extern int plugin_set_digest(plugin_set ** set, digest_plugin * plug);
 extern int plugin_set_compression(plugin_set ** set, compression_plugin * plug);
-extern int plugin_set_compression_mode(plugin_set ** set,
-				       compression_mode_plugin * plug);
 extern int plugin_set_cluster(plugin_set ** set, cluster_plugin * plug);
-extern int plugin_set_regular_entry(plugin_set ** set, regular_plugin * plug);
 
 extern int init_plugin_set(void);
 extern void done_plugin_set(void);
fs/reiser4/plugin/plugin_set.c renamed from fs/reiser4/plugin/plugin_set.c.old +4 -4
@@ -320,12 +320,12 @@
     DEFINE_PLUGIN_SET(hash_plugin, hash)
     DEFINE_PLUGIN_SET(fibration_plugin, fibration)
     DEFINE_PLUGIN_SET(item_plugin, sd)
-    DEFINE_PLUGIN_SET(cipher_plugin, cipher)
-    DEFINE_PLUGIN_SET(digest_plugin, digest)
+    /* DEFINE_PLUGIN_SET(cipher_plugin, cipher) */
+    /* DEFINE_PLUGIN_SET(digest_plugin, digest) */
     DEFINE_PLUGIN_SET(compression_plugin, compression)
-    DEFINE_PLUGIN_SET(compression_mode_plugin, compression_mode)
+    /* DEFINE_PLUGIN_SET(compression_mode_plugin, compression_mode) */
     DEFINE_PLUGIN_SET(cluster_plugin, cluster)
-    DEFINE_PLUGIN_SET(regular_plugin, regular_entry)
+    /* DEFINE_PLUGIN_SET(regular_plugin, regular_entry) */
 
 
 /**
#1 lore raw
Quoted 7 lines · Adrian Bunk

This patch makes some needlessly global code static and #ifdef's some unused code away.

Did we lose this patch from our patch process, or is this more cleanups from you?

If we are losing patches donated to us, then I need to be a manager and go complain....

#2 lore raw
Quoted 6 lines · Hans Reiser
Quoted 4 lines · Adrian Bunk

This patch makes some needlessly global code static and #ifdef's some unused code away.

Quoted 6 lines
Quoted 3 lines

Did we lose this patch from our patch process, or is this more cleanups from you?
...

These are more cleanups.

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