[Pvfs2-cvs] commit by bligon in pvfs2/src/kernel/linux-2.6:
devpvfs2-req.c pvfs2-mod.c
CVS commit program
cvs at parl.clemson.edu
Wed Feb 3 13:14:55 EST 2010
Update of /projects/cvsroot/pvfs2/src/kernel/linux-2.6
In directory parlweb1:/tmp/cvs-serv29601/src/kernel/linux-2.6
Modified Files:
devpvfs2-req.c pvfs2-mod.c
Log Message:
When the kernel module is loaded with a debug mask parameter, the code accepts the parameter
into a 32-bit variable, which is then cast into a 64-bit parameter. The insmod command
does not handle 64-bit input parameters, but the kernel gossip_debug_mask should be a 64-bit
value to acccomodate the existing gossip-debug functions.
Modified Files:
src/common/gossip/gossip.h src/io/dev/pint-dev.c
src/kernel/linux-2.6/devpvfs2-req.c
src/kernel/linux-2.6/pvfs2-mod.c
Index: devpvfs2-req.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/devpvfs2-req.c,v
diff -p -u -r1.77 -r1.78
--- devpvfs2-req.c 29 Jan 2010 21:41:36 -0000 1.77
+++ devpvfs2-req.c 3 Feb 2010 18:14:55 -0000 1.78
@@ -22,6 +22,9 @@ int PVFS_proc_mask_to_eventlog(uint64_t
extern char kernel_debug_string[PVFS2_MAX_DEBUG_STRING_LEN];
extern char client_debug_string[PVFS2_MAX_DEBUG_STRING_LEN];
+/*these variables are defined in pvfs2-mod.c*/
+extern unsigned int kernel_mask_set_mod_init;
+
/* this file implements the /dev/pvfs2-req device node */
static int open_access_count = 0;
@@ -780,6 +783,14 @@ static long dispatch_ioctl_command(unsig
if (mask_info.mask_type == KERNEL_MASK)
{
+ if ( (mask_info.mask_value == 0) && (kernel_mask_set_mod_init) )
+ {
+ /* the kernel debug mask was set when the kernel module was loaded;
+ * don't override it if the client-core was started without a value
+ * for PVFS2_KMODMASK.
+ */
+ return(0);
+ }
ret = PVFS_proc_kmod_mask_to_eventlog(mask_info.mask_value
,kernel_debug_string);
gossip_debug_mask = mask_info.mask_value;
Index: pvfs2-mod.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/pvfs2-mod.c,v
diff -p -u -r1.40 -r1.41
--- pvfs2-mod.c 29 Jan 2010 21:41:36 -0000 1.40
+++ pvfs2-mod.c 3 Feb 2010 18:14:55 -0000 1.41
@@ -17,6 +17,17 @@
#define DEBUG_HELP_STRING_SIZE 4096
+
+/* these functions are defined in pvfs2-utils.c */
+uint64_t PVFS_proc_debug_eventlog_to_mask(const char *);
+uint64_t PVFS_proc_kmod_eventlog_to_mask(const char *event_logging);
+int PVFS_proc_kmod_mask_to_eventlog(uint64_t mask, char *debug_string);
+int PVFS_proc_mask_to_eventlog(uint64_t mask, char *debug_string);
+
+/* external references */
+extern char kernel_debug_string[];
+
+/* prototypes */
static int hash_func(void *key, int table_size);
static int hash_compare(void *key, struct qhash_head *link);
@@ -26,16 +37,31 @@ static int hash_compare(void *key, struc
/* the size of the hash tables for ops in progress */
static int hash_table_size = 509;
-int gossip_debug_mask = 0;
+
+/* the insmod command only understands "unsigned long" and NOT "unsigned long long" as
+ * an input parameter. So, to accomodate both 32- and 64- bit machines, we will read
+ * the debug mask parameter as an unsigned long (4-bytes on a 32-bit machine and 8-bytes
+ * on a 64-bit machine) and then cast the "unsigned long" to an "unsigned long long"
+ * once we have the value in the kernel. In this way, the gossip_debug_mask can remain
+ * as a "uint64_t" and the kernel and client may continue to use the same gossip functions.
+ * NOTE: the kernel debug mask currently does not have more than 32 valid keywords, so
+ * only reading a 32-bit integer from the insmod command line is not a problem. However,
+ * the /proc/sys/pvfs2/kernel-debug functionality can accomodate up to 64 keywords, in
+ * the event that the kernel debug mask supports more than 32 keywords.
+*/
+uint32_t module_parm_debug_mask = 0;
+uint64_t gossip_debug_mask = 0;
+unsigned int kernel_mask_set_mod_init = false;
int op_timeout_secs = PVFS2_DEFAULT_OP_TIMEOUT_SECS;
int slot_timeout_secs = PVFS2_DEFAULT_SLOT_TIMEOUT_SECS;
uint32_t DEBUG_LINE = 50;
char debug_help_string[DEBUG_HELP_STRING_SIZE] = {0};
+
MODULE_LICENSE("GPL");
MODULE_AUTHOR("PVFS2 Development Team");
MODULE_DESCRIPTION("The Linux Kernel VFS interface to PVFS2");
-MODULE_PARM_DESC(debug, "debugging level (0 for none, 1 for verbose)");
+MODULE_PARM_DESC(debug, "debugging level (see pvfs2-debug.h for values)");
MODULE_PARM_DESC(op_timeout_secs, "Operation timeout in seconds");
MODULE_PARM_DESC(slot_timeout_secs, "Slot timeout in seconds");
MODULE_PARM_DESC(hash_table_size, "size of hash table for operations in progress");
@@ -48,7 +74,7 @@ MODULE_PARM_DESC(hash_table_size, "size
DECLARE_FSTYPE(pvfs2_fs_type, "pvfs2", pvfs2_get_sb, 0);
MODULE_PARM(hash_table_size, "i");
-MODULE_PARM(gossip_debug_mask, "i");
+MODULE_PARM(module_parm_debug_mask, "i");
MODULE_PARM(op_timeout_secs, "i");
MODULE_PARM(slot_timeout_secs, "i");
@@ -70,7 +96,7 @@ struct file_system_type pvfs2_fs_type =
};
module_param(hash_table_size, int, 0);
-module_param(gossip_debug_mask, int, 0);
+module_param(module_parm_debug_mask, uint, 0);
module_param(op_timeout_secs, int, 0);
module_param(slot_timeout_secs, int, 0);
@@ -107,7 +133,28 @@ static int __init pvfs2_init(void)
char kernel_title[] = "Kernel Debug Keywords:\n";
uint32_t i = 0;
- gossip_debug(GOSSIP_INIT_DEBUG, "pvfs2: pvfs2_init called with debug mask 0x%x\n", gossip_debug_mask);
+ /* convert input debug mask to a 64-bit unsigned integer */
+ gossip_debug_mask = (uint64_t)module_parm_debug_mask;
+
+ /*set the kernel's gossip debug string; invalid mask values will be ignored.*/
+ PVFS_proc_kmod_mask_to_eventlog(gossip_debug_mask,kernel_debug_string);
+
+ /* remove any invalid values from the mask */
+ gossip_debug_mask = PVFS_proc_kmod_eventlog_to_mask(kernel_debug_string);
+
+ /* if the mask has a non-zero value, then indicate that the mask was set when the kernel module
+ * was loaded. The pvfs2 dev ioctl command will look at this boolean to determine if the kernel's
+ * debug mask should be overwritten when the client-core is started.
+ */
+ if (gossip_debug_mask != 0)
+ {
+ kernel_mask_set_mod_init = true;
+ }
+
+ /*print information message to the system log*/
+ printk(KERN_INFO "pvfs2: pvfs2_init called with debug mask: \"%s\" (0x%08llx)\n"
+ ,kernel_debug_string,gossip_debug_mask);
+
/* load debug_help_string...this string is used during the /proc/sys/pvfs2/debug-help operation */
if (strlen(client_title) < DEBUG_LINE)
More information about the Pvfs2-cvs
mailing list