Skip to contentSkip to conversation

kill dead code and add some statics

PATCH New Christoph Hellwig 1 participant 1 message Jul 16, 2004 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kill dead code and add some statics

I ran Tridge's findstatic.pl and fixed everything it complained about.

super.c +2 -1
Index: src/super.c
===================================================================
@@ -168,6 +168,7 @@
 static int ocfs_read_params(void);
 static int ocfs_initialize_mem_lists (void);
 static void ocfs_free_mem_lists (void);
+static void ocfs_delete_osb (ocfs_super * osb);
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static int ocfs_statfs (struct super_block *sb, struct kstatfs *buf);
@@ -1900,7 +1901,7 @@
  * It will remove the osb from the global list and also free up all the
  * initialized resources and fileobject.
  */
-void ocfs_delete_osb (ocfs_super * osb)
+static void ocfs_delete_osb (ocfs_super * osb)
 {
 	int i;
 	LOG_ENTRY ();
super.h +0 -1
Index: src/super.h
===================================================================
@@ -29,7 +29,6 @@
 #ifndef OCFS2_SUPER_H
 #define OCFS2_SUPER_H
 
-void ocfs_delete_osb(ocfs_super *osb);
 int ocfs_dismount_volume(struct super_block *sb);
 int ocfs_publish_get_mount_state(ocfs_super *osb, int node_num);
 
dlm.c +9 -11
Index: src/dlm.c
===================================================================
@@ -61,14 +61,8 @@
 static int ocfs_wait_for_vote (ocfs_super * osb, __u64 lock_id, __u32 lock_type, __u32 flags, ocfs_node_map *vote_map, __u32 time_to_wait, __u64 lock_seq_num, ocfs_node_map *open_map);
 static int ocfs_reset_voting (ocfs_super * osb);
 static int ocfs_get_vote_on_disk (ocfs_super * osb, __u64 lock_id, __u32 lock_type, __u32 flags, ocfs_node_map * got_vote_map, ocfs_node_map * vote_map, __u64 lock_seq_num, ocfs_node_map * oin_open_map);
-int ocfs_disk_release_lock (ocfs_super * osb, __u64 lock_id, __u32 lock_type, __u32 flags, struct buffer_head *bh, struct inode *inode);
 
 
-void ocfs_set_publish_vote_map(ocfs_super *osb, ocfs_publish *publish, ocfs_node_map *vote_map)
-{
-	ocfs_node_map_set_to_disk(publish->vote_map, vote_map);
-}
-
 void ocfs_get_publish_vote_map(ocfs_super *osb, ocfs_publish *publish, ocfs_node_map *vote_map)
 {
 	ocfs_node_map_init(osb, vote_map);
@@ -168,7 +162,7 @@
 	pubsect->publ_seq_num = largestseqno;
 	pubsect->dirty = 1;
 	pubsect->vote = FLAG_VOTE_NODE;
-	ocfs_set_publish_vote_map(osb, pubsect, vote_map);
+	ocfs_node_map_set_to_disk(pubsect->vote_map, vote_map);
 	pubsect->vote_type = flags;
 	pubsect->lock_id = lock_id;
 
@@ -535,7 +529,7 @@
 	pubsect->lock_id = 0;
 	/* clear vote map */
 	ocfs_node_map_init(osb, &vote_map);
-	ocfs_set_publish_vote_map(osb, pubsect, &vote_map);
+	ocfs_node_map_set_to_disk(pubsect->vote_map, &vote_map);
 
 	/* Write it back */
 	status = ocfs_write_bh (osb, bh, 0, NULL);
@@ -786,8 +780,10 @@
 	num_paths
 };
 
-const char *lock_path_strs[] = {"invalid_path", "fast_path", "become_master",
-				"get_x", "wait_for_release", "master_request" };
+static const char *lock_path_strs[] = {
+	"invalid_path", "fast_path", "become_master",
+	"get_x", "wait_for_release", "master_request"
+};
 
 static inline const char * lock_path_str(int lock_path);
 static inline const char * lock_path_str(int lock_path)
@@ -1027,7 +1023,9 @@
  * ocfs_disk_release_lock()
  * inode is definitely non NULL
  */
-int ocfs_disk_release_lock (ocfs_super * osb, __u64 lock_id, __u32 lock_type, __u32 flags, struct buffer_head *bh, struct inode *inode)
+static int ocfs_disk_release_lock(ocfs_super * osb, __u64 lock_id,
+		__u32 lock_type, __u32 flags, struct buffer_head *bh,
+		struct inode *inode)
 {
 	ocfs_node_map votemap;
 	int status = 0, vote_status = 0;
util.c +0 -101

116 lines not on this page · raw message

vote.c +3 -15
Index: src/vote.c
===================================================================
@@ -62,6 +62,7 @@
 static void ocfs_init_dlm_msg (ocfs_super * osb, ocfs_dlm_msg * dlm_msg, __u32 msg_len, __u32 type);
 
 static int ocfs_send_bcast (ocfs_super * osb, ocfs_node_map *votemap, ocfs_dlm_msg * dlm_msg);
+static int ocfs_node_map_stringify(ocfs_node_map *map, char **str);
 
 static spinlock_t vote_obj_lock = SPIN_LOCK_UNLOCKED;
 
@@ -74,7 +75,7 @@
 	spin_unlock(&vote_obj_lock);
 }
 
-void ocfs_get_vote_obj (ocfs_vote_obj *obj)
+static void ocfs_get_vote_obj(ocfs_vote_obj *obj)
 {
 	spin_lock(&vote_obj_lock);
 	atomic_inc(&obj->refcount);
@@ -1019,19 +1020,6 @@
 	}
 }
 
-// set all the bits in "target" which are set in "mask"
-void ocfs_node_map_set_bits(ocfs_node_map *target, ocfs_node_map *mask)
-{
-	int bit, prev=0;
-	while (1) {
-		bit = find_next_bit (mask->map, mask->num_nodes, prev);
-		if (bit > mask->num_nodes)
-			break;
-		ocfs_node_map_set_bit(target, bit);
-		prev = bit+1;
-	}
-}
-
 int ocfs_node_map_test_bit(ocfs_node_map *map, int bit)
 {
 	if (bit >= map->num_nodes) {
@@ -1041,7 +1029,7 @@
 	return test_bit(bit, map->map);
 }
 
-int ocfs_node_map_stringify(ocfs_node_map *map, char **str)
+static int ocfs_node_map_stringify(ocfs_node_map *map, char **str)
 {
 	int i, n;
 	char *s;
dlm.h +0 -2
Index: src/dlm.h
===================================================================
@@ -49,8 +49,6 @@
 int ocfs_wait_for_lock_release(ocfs_super *osb, __u64 offset,
 			       __u32 time_to_wait, __u32 lock_type,
 			       struct inode *inode);
-void ocfs_set_publish_vote_map(ocfs_super *osb, ocfs_publish *publish,
-			       ocfs_node_map *vote_map);
 void ocfs_get_publish_vote_map(ocfs_super *osb, ocfs_publish *publish,
 			       ocfs_node_map *vote_map);
 void ocfs_set_disk_lock_open_map(ocfs_super *osb, ocfs2_disk_lock *lock,
vote.h +0 -3
Index: src/vote.h
===================================================================
@@ -29,7 +29,6 @@
 #ifndef OCFS2_VOTE_H
 #define OCFS2_VOTE_H
 
-void ocfs_get_vote_obj(ocfs_vote_obj *obj);
 int ocfs_init_udp_sock(struct socket **send_sock,
 		       struct socket **recv_sock);
 int ocfs_lookup_obj_for_proc(ocfs_vote_obj *obj,
@@ -58,9 +57,7 @@
 // clear all the bits in "target" which are set in "mask"
 void ocfs_node_map_clear_bits(ocfs_node_map *target, ocfs_node_map *mask);
 // set all the bits in "target" which are set in "mask"
-void ocfs_node_map_set_bits(ocfs_node_map *target, ocfs_node_map *mask);
 int ocfs_node_map_test_bit(ocfs_node_map *map, int bit);
-int ocfs_node_map_stringify(ocfs_node_map *map, char **str);
 int ocfs_node_map_is_empty(ocfs_node_map *map);
 int ocfs_node_map_is_equal(ocfs_node_map *map1, ocfs_node_map *map2);
 void ocfs_node_map_and(ocfs_node_map *target, ocfs_node_map *mask);
util.h +0 -13
Index: src/util.h
===================================================================
@@ -29,25 +29,12 @@
 #ifndef OCFS2_UTIL_H
 #define OCFS2_UTIL_H
 
-int ocfs_compare_qstr(struct qstr *s1, struct qstr *s2);
 void ocfs_clear_timeout(ocfs_timeout *to);
 void ocfs_daemonize(char *name, int len);
 void ocfs_init_timeout(ocfs_timeout *to);
 void ocfs_set_timeout(ocfs_timeout *to, __u32 timeout);
-void ocfs_show_stack(unsigned long *esp);
 void ocfs_show_trace(unsigned long *stack);
 int ocfs_sleep(__u32 ms);
 void ocfs_truncate_inode_pages(struct inode *inode, loff_t off);
-int __ocfs_wait_atomic_eq(wait_queue_head_t *wq, atomic_t *var, int val, int ms);
 
-/* exits when var == val, or on timeout */
-static inline int ocfs_wait_atomic_eq(wait_queue_head_t *wq, atomic_t *var, int val, int timeout)
-{
-	int ret = 0;
-	if (atomic_read(var) != val)
-		ret = __ocfs_wait_atomic_eq(wq, var, val, timeout);
-	return ret;
-}
-
-
 #endif /* OCFS2_UTIL_H */
inode.c +3 -1
Index: src/inode.c
===================================================================
@@ -1300,7 +1300,9 @@
  * called like this: dio->get_blocks(dio->inode, fs_startblk,
  * 					fs_count, map_bh, dio->rw == WRITE);
  */
-int ocfs_direct_IO_get_blocks(struct inode *inode, sector_t iblock, unsigned long max_blocks, struct buffer_head *bh_result, int create)
+static int ocfs_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
+		unsigned long max_blocks, struct buffer_head *bh_result,
+		int create)
 {
 	int ret = -1;
 	int status;
nm.c +1 -3
Index: src/nm.c
===================================================================
@@ -79,8 +79,6 @@
 static void ocfs_clear_inode_for_extend(ocfs_super *osb, struct inode *inode,
 					__u32 node_num);
 
-void ocfs_process_vote_worker(void *val);
-
 #ifdef VERBOSE_PROCESS_VOTE
 static const char *process_vote_strings[] = {
 	"INVALID_REQUEST",      // reply with a NO vote
@@ -170,7 +168,7 @@
 	struct work_struct ipc_wq;
 };
 
-void ocfs_process_vote_worker(void *val)
+static void ocfs_process_vote_worker(void *val)
 {
 	struct ocfs_sched_vote *sv = val;
 	ocfs_super *osb = NULL;

if (is_locked || vote_type == CHANGE_MASTER) {