Skip to contentSkip to conversation

drivers/dlm/: possible cleanups

PATCH New Adrian Bunk 1 participant 1 message Nov 7, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/dlm/: possible cleanups

This patch contains the following possible cleanups:
- every file should #include the headers containing the prototypes for it's global functions
- make needlessly global functions static
- #if 0 the following unused global functions:
- device.c: dlm_device_free_devices
- lock.c: dlm_remove_from_waiters
- lockspace.c: dlm_find_lockspace_name

Please review which of these changes do make sense.

---

This patch was already sent on:
- 4 Nov 2005

 drivers/dlm/ast.c          |    1 +
 drivers/dlm/device.c       |    7 ++++---
 drivers/dlm/dir.c          |    1 +
 drivers/dlm/lock.c         |    4 +++-
 drivers/dlm/lock.h         |    2 --
 drivers/dlm/lockspace.c    |    2 ++
 drivers/dlm/lockspace.h    |    1 -
 drivers/dlm/memory.c       |    1 +
 drivers/dlm/midcomms.c     |    1 +
 drivers/dlm/recover.c      |    1 +
 drivers/dlm/recoverd.c     |    1 +
 drivers/dlm/requestqueue.c |    1 +
 drivers/dlm/util.c         |    1 +
 13 files changed, 17 insertions(+), 7 deletions(-)
drivers/dlm/ast.c renamed from drivers/dlm/ast.c.old +1 -0
@@ -13,6 +13,7 @@
 
 #include "dlm_internal.h"
 #include "lock.h"
+#include "ast.h"
 
 #define WAKE_ASTS  0
 
drivers/dlm/dir.c renamed from drivers/dlm/dir.c.old +1 -0
@@ -21,6 +21,7 @@
 #include "recover.h"
 #include "util.h"
 #include "lock.h"
+#include "dir.h"
 
 
 static void put_free_de(struct dlm_ls *ls, struct dlm_direntry *de)
drivers/dlm/memory.c renamed from drivers/dlm/memory.c.old +1 -0
@@ -13,6 +13,7 @@
 
 #include "dlm_internal.h"
 #include "config.h"
+#include "memory.h"
 
 static kmem_cache_t *lkb_cache;
 
drivers/dlm/device.c renamed from drivers/dlm/device.c.old +4 -3
@@ -39,7 +39,6 @@
 #include <linux/dlm_device.h>
 
 #include "lvb_table.h"
-#include "device.h"
 
 static struct file_operations _dlm_fops;
 static const char *name_prefix="dlm";
@@ -1050,6 +1049,7 @@
 		return status;
 }
 
+#if 0
 /* Called when the cluster is shutdown uncleanly, all lockspaces
    have been summarily removed */
 void dlm_device_free_devices()
@@ -1069,6 +1069,7 @@
 	}
 	up(&user_ls_lock);
 }
+#endif  /*  0  */
 
 static struct file_operations _dlm_fops = {
       .open    = dlm_open,
@@ -1089,7 +1090,7 @@
 /*
  * Create control device
  */
-int __init dlm_device_init(void)
+static int __init dlm_device_init(void)
 {
 	int r;
 
@@ -1110,7 +1111,7 @@
 	return 0;
 }
 
-void __exit dlm_device_exit(void)
+static void __exit dlm_device_exit(void)
 {
 	misc_deregister(&ctl_device);
 }
drivers/dlm/lock.h renamed from drivers/dlm/lock.h.old +0 -2
@@ -13,7 +13,6 @@
 #ifndef __LOCK_DOT_H__
 #define __LOCK_DOT_H__
 
-void dlm_print_lkb(struct dlm_lkb *lkb);
 void dlm_print_rsb(struct dlm_rsb *r);
 int dlm_receive_message(struct dlm_header *hd, int nodeid, int recovery);
 int dlm_modes_compat(int mode1, int mode2);
@@ -22,7 +21,6 @@
 void dlm_put_rsb(struct dlm_rsb *r);
 void dlm_hold_rsb(struct dlm_rsb *r);
 int dlm_put_lkb(struct dlm_lkb *lkb);
-int dlm_remove_from_waiters(struct dlm_lkb *lkb);
 void dlm_scan_rsbs(struct dlm_ls *ls);
 
 int dlm_purge_locks(struct dlm_ls *ls);
drivers/dlm/lock.c renamed from drivers/dlm/lock.c.old +3 -1
@@ -152,7 +152,7 @@
         {0, 0, 0, 0, 0, 0, 0, 0}        /* PD */
 };
 
-void dlm_print_lkb(struct dlm_lkb *lkb)
+static void dlm_print_lkb(struct dlm_lkb *lkb)
 {
 	printk(KERN_ERR "lkb: nodeid %d id %x remid %x exflags %x flags %x\n"
 	       "     status %d rqmode %d grmode %d wait_type %d ast_type %d\n",
@@ -751,10 +751,12 @@
 	return error;
 }
 
+#if 0
 int dlm_remove_from_waiters(struct dlm_lkb *lkb)
 {
 	return remove_from_waiters(lkb);
 }
+#endif  /*  0  */
 
 static void dir_remove(struct dlm_rsb *r)
 {
drivers/dlm/lockspace.h renamed from drivers/dlm/lockspace.h.old +0 -1
@@ -18,7 +18,6 @@
 void dlm_lockspace_exit(void);
 struct dlm_ls *dlm_find_lockspace_global(uint32_t id);
 struct dlm_ls *dlm_find_lockspace_local(void *id);
-struct dlm_ls *dlm_find_lockspace_name(char *name, int namelen);
 void dlm_put_lockspace(struct dlm_ls *ls);
 
 #endif				/* __LOCKSPACE_DOT_H__ */
drivers/dlm/lockspace.c renamed from drivers/dlm/lockspace.c.old +2 -0
@@ -239,10 +239,12 @@
 	return ls;
 }
 
+#if 0
 struct dlm_ls *dlm_find_lockspace_name(char *name, int namelen)
 {
 	return find_lockspace_name(name, namelen);
 }
+#endif  /*  0  */
 
 struct dlm_ls *dlm_find_lockspace_global(uint32_t id)
 {
drivers/dlm/midcomms.c renamed from drivers/dlm/midcomms.c.old +1 -0
@@ -29,6 +29,7 @@
 #include "config.h"
 #include "rcom.h"
 #include "lock.h"
+#include "midcomms.h"
 
 
 static void copy_from_cb(void *dst, const void *base, unsigned offset,
drivers/dlm/recover.c renamed from drivers/dlm/recover.c.old +1 -0
@@ -21,6 +21,7 @@
 #include "lock.h"
 #include "lowcomms.h"
 #include "member.h"
+#include "recover.h"
 
 
 /*
drivers/dlm/recoverd.c renamed from drivers/dlm/recoverd.c.old +1 -0
@@ -20,6 +20,7 @@
 #include "lowcomms.h"
 #include "lock.h"
 #include "requestqueue.h"
+#include "recoverd.h"
 
 
 /* If the start for which we're re-enabling locking (seq) has been superseded
drivers/dlm/requestqueue.c renamed from drivers/dlm/requestqueue.c.old +1 -0
@@ -15,6 +15,7 @@
 #include "lock.h"
 #include "dir.h"
 #include "config.h"
+#include "requestqueue.h"
 
 struct rq_entry {
 	struct list_head list;
drivers/dlm/util.c renamed from drivers/dlm/util.c.old +1 -0
@@ -12,6 +12,7 @@
 
 #include "dlm_internal.h"
 #include "rcom.h"
+#include "util.h"
 
 static void header_out(struct dlm_header *hd)
 {