fs/jffs/: possible cleanups
PATCH 1/1 fs/jffs/: possible cleanups
The patch below contains the following possible cleanups:
- make some needlessly global code static
- #if 0 the following unused functions:
- intrep.c: jffs_print_file
- jffs_fm.c: jffs_print_node_ref
diffstat output:
fs/jffs/inode-v23.c | 10 +++---- fs/jffs/intrep.c | 60 ++++++++++++++++++++++++++++++------------- fs/jffs/intrep.h | 32 +--------------------- fs/jffs/jffs_fm.c | 12 ++++++-- fs/jffs/jffs_fm.h | 6 +--- include/linux/jffs.h | 1 6 files changed, 61 insertions(+), 60 deletions(-)
Signed-off-by Adrian Bunk <[email protected]>
fs/jffs/inode-v23.c renamed from fs/jffs/inode-v23.c.old +5 -5
@@ -334,7 +334,7 @@ }/* jffs_notify_change() */ -struct inode * +static struct inode *jffs_new_inode (const struct inode * dir,struct jffs_raw_inode *raw_inode,int * err) {
@@ -376,7 +376,7 @@ }/* Get statistics of the file system. */ -int +static int jffs_statfs (struct super_block *sb,struct kstatfs *buf) {struct jffs_control *c = (struct jffs_control *) sb->s_fs_info;
@@ -410,7 +410,7 @@/* Rename a file. */ -int +static int jffs_rename (struct inode *old_dir,struct dentry *old_dentry,struct inode *new_dir,struct dentry *new_dentry) {
@@ -1739,7 +1739,7 @@ } -void +static void jffs_delete_inode (struct inode *inode) {struct jffs_file *f;
@@ -1762,7 +1762,7 @@ } -void +static void jffs_write_super (struct super_block *sb) {struct jffs_control *c = (struct jffs_control *)sb->s_fs_info;
fs/jffs/intrep.h renamed from fs/jffs/intrep.h.old +2 -30
@@ -20,9 +20,6 @@struct jffs_node *jffs_alloc_node (void );void jffs_free_node (struct jffs_node *n);int jffs_get_node_inuse (void ); -long jffs_get_file_count (void ); - -__u32 jffs_checksum (const void *data,int size);void jffs_cleanup_control (struct jffs_control *c);int jffs_build_fs (struct super_block *sb);
@@ -36,15 +33,9 @@void jffs_free_node (struct jffs_node *node);int jffs_foreach_file (struct jffs_control *c,int (*func)(struct jffs_file *)); -int jffs_free_node_list (struct jffs_file *f); -int jffs_free_file (struct jffs_file *f);int jffs_possibly_delete_file (struct jffs_file *f); -int jffs_build_file (struct jffs_file *f); -int jffs_insert_file_into_hash (struct jffs_file *f);int jffs_insert_file_into_tree (struct jffs_file *f); -int jffs_unlink_file_from_hash (struct jffs_file *f);int jffs_unlink_file_from_tree (struct jffs_file *f); -int jffs_remove_redundant_nodes (struct jffs_file *f);int jffs_file_count (struct jffs_file *f); int jffs_write_node(struct jffs_control *c, struct jffs_node *node,
@@ -56,32 +47,13 @@/* Garbage collection stuff. */ int jffs_garbage_collect_thread (void *c);void jffs_garbage_collect_trigger (struct jffs_control *c); -int jffs_garbage_collect_now (struct jffs_control *c); - -/* Is there enough space on the flash? */ -static inline int JFFS_ENOUGH_SPACE (struct jffs_control *c,__u32 space) -{ -struct jffs_fmcontrol *fmc = c->fmc; - -while (1 ) { -if ((fmc->flash_size - (fmc->used_size + fmc->dirty_size)) - >= fmc->min_free_size + space) { -return 1 ; - } -if (fmc->dirty_size < fmc->sector_size) -return 0 ; - -if (jffs_garbage_collect_now (c)) { -D1 (printk ("JFFS_ENOUGH_SPACE: jffs_garbage_collect_now() failed.\n" )); -return 0 ; - } - } -}/* For debugging purposes. */ void jffs_print_node (struct jffs_node *n);void jffs_print_raw_inode (struct jffs_raw_inode *raw_inode); +#if 0 int jffs_print_file (struct jffs_file *f); +#endif /* 0 */ void jffs_print_hash_table (struct jffs_control *c);void jffs_print_tree (struct jffs_file *first_file,int indent);
include/linux/jffs.h renamed from include/linux/jffs.h.old +0 -1
@@ -208,7 +208,6 @@#define JFFS_MEMORY_DEBUG 0extern long no_jffs_node; -extern long no_jffs_file;#if defined(JFFS_MEMORY_DEBUG ) &&JFFS_MEMORY_DEBUG extern long no_jffs_control;extern long no_jffs_raw_inode;
fs/jffs/intrep.c renamed from fs/jffs/intrep.c.old +43 -17
174 lines not on this page · raw message
fs/jffs/jffs_fm.h renamed from fs/jffs/jffs_fm.h.old +2 -4
@@ -64,10 +64,6 @@ -void jffs_free_fm (struct jffs_fm *n); -struct jffs_fm *jffs_alloc_fm (void ); - -struct jffs_node_ref {struct jffs_node *node;
@@ -145,6 +141,8 @@void jffs_print_fmcontrol (struct jffs_fmcontrol *fmc);void jffs_print_fm (struct jffs_fm *fm); +#if 0 void jffs_print_node_ref (struct jffs_node_ref *ref); +#endif /* 0 */ #endif /* __LINUX_JFFS_FM_H__ */
fs/jffs/jffs_fm.c renamed from fs/jffs/jffs_fm.c.old +9 -3
@@ -25,6 +25,9 @@static int jffs_mark_obsolete (struct jffs_fmcontrol *fmc,__u32 fm_offset);#endif +static struct jffs_fm *jffs_alloc_fm (void ); +static void jffs_free_fm (struct jffs_fm *n); +extern kmem_cache_t *fm_cache;extern kmem_cache_t *node_cache;
@@ -602,7 +605,7 @@/* check if it's possible to erase the wanted range, and if not, return * the range that IS erasable, or a negative error code. */ -long +static long jffs_flash_erasable_size (struct mtd_info *mtd,__u32 offset,__u32 size) {u_long ssize;
@@ -700,7 +703,7 @@return (ret >=0 ? ret :0 ); } -struct jffs_fm *jffs_alloc_fm (void ) +static struct jffs_fm *jffs_alloc_fm (void ) {struct jffs_fm *fm;
@@ -710,7 +713,7 @@return fm; } -void jffs_free_fm (struct jffs_fm *n) +static void jffs_free_fm (struct jffs_fm *n) {kmem_cache_free (fm_cache,n);DJM (no_jffs_fm--);
@@ -778,6 +781,7 @@D (printk ("}\n" )); } +#if 0 void jffs_print_node_ref (struct jffs_node_ref *ref) {
@@ -787,3 +791,5 @@D (printk (" 0x%p, /* next */\n" , ref->next)); D(printk("}\n")); } +#endif /* 0 */ +