diff options
author | Martin Brandenburg <martin@omnibond.com> | 2016-08-15 11:38:36 -0400 |
---|---|---|
committer | Martin Brandenburg <martin@omnibond.com> | 2016-08-15 11:38:36 -0400 |
commit | 44f4641073f132429e1e9a53412600206e8f7d06 (patch) | |
tree | 65ba85e9b795a2d1610bce311b3bd3aff44b2075 | |
parent | a21aae3bb15a1d08040bdcf5a73504c0da9f5080 (diff) |
orangefs: clean up debugfs globals
Mostly this is moving code into orangefs-debugfs.c so that globals turn
into static globals.
Then gossip_debug_mask is renamed orangefs_gossip_debug_mask but keeps
global visibility, so it can be used from a macro.
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
-rw-r--r-- | fs/orangefs/devorangefs-req.c | 132 | ||||
-rw-r--r-- | fs/orangefs/orangefs-debugfs.c | 761 | ||||
-rw-r--r-- | fs/orangefs/orangefs-debugfs.h | 8 | ||||
-rw-r--r-- | fs/orangefs/orangefs-kernel.h | 33 | ||||
-rw-r--r-- | fs/orangefs/orangefs-mod.c | 53 | ||||
-rw-r--r-- | fs/orangefs/orangefs-utils.c | 398 | ||||
-rw-r--r-- | fs/orangefs/protocol.h | 25 |
7 files changed, 705 insertions, 705 deletions
diff --git a/fs/orangefs/devorangefs-req.c b/fs/orangefs/devorangefs-req.c index a287a66d94e3..6779cb7b747e 100644 --- a/fs/orangefs/devorangefs-req.c +++ b/fs/orangefs/devorangefs-req.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include "orangefs-kernel.h" | 11 | #include "orangefs-kernel.h" |
12 | #include "orangefs-dev-proto.h" | 12 | #include "orangefs-dev-proto.h" |
13 | #include "orangefs-bufmap.h" | 13 | #include "orangefs-bufmap.h" |
14 | #include "orangefs-debugfs.h" | ||
14 | 15 | ||
15 | #include <linux/debugfs.h> | 16 | #include <linux/debugfs.h> |
16 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
@@ -576,8 +577,6 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg) | |||
576 | static __s32 max_down_size = MAX_DEV_REQ_DOWNSIZE; | 577 | static __s32 max_down_size = MAX_DEV_REQ_DOWNSIZE; |
577 | struct ORANGEFS_dev_map_desc user_desc; | 578 | struct ORANGEFS_dev_map_desc user_desc; |
578 | int ret = 0; | 579 | int ret = 0; |
579 | struct dev_mask_info_s mask_info = { 0 }; | ||
580 | struct dev_mask2_info_s mask2_info = { 0, 0 }; | ||
581 | int upstream_kmod = 1; | 580 | int upstream_kmod = 1; |
582 | struct orangefs_sb_info_s *orangefs_sb; | 581 | struct orangefs_sb_info_s *orangefs_sb; |
583 | 582 | ||
@@ -668,134 +667,11 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg) | |||
668 | return ret; | 667 | return ret; |
669 | 668 | ||
670 | case ORANGEFS_DEV_CLIENT_MASK: | 669 | case ORANGEFS_DEV_CLIENT_MASK: |
671 | ret = copy_from_user(&mask2_info, | 670 | return orangefs_debugfs_new_client_mask((void __user *)arg); |
672 | (void __user *)arg, | ||
673 | sizeof(struct dev_mask2_info_s)); | ||
674 | |||
675 | if (ret != 0) | ||
676 | return -EIO; | ||
677 | |||
678 | client_debug_mask.mask1 = mask2_info.mask1_value; | ||
679 | client_debug_mask.mask2 = mask2_info.mask2_value; | ||
680 | |||
681 | pr_info("%s: client debug mask has been been received " | ||
682 | ":%llx: :%llx:\n", | ||
683 | __func__, | ||
684 | (unsigned long long)client_debug_mask.mask1, | ||
685 | (unsigned long long)client_debug_mask.mask2); | ||
686 | |||
687 | return ret; | ||
688 | |||
689 | case ORANGEFS_DEV_CLIENT_STRING: | 671 | case ORANGEFS_DEV_CLIENT_STRING: |
690 | ret = copy_from_user(&client_debug_array_string, | 672 | return orangefs_debugfs_new_client_string((void __user *)arg); |
691 | (void __user *)arg, | ||
692 | ORANGEFS_MAX_DEBUG_STRING_LEN); | ||
693 | /* | ||
694 | * The real client-core makes an effort to ensure | ||
695 | * that actual strings that aren't too long to fit in | ||
696 | * this buffer is what we get here. We're going to use | ||
697 | * string functions on the stuff we got, so we'll make | ||
698 | * this extra effort to try and keep from | ||
699 | * flowing out of this buffer when we use the string | ||
700 | * functions, even if somehow the stuff we end up | ||
701 | * with here is garbage. | ||
702 | */ | ||
703 | client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN - 1] = | ||
704 | '\0'; | ||
705 | |||
706 | if (ret != 0) { | ||
707 | pr_info("%s: CLIENT_STRING: copy_from_user failed\n", | ||
708 | __func__); | ||
709 | return -EIO; | ||
710 | } | ||
711 | |||
712 | pr_info("%s: client debug array string has been received.\n", | ||
713 | __func__); | ||
714 | |||
715 | if (!help_string_initialized) { | ||
716 | |||
717 | /* Free the "we don't know yet" default string... */ | ||
718 | kfree(debug_help_string); | ||
719 | |||
720 | /* build a proper debug help string */ | ||
721 | if (orangefs_prepare_debugfs_help_string(0)) { | ||
722 | gossip_err("%s: no debug help string \n", | ||
723 | __func__); | ||
724 | return -EIO; | ||
725 | } | ||
726 | |||
727 | /* Replace the boilerplate boot-time debug-help file. */ | ||
728 | debugfs_remove(help_file_dentry); | ||
729 | |||
730 | help_file_dentry = | ||
731 | debugfs_create_file( | ||
732 | ORANGEFS_KMOD_DEBUG_HELP_FILE, | ||
733 | 0444, | ||
734 | debug_dir, | ||
735 | debug_help_string, | ||
736 | &debug_help_fops); | ||
737 | |||
738 | if (!help_file_dentry) { | ||
739 | gossip_err("%s: debugfs_create_file failed for" | ||
740 | " :%s:!\n", | ||
741 | __func__, | ||
742 | ORANGEFS_KMOD_DEBUG_HELP_FILE); | ||
743 | return -EIO; | ||
744 | } | ||
745 | } | ||
746 | |||
747 | debug_mask_to_string(&client_debug_mask, 1); | ||
748 | |||
749 | debugfs_remove(client_debug_dentry); | ||
750 | |||
751 | orangefs_client_debug_init(); | ||
752 | |||
753 | help_string_initialized++; | ||
754 | |||
755 | return ret; | ||
756 | |||
757 | case ORANGEFS_DEV_DEBUG: | 673 | case ORANGEFS_DEV_DEBUG: |
758 | ret = copy_from_user(&mask_info, | 674 | return orangefs_debugfs_new_debug((void __user *)arg); |
759 | (void __user *)arg, | ||
760 | sizeof(mask_info)); | ||
761 | |||
762 | if (ret != 0) | ||
763 | return -EIO; | ||
764 | |||
765 | if (mask_info.mask_type == KERNEL_MASK) { | ||
766 | if ((mask_info.mask_value == 0) | ||
767 | && (kernel_mask_set_mod_init)) { | ||
768 | /* | ||
769 | * the kernel debug mask was set when the | ||
770 | * kernel module was loaded; don't override | ||
771 | * it if the client-core was started without | ||
772 | * a value for ORANGEFS_KMODMASK. | ||
773 | */ | ||
774 | return 0; | ||
775 | } | ||
776 | debug_mask_to_string(&mask_info.mask_value, | ||
777 | mask_info.mask_type); | ||
778 | gossip_debug_mask = mask_info.mask_value; | ||
779 | pr_info("%s: kernel debug mask has been modified to " | ||
780 | ":%s: :%llx:\n", | ||
781 | __func__, | ||
782 | kernel_debug_string, | ||
783 | (unsigned long long)gossip_debug_mask); | ||
784 | } else if (mask_info.mask_type == CLIENT_MASK) { | ||
785 | debug_mask_to_string(&mask_info.mask_value, | ||
786 | mask_info.mask_type); | ||
787 | pr_info("%s: client debug mask has been modified to" | ||
788 | ":%s: :%llx:\n", | ||
789 | __func__, | ||
790 | client_debug_string, | ||
791 | llu(mask_info.mask_value)); | ||
792 | } else { | ||
793 | gossip_lerr("Invalid mask type....\n"); | ||
794 | return -EINVAL; | ||
795 | } | ||
796 | |||
797 | return ret; | ||
798 | |||
799 | default: | 675 | default: |
800 | return -ENOIOCTLCMD; | 676 | return -ENOIOCTLCMD; |
801 | } | 677 | } |
diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c index 1714a737d556..9b24107c82a8 100644 --- a/fs/orangefs/orangefs-debugfs.c +++ b/fs/orangefs/orangefs-debugfs.c | |||
@@ -43,36 +43,35 @@ | |||
43 | #include "protocol.h" | 43 | #include "protocol.h" |
44 | #include "orangefs-kernel.h" | 44 | #include "orangefs-kernel.h" |
45 | 45 | ||
46 | static int orangefs_debug_disabled = 1; | 46 | #define DEBUG_HELP_STRING_SIZE 4096 |
47 | 47 | #define HELP_STRING_UNINITIALIZED \ | |
48 | static int orangefs_debug_help_open(struct inode *, struct file *); | 48 | "Client Debug Keywords are unknown until the first time\n" \ |
49 | "the client is started after boot.\n" | ||
50 | #define ORANGEFS_KMOD_DEBUG_HELP_FILE "debug-help" | ||
51 | #define ORANGEFS_KMOD_DEBUG_FILE "kernel-debug" | ||
52 | #define ORANGEFS_CLIENT_DEBUG_FILE "client-debug" | ||
53 | #define ORANGEFS_VERBOSE "verbose" | ||
54 | #define ORANGEFS_ALL "all" | ||
49 | 55 | ||
50 | const struct file_operations debug_help_fops = { | 56 | /* |
51 | .open = orangefs_debug_help_open, | 57 | * An array of client_debug_mask will be built to hold debug keyword/mask |
52 | .read = seq_read, | 58 | * values fetched from userspace. |
53 | .release = seq_release, | 59 | */ |
54 | .llseek = seq_lseek, | 60 | struct client_debug_mask { |
61 | char *keyword; | ||
62 | __u64 mask1; | ||
63 | __u64 mask2; | ||
55 | }; | 64 | }; |
56 | 65 | ||
66 | static int orangefs_kernel_debug_init(void); | ||
67 | |||
68 | static int orangefs_debug_help_open(struct inode *, struct file *); | ||
57 | static void *help_start(struct seq_file *, loff_t *); | 69 | static void *help_start(struct seq_file *, loff_t *); |
58 | static void *help_next(struct seq_file *, void *, loff_t *); | 70 | static void *help_next(struct seq_file *, void *, loff_t *); |
59 | static void help_stop(struct seq_file *, void *); | 71 | static void help_stop(struct seq_file *, void *); |
60 | static int help_show(struct seq_file *, void *); | 72 | static int help_show(struct seq_file *, void *); |
61 | 73 | ||
62 | static const struct seq_operations help_debug_ops = { | 74 | static int orangefs_debug_open(struct inode *, struct file *); |
63 | .start = help_start, | ||
64 | .next = help_next, | ||
65 | .stop = help_stop, | ||
66 | .show = help_show, | ||
67 | }; | ||
68 | |||
69 | /* | ||
70 | * Used to protect data in ORANGEFS_KMOD_DEBUG_FILE and | ||
71 | * ORANGEFS_KMOD_DEBUG_FILE. | ||
72 | */ | ||
73 | static DEFINE_MUTEX(orangefs_debug_lock); | ||
74 | |||
75 | int orangefs_debug_open(struct inode *, struct file *); | ||
76 | 75 | ||
77 | static ssize_t orangefs_debug_read(struct file *, | 76 | static ssize_t orangefs_debug_read(struct file *, |
78 | char __user *, | 77 | char __user *, |
@@ -84,6 +83,43 @@ static ssize_t orangefs_debug_write(struct file *, | |||
84 | size_t, | 83 | size_t, |
85 | loff_t *); | 84 | loff_t *); |
86 | 85 | ||
86 | static int orangefs_prepare_cdm_array(char *); | ||
87 | static void debug_mask_to_string(void *, int); | ||
88 | static void do_k_string(void *, int); | ||
89 | static void do_c_string(void *, int); | ||
90 | static int keyword_is_amalgam(char *); | ||
91 | static int check_amalgam_keyword(void *, int); | ||
92 | static void debug_string_to_mask(char *, void *, int); | ||
93 | static void do_c_mask(int, char *, struct client_debug_mask **); | ||
94 | static void do_k_mask(int, char *, __u64 **); | ||
95 | |||
96 | static char kernel_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN] = "none"; | ||
97 | static char *debug_help_string; | ||
98 | static char client_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN]; | ||
99 | static char client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN]; | ||
100 | |||
101 | static struct dentry *help_file_dentry; | ||
102 | static struct dentry *client_debug_dentry; | ||
103 | static struct dentry *debug_dir; | ||
104 | |||
105 | static unsigned int kernel_mask_set_mod_init; | ||
106 | static int orangefs_debug_disabled = 1; | ||
107 | static int help_string_initialized; | ||
108 | |||
109 | static const struct seq_operations help_debug_ops = { | ||
110 | .start = help_start, | ||
111 | .next = help_next, | ||
112 | .stop = help_stop, | ||
113 | .show = help_show, | ||
114 | }; | ||
115 | |||
116 | const struct file_operations debug_help_fops = { | ||
117 | .open = orangefs_debug_help_open, | ||
118 | .read = seq_read, | ||
119 | .release = seq_release, | ||
120 | .llseek = seq_lseek, | ||
121 | }; | ||
122 | |||
87 | static const struct file_operations kernel_debug_fops = { | 123 | static const struct file_operations kernel_debug_fops = { |
88 | .open = orangefs_debug_open, | 124 | .open = orangefs_debug_open, |
89 | .read = orangefs_debug_read, | 125 | .read = orangefs_debug_read, |
@@ -91,15 +127,55 @@ static const struct file_operations kernel_debug_fops = { | |||
91 | .llseek = generic_file_llseek, | 127 | .llseek = generic_file_llseek, |
92 | }; | 128 | }; |
93 | 129 | ||
130 | static int client_all_index; | ||
131 | static int client_verbose_index; | ||
132 | |||
133 | static struct client_debug_mask *cdm_array; | ||
134 | static int cdm_element_count; | ||
135 | |||
136 | static struct client_debug_mask client_debug_mask; | ||
137 | |||
138 | /* | ||
139 | * Used to protect data in ORANGEFS_KMOD_DEBUG_FILE and | ||
140 | * ORANGEFS_KMOD_DEBUG_FILE. | ||
141 | */ | ||
142 | static DEFINE_MUTEX(orangefs_debug_lock); | ||
143 | |||
94 | /* | 144 | /* |
95 | * initialize kmod debug operations, create orangefs debugfs dir and | 145 | * initialize kmod debug operations, create orangefs debugfs dir and |
96 | * ORANGEFS_KMOD_DEBUG_HELP_FILE. | 146 | * ORANGEFS_KMOD_DEBUG_HELP_FILE. |
97 | */ | 147 | */ |
98 | int orangefs_debugfs_init(void) | 148 | int orangefs_debugfs_init(int debug_mask) |
99 | { | 149 | { |
100 | |||
101 | int rc = -ENOMEM; | 150 | int rc = -ENOMEM; |
102 | 151 | ||
152 | /* convert input debug mask to a 64-bit unsigned integer */ | ||
153 | orangefs_gossip_debug_mask = (unsigned long long)debug_mask; | ||
154 | |||
155 | /* | ||
156 | * set the kernel's gossip debug string; invalid mask values will | ||
157 | * be ignored. | ||
158 | */ | ||
159 | debug_mask_to_string(&orangefs_gossip_debug_mask, 0); | ||
160 | |||
161 | /* remove any invalid values from the mask */ | ||
162 | debug_string_to_mask(kernel_debug_string, &orangefs_gossip_debug_mask, | ||
163 | 0); | ||
164 | |||
165 | /* | ||
166 | * if the mask has a non-zero value, then indicate that the mask | ||
167 | * was set when the kernel module was loaded. The orangefs dev ioctl | ||
168 | * command will look at this boolean to determine if the kernel's | ||
169 | * debug mask should be overwritten when the client-core is started. | ||
170 | */ | ||
171 | if (orangefs_gossip_debug_mask != 0) | ||
172 | kernel_mask_set_mod_init = true; | ||
173 | |||
174 | pr_info("%s: called with debug mask: :%s: :%llx:\n", | ||
175 | __func__, | ||
176 | kernel_debug_string, | ||
177 | (unsigned long long)orangefs_gossip_debug_mask); | ||
178 | |||
103 | debug_dir = debugfs_create_dir("orangefs", NULL); | 179 | debug_dir = debugfs_create_dir("orangefs", NULL); |
104 | if (!debug_dir) { | 180 | if (!debug_dir) { |
105 | pr_info("%s: debugfs_create_dir failed.\n", __func__); | 181 | pr_info("%s: debugfs_create_dir failed.\n", __func__); |
@@ -117,13 +193,58 @@ int orangefs_debugfs_init(void) | |||
117 | } | 193 | } |
118 | 194 | ||
119 | orangefs_debug_disabled = 0; | 195 | orangefs_debug_disabled = 0; |
196 | |||
197 | rc = orangefs_kernel_debug_init(); | ||
198 | |||
199 | out: | ||
200 | |||
201 | return rc; | ||
202 | } | ||
203 | |||
204 | /* | ||
205 | * initialize the kernel-debug file. | ||
206 | */ | ||
207 | static int orangefs_kernel_debug_init(void) | ||
208 | { | ||
209 | int rc = -ENOMEM; | ||
210 | struct dentry *ret; | ||
211 | char *k_buffer = NULL; | ||
212 | |||
213 | gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: start\n", __func__); | ||
214 | |||
215 | k_buffer = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL); | ||
216 | if (!k_buffer) | ||
217 | goto out; | ||
218 | |||
219 | if (strlen(kernel_debug_string) + 1 < ORANGEFS_MAX_DEBUG_STRING_LEN) { | ||
220 | strcpy(k_buffer, kernel_debug_string); | ||
221 | strcat(k_buffer, "\n"); | ||
222 | } else { | ||
223 | strcpy(k_buffer, "none\n"); | ||
224 | pr_info("%s: overflow 1!\n", __func__); | ||
225 | } | ||
226 | |||
227 | ret = debugfs_create_file(ORANGEFS_KMOD_DEBUG_FILE, | ||
228 | 0444, | ||
229 | debug_dir, | ||
230 | k_buffer, | ||
231 | &kernel_debug_fops); | ||
232 | if (!ret) { | ||
233 | pr_info("%s: failed to create %s.\n", | ||
234 | __func__, | ||
235 | ORANGEFS_KMOD_DEBUG_FILE); | ||
236 | goto out; | ||
237 | } | ||
238 | |||
120 | rc = 0; | 239 | rc = 0; |
121 | 240 | ||
122 | out: | 241 | out: |
123 | 242 | ||
243 | gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: rc:%d:\n", __func__, rc); | ||
124 | return rc; | 244 | return rc; |
125 | } | 245 | } |
126 | 246 | ||
247 | |||
127 | void orangefs_debugfs_cleanup(void) | 248 | void orangefs_debugfs_cleanup(void) |
128 | { | 249 | { |
129 | debugfs_remove_recursive(debug_dir); | 250 | debugfs_remove_recursive(debug_dir); |
@@ -196,49 +317,6 @@ static int help_show(struct seq_file *m, void *v) | |||
196 | } | 317 | } |
197 | 318 | ||
198 | /* | 319 | /* |
199 | * initialize the kernel-debug file. | ||
200 | */ | ||
201 | int orangefs_kernel_debug_init(void) | ||
202 | { | ||
203 | int rc = -ENOMEM; | ||
204 | struct dentry *ret; | ||
205 | char *k_buffer = NULL; | ||
206 | |||
207 | gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: start\n", __func__); | ||
208 | |||
209 | k_buffer = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL); | ||
210 | if (!k_buffer) | ||
211 | goto out; | ||
212 | |||
213 | if (strlen(kernel_debug_string) + 1 < ORANGEFS_MAX_DEBUG_STRING_LEN) { | ||
214 | strcpy(k_buffer, kernel_debug_string); | ||
215 | strcat(k_buffer, "\n"); | ||
216 | } else { | ||
217 | strcpy(k_buffer, "none\n"); | ||
218 | pr_info("%s: overflow 1!\n", __func__); | ||
219 | } | ||
220 | |||
221 | ret = debugfs_create_file(ORANGEFS_KMOD_DEBUG_FILE, | ||
222 | 0444, | ||
223 | debug_dir, | ||
224 | k_buffer, | ||
225 | &kernel_debug_fops); | ||
226 | if (!ret) { | ||
227 | pr_info("%s: failed to create %s.\n", | ||
228 | __func__, | ||
229 | ORANGEFS_KMOD_DEBUG_FILE); | ||
230 | goto out; | ||
231 | } | ||
232 | |||
233 | rc = 0; | ||
234 | |||
235 | out: | ||
236 | |||
237 | gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: rc:%d:\n", __func__, rc); | ||
238 | return rc; | ||
239 | } | ||
240 | |||
241 | /* | ||
242 | * initialize the client-debug file. | 320 | * initialize the client-debug file. |
243 | */ | 321 | */ |
244 | int orangefs_client_debug_init(void) | 322 | int orangefs_client_debug_init(void) |
@@ -282,7 +360,7 @@ out: | |||
282 | } | 360 | } |
283 | 361 | ||
284 | /* open ORANGEFS_KMOD_DEBUG_FILE or ORANGEFS_CLIENT_DEBUG_FILE.*/ | 362 | /* open ORANGEFS_KMOD_DEBUG_FILE or ORANGEFS_CLIENT_DEBUG_FILE.*/ |
285 | int orangefs_debug_open(struct inode *inode, struct file *file) | 363 | static int orangefs_debug_open(struct inode *inode, struct file *file) |
286 | { | 364 | { |
287 | int rc = -ENODEV; | 365 | int rc = -ENODEV; |
288 | 366 | ||
@@ -384,8 +462,8 @@ static ssize_t orangefs_debug_write(struct file *file, | |||
384 | */ | 462 | */ |
385 | if (!strcmp(file->f_path.dentry->d_name.name, | 463 | if (!strcmp(file->f_path.dentry->d_name.name, |
386 | ORANGEFS_KMOD_DEBUG_FILE)) { | 464 | ORANGEFS_KMOD_DEBUG_FILE)) { |
387 | debug_string_to_mask(buf, &gossip_debug_mask, 0); | 465 | debug_string_to_mask(buf, &orangefs_gossip_debug_mask, 0); |
388 | debug_mask_to_string(&gossip_debug_mask, 0); | 466 | debug_mask_to_string(&orangefs_gossip_debug_mask, 0); |
389 | debug_string = kernel_debug_string; | 467 | debug_string = kernel_debug_string; |
390 | gossip_debug(GOSSIP_DEBUGFS_DEBUG, | 468 | gossip_debug(GOSSIP_DEBUGFS_DEBUG, |
391 | "New kernel debug string is %s\n", | 469 | "New kernel debug string is %s\n", |
@@ -452,3 +530,546 @@ out: | |||
452 | kfree(buf); | 530 | kfree(buf); |
453 | return rc; | 531 | return rc; |
454 | } | 532 | } |
533 | |||
534 | /* | ||
535 | * After obtaining a string representation of the client's debug | ||
536 | * keywords and their associated masks, this function is called to build an | ||
537 | * array of these values. | ||
538 | */ | ||
539 | static int orangefs_prepare_cdm_array(char *debug_array_string) | ||
540 | { | ||
541 | int i; | ||
542 | int rc = -EINVAL; | ||
543 | char *cds_head = NULL; | ||
544 | char *cds_delimiter = NULL; | ||
545 | int keyword_len = 0; | ||
546 | |||
547 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__); | ||
548 | |||
549 | /* | ||
550 | * figure out how many elements the cdm_array needs. | ||
551 | */ | ||
552 | for (i = 0; i < strlen(debug_array_string); i++) | ||
553 | if (debug_array_string[i] == '\n') | ||
554 | cdm_element_count++; | ||
555 | |||
556 | if (!cdm_element_count) { | ||
557 | pr_info("No elements in client debug array string!\n"); | ||
558 | goto out; | ||
559 | } | ||
560 | |||
561 | cdm_array = | ||
562 | kzalloc(cdm_element_count * sizeof(struct client_debug_mask), | ||
563 | GFP_KERNEL); | ||
564 | if (!cdm_array) { | ||
565 | pr_info("malloc failed for cdm_array!\n"); | ||
566 | rc = -ENOMEM; | ||
567 | goto out; | ||
568 | } | ||
569 | |||
570 | cds_head = debug_array_string; | ||
571 | |||
572 | for (i = 0; i < cdm_element_count; i++) { | ||
573 | cds_delimiter = strchr(cds_head, '\n'); | ||
574 | *cds_delimiter = '\0'; | ||
575 | |||
576 | keyword_len = strcspn(cds_head, " "); | ||
577 | |||
578 | cdm_array[i].keyword = kzalloc(keyword_len + 1, GFP_KERNEL); | ||
579 | if (!cdm_array[i].keyword) { | ||
580 | rc = -ENOMEM; | ||
581 | goto out; | ||
582 | } | ||
583 | |||
584 | sscanf(cds_head, | ||
585 | "%s %llx %llx", | ||
586 | cdm_array[i].keyword, | ||
587 | (unsigned long long *)&(cdm_array[i].mask1), | ||
588 | (unsigned long long *)&(cdm_array[i].mask2)); | ||
589 | |||
590 | if (!strcmp(cdm_array[i].keyword, ORANGEFS_VERBOSE)) | ||
591 | client_verbose_index = i; | ||
592 | |||
593 | if (!strcmp(cdm_array[i].keyword, ORANGEFS_ALL)) | ||
594 | client_all_index = i; | ||
595 | |||
596 | cds_head = cds_delimiter + 1; | ||
597 | } | ||
598 | |||
599 | rc = cdm_element_count; | ||
600 | |||
601 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: rc:%d:\n", __func__, rc); | ||
602 | |||
603 | out: | ||
604 | |||
605 | return rc; | ||
606 | |||
607 | } | ||
608 | |||
609 | /* | ||
610 | * /sys/kernel/debug/orangefs/debug-help can be catted to | ||
611 | * see all the available kernel and client debug keywords. | ||
612 | * | ||
613 | * When the kernel boots, we have no idea what keywords the | ||
614 | * client supports, nor their associated masks. | ||
615 | * | ||
616 | * We pass through this function once at boot and stamp a | ||
617 | * boilerplate "we don't know" message for the client in the | ||
618 | * debug-help file. We pass through here again when the client | ||
619 | * starts and then we can fill out the debug-help file fully. | ||
620 | * | ||
621 | * The client might be restarted any number of times between | ||
622 | * reboots, we only build the debug-help file the first time. | ||
623 | */ | ||
624 | int orangefs_prepare_debugfs_help_string(int at_boot) | ||
625 | { | ||
626 | int rc = -EINVAL; | ||
627 | int i; | ||
628 | int byte_count = 0; | ||
629 | char *client_title = "Client Debug Keywords:\n"; | ||
630 | char *kernel_title = "Kernel Debug Keywords:\n"; | ||
631 | |||
632 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__); | ||
633 | |||
634 | if (at_boot) { | ||
635 | byte_count += strlen(HELP_STRING_UNINITIALIZED); | ||
636 | client_title = HELP_STRING_UNINITIALIZED; | ||
637 | } else { | ||
638 | /* | ||
639 | * fill the client keyword/mask array and remember | ||
640 | * how many elements there were. | ||
641 | */ | ||
642 | cdm_element_count = | ||
643 | orangefs_prepare_cdm_array(client_debug_array_string); | ||
644 | if (cdm_element_count <= 0) | ||
645 | goto out; | ||
646 | |||
647 | /* Count the bytes destined for debug_help_string. */ | ||
648 | byte_count += strlen(client_title); | ||
649 | |||
650 | for (i = 0; i < cdm_element_count; i++) { | ||
651 | byte_count += strlen(cdm_array[i].keyword + 2); | ||
652 | if (byte_count >= DEBUG_HELP_STRING_SIZE) { | ||
653 | pr_info("%s: overflow 1!\n", __func__); | ||
654 | goto out; | ||
655 | } | ||
656 | } | ||
657 | |||
658 | gossip_debug(GOSSIP_UTILS_DEBUG, | ||
659 | "%s: cdm_element_count:%d:\n", | ||
660 | __func__, | ||
661 | cdm_element_count); | ||
662 | } | ||
663 | |||
664 | byte_count += strlen(kernel_title); | ||
665 | for (i = 0; i < num_kmod_keyword_mask_map; i++) { | ||
666 | byte_count += | ||
667 | strlen(s_kmod_keyword_mask_map[i].keyword + 2); | ||
668 | if (byte_count >= DEBUG_HELP_STRING_SIZE) { | ||
669 | pr_info("%s: overflow 2!\n", __func__); | ||
670 | goto out; | ||
671 | } | ||
672 | } | ||
673 | |||
674 | /* build debug_help_string. */ | ||
675 | debug_help_string = kzalloc(DEBUG_HELP_STRING_SIZE, GFP_KERNEL); | ||
676 | if (!debug_help_string) { | ||
677 | rc = -ENOMEM; | ||
678 | goto out; | ||
679 | } | ||
680 | |||
681 | strcat(debug_help_string, client_title); | ||
682 | |||
683 | if (!at_boot) { | ||
684 | for (i = 0; i < cdm_element_count; i++) { | ||
685 | strcat(debug_help_string, "\t"); | ||
686 | strcat(debug_help_string, cdm_array[i].keyword); | ||
687 | strcat(debug_help_string, "\n"); | ||
688 | } | ||
689 | } | ||
690 | |||
691 | strcat(debug_help_string, "\n"); | ||
692 | strcat(debug_help_string, kernel_title); | ||
693 | |||
694 | for (i = 0; i < num_kmod_keyword_mask_map; i++) { | ||
695 | strcat(debug_help_string, "\t"); | ||
696 | strcat(debug_help_string, s_kmod_keyword_mask_map[i].keyword); | ||
697 | strcat(debug_help_string, "\n"); | ||
698 | } | ||
699 | |||
700 | rc = 0; | ||
701 | |||
702 | out: | ||
703 | |||
704 | return rc; | ||
705 | |||
706 | } | ||
707 | |||
708 | /* | ||
709 | * kernel = type 0 | ||
710 | * client = type 1 | ||
711 | */ | ||
712 | static void debug_mask_to_string(void *mask, int type) | ||
713 | { | ||
714 | int i; | ||
715 | int len = 0; | ||
716 | char *debug_string; | ||
717 | int element_count = 0; | ||
718 | |||
719 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__); | ||
720 | |||
721 | if (type) { | ||
722 | debug_string = client_debug_string; | ||
723 | element_count = cdm_element_count; | ||
724 | } else { | ||
725 | debug_string = kernel_debug_string; | ||
726 | element_count = num_kmod_keyword_mask_map; | ||
727 | } | ||
728 | |||
729 | memset(debug_string, 0, ORANGEFS_MAX_DEBUG_STRING_LEN); | ||
730 | |||
731 | /* | ||
732 | * Some keywords, like "all" or "verbose", are amalgams of | ||
733 | * numerous other keywords. Make a special check for those | ||
734 | * before grinding through the whole mask only to find out | ||
735 | * later... | ||
736 | */ | ||
737 | if (check_amalgam_keyword(mask, type)) | ||
738 | goto out; | ||
739 | |||
740 | /* Build the debug string. */ | ||
741 | for (i = 0; i < element_count; i++) | ||
742 | if (type) | ||
743 | do_c_string(mask, i); | ||
744 | else | ||
745 | do_k_string(mask, i); | ||
746 | |||
747 | len = strlen(debug_string); | ||
748 | |||
749 | if ((len) && (type)) | ||
750 | client_debug_string[len - 1] = '\0'; | ||
751 | else if (len) | ||
752 | kernel_debug_string[len - 1] = '\0'; | ||
753 | else if (type) | ||
754 | strcpy(client_debug_string, "none"); | ||
755 | else | ||
756 | strcpy(kernel_debug_string, "none"); | ||
757 | |||
758 | out: | ||
759 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: string:%s:\n", __func__, debug_string); | ||
760 | |||
761 | return; | ||
762 | |||
763 | } | ||
764 | |||
765 | static void do_k_string(void *k_mask, int index) | ||
766 | { | ||
767 | __u64 *mask = (__u64 *) k_mask; | ||
768 | |||
769 | if (keyword_is_amalgam((char *) s_kmod_keyword_mask_map[index].keyword)) | ||
770 | goto out; | ||
771 | |||
772 | if (*mask & s_kmod_keyword_mask_map[index].mask_val) { | ||
773 | if ((strlen(kernel_debug_string) + | ||
774 | strlen(s_kmod_keyword_mask_map[index].keyword)) | ||
775 | < ORANGEFS_MAX_DEBUG_STRING_LEN - 1) { | ||
776 | strcat(kernel_debug_string, | ||
777 | s_kmod_keyword_mask_map[index].keyword); | ||
778 | strcat(kernel_debug_string, ","); | ||
779 | } else { | ||
780 | gossip_err("%s: overflow!\n", __func__); | ||
781 | strcpy(kernel_debug_string, ORANGEFS_ALL); | ||
782 | goto out; | ||
783 | } | ||
784 | } | ||
785 | |||
786 | out: | ||
787 | |||
788 | return; | ||
789 | } | ||
790 | |||
791 | static void do_c_string(void *c_mask, int index) | ||
792 | { | ||
793 | struct client_debug_mask *mask = (struct client_debug_mask *) c_mask; | ||
794 | |||
795 | if (keyword_is_amalgam(cdm_array[index].keyword)) | ||
796 | goto out; | ||
797 | |||
798 | if ((mask->mask1 & cdm_array[index].mask1) || | ||
799 | (mask->mask2 & cdm_array[index].mask2)) { | ||
800 | if ((strlen(client_debug_string) + | ||
801 | strlen(cdm_array[index].keyword) + 1) | ||
802 | < ORANGEFS_MAX_DEBUG_STRING_LEN - 2) { | ||
803 | strcat(client_debug_string, | ||
804 | cdm_array[index].keyword); | ||
805 | strcat(client_debug_string, ","); | ||
806 | } else { | ||
807 | gossip_err("%s: overflow!\n", __func__); | ||
808 | strcpy(client_debug_string, ORANGEFS_ALL); | ||
809 | goto out; | ||
810 | } | ||
811 | } | ||
812 | out: | ||
813 | return; | ||
814 | } | ||
815 | |||
816 | static int keyword_is_amalgam(char *keyword) | ||
817 | { | ||
818 | int rc = 0; | ||
819 | |||
820 | if ((!strcmp(keyword, ORANGEFS_ALL)) || (!strcmp(keyword, ORANGEFS_VERBOSE))) | ||
821 | rc = 1; | ||
822 | |||
823 | return rc; | ||
824 | } | ||
825 | |||
826 | /* | ||
827 | * kernel = type 0 | ||
828 | * client = type 1 | ||
829 | * | ||
830 | * return 1 if we found an amalgam. | ||
831 | */ | ||
832 | static int check_amalgam_keyword(void *mask, int type) | ||
833 | { | ||
834 | __u64 *k_mask; | ||
835 | struct client_debug_mask *c_mask; | ||
836 | int k_all_index = num_kmod_keyword_mask_map - 1; | ||
837 | int rc = 0; | ||
838 | |||
839 | if (type) { | ||
840 | c_mask = (struct client_debug_mask *) mask; | ||
841 | |||
842 | if ((c_mask->mask1 == cdm_array[client_all_index].mask1) && | ||
843 | (c_mask->mask2 == cdm_array[client_all_index].mask2)) { | ||
844 | strcpy(client_debug_string, ORANGEFS_ALL); | ||
845 | rc = 1; | ||
846 | goto out; | ||
847 | } | ||
848 | |||
849 | if ((c_mask->mask1 == cdm_array[client_verbose_index].mask1) && | ||
850 | (c_mask->mask2 == cdm_array[client_verbose_index].mask2)) { | ||
851 | strcpy(client_debug_string, ORANGEFS_VERBOSE); | ||
852 | rc = 1; | ||
853 | goto out; | ||
854 | } | ||
855 | |||
856 | } else { | ||
857 | k_mask = (__u64 *) mask; | ||
858 | |||
859 | if (*k_mask >= s_kmod_keyword_mask_map[k_all_index].mask_val) { | ||
860 | strcpy(kernel_debug_string, ORANGEFS_ALL); | ||
861 | rc = 1; | ||
862 | goto out; | ||
863 | } | ||
864 | } | ||
865 | |||
866 | out: | ||
867 | |||
868 | return rc; | ||
869 | } | ||
870 | |||
871 | /* | ||
872 | * kernel = type 0 | ||
873 | * client = type 1 | ||
874 | */ | ||
875 | static void debug_string_to_mask(char *debug_string, void *mask, int type) | ||
876 | { | ||
877 | char *unchecked_keyword; | ||
878 | int i; | ||
879 | char *strsep_fodder = kstrdup(debug_string, GFP_KERNEL); | ||
880 | char *original_pointer; | ||
881 | int element_count = 0; | ||
882 | struct client_debug_mask *c_mask = NULL; | ||
883 | __u64 *k_mask = NULL; | ||
884 | |||
885 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__); | ||
886 | |||
887 | if (type) { | ||
888 | c_mask = (struct client_debug_mask *)mask; | ||
889 | element_count = cdm_element_count; | ||
890 | } else { | ||
891 | k_mask = (__u64 *)mask; | ||
892 | *k_mask = 0; | ||
893 | element_count = num_kmod_keyword_mask_map; | ||
894 | } | ||
895 | |||
896 | original_pointer = strsep_fodder; | ||
897 | while ((unchecked_keyword = strsep(&strsep_fodder, ","))) | ||
898 | if (strlen(unchecked_keyword)) { | ||
899 | for (i = 0; i < element_count; i++) | ||
900 | if (type) | ||
901 | do_c_mask(i, | ||
902 | unchecked_keyword, | ||
903 | &c_mask); | ||
904 | else | ||
905 | do_k_mask(i, | ||
906 | unchecked_keyword, | ||
907 | &k_mask); | ||
908 | } | ||
909 | |||
910 | kfree(original_pointer); | ||
911 | } | ||
912 | |||
913 | static void do_c_mask(int i, char *unchecked_keyword, | ||
914 | struct client_debug_mask **sane_mask) | ||
915 | { | ||
916 | |||
917 | if (!strcmp(cdm_array[i].keyword, unchecked_keyword)) { | ||
918 | (**sane_mask).mask1 = (**sane_mask).mask1 | cdm_array[i].mask1; | ||
919 | (**sane_mask).mask2 = (**sane_mask).mask2 | cdm_array[i].mask2; | ||
920 | } | ||
921 | } | ||
922 | |||
923 | static void do_k_mask(int i, char *unchecked_keyword, __u64 **sane_mask) | ||
924 | { | ||
925 | |||
926 | if (!strcmp(s_kmod_keyword_mask_map[i].keyword, unchecked_keyword)) | ||
927 | **sane_mask = (**sane_mask) | | ||
928 | s_kmod_keyword_mask_map[i].mask_val; | ||
929 | } | ||
930 | |||
931 | int orangefs_debugfs_new_client_mask(void __user *arg) | ||
932 | { | ||
933 | struct dev_mask2_info_s mask2_info = {0}; | ||
934 | int ret; | ||
935 | |||
936 | ret = copy_from_user(&mask2_info, | ||
937 | (void __user *)arg, | ||
938 | sizeof(struct dev_mask2_info_s)); | ||
939 | |||
940 | if (ret != 0) | ||
941 | return -EIO; | ||
942 | |||
943 | client_debug_mask.mask1 = mask2_info.mask1_value; | ||
944 | client_debug_mask.mask2 = mask2_info.mask2_value; | ||
945 | |||
946 | pr_info("%s: client debug mask has been been received " | ||
947 | ":%llx: :%llx:\n", | ||
948 | __func__, | ||
949 | (unsigned long long)client_debug_mask.mask1, | ||
950 | (unsigned long long)client_debug_mask.mask2); | ||
951 | |||
952 | return ret; | ||
953 | } | ||
954 | |||
955 | int orangefs_debugfs_new_client_string(void __user *arg) | ||
956 | { | ||
957 | int ret; | ||
958 | |||
959 | ret = copy_from_user(&client_debug_array_string, | ||
960 | (void __user *)arg, | ||
961 | ORANGEFS_MAX_DEBUG_STRING_LEN); | ||
962 | if (ret != 0) | ||
963 | return -EIO; | ||
964 | |||
965 | /* | ||
966 | * The real client-core makes an effort to ensure | ||
967 | * that actual strings that aren't too long to fit in | ||
968 | * this buffer is what we get here. We're going to use | ||
969 | * string functions on the stuff we got, so we'll make | ||
970 | * this extra effort to try and keep from | ||
971 | * flowing out of this buffer when we use the string | ||
972 | * functions, even if somehow the stuff we end up | ||
973 | * with here is garbage. | ||
974 | */ | ||
975 | client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN - 1] = | ||
976 | '\0'; | ||
977 | |||
978 | if (ret != 0) { | ||
979 | pr_info("%s: CLIENT_STRING: copy_from_user failed\n", | ||
980 | __func__); | ||
981 | return -EIO; | ||
982 | } | ||
983 | |||
984 | pr_info("%s: client debug array string has been received.\n", | ||
985 | __func__); | ||
986 | |||
987 | if (!help_string_initialized) { | ||
988 | |||
989 | /* Free the "we don't know yet" default string... */ | ||
990 | kfree(debug_help_string); | ||
991 | |||
992 | /* build a proper debug help string */ | ||
993 | if (orangefs_prepare_debugfs_help_string(0)) { | ||
994 | gossip_err("%s: no debug help string \n", | ||
995 | __func__); | ||
996 | return -EIO; | ||
997 | } | ||
998 | |||
999 | /* Replace the boilerplate boot-time debug-help file. */ | ||
1000 | debugfs_remove(help_file_dentry); | ||
1001 | |||
1002 | help_file_dentry = | ||
1003 | debugfs_create_file( | ||
1004 | ORANGEFS_KMOD_DEBUG_HELP_FILE, | ||
1005 | 0444, | ||
1006 | debug_dir, | ||
1007 | debug_help_string, | ||
1008 | &debug_help_fops); | ||
1009 | |||
1010 | if (!help_file_dentry) { | ||
1011 | gossip_err("%s: debugfs_create_file failed for" | ||
1012 | " :%s:!\n", | ||
1013 | __func__, | ||
1014 | ORANGEFS_KMOD_DEBUG_HELP_FILE); | ||
1015 | return -EIO; | ||
1016 | } | ||
1017 | } | ||
1018 | |||
1019 | debug_mask_to_string(&client_debug_mask, 1); | ||
1020 | |||
1021 | debugfs_remove(client_debug_dentry); | ||
1022 | |||
1023 | orangefs_client_debug_init(); | ||
1024 | |||
1025 | help_string_initialized++; | ||
1026 | |||
1027 | return ret; | ||
1028 | } | ||
1029 | |||
1030 | int orangefs_debugfs_new_debug(void __user *arg) | ||
1031 | { | ||
1032 | struct dev_mask_info_s mask_info = {0}; | ||
1033 | int ret; | ||
1034 | |||
1035 | ret = copy_from_user(&mask_info, | ||
1036 | (void __user *)arg, | ||
1037 | sizeof(mask_info)); | ||
1038 | |||
1039 | if (ret != 0) | ||
1040 | return -EIO; | ||
1041 | |||
1042 | if (mask_info.mask_type == KERNEL_MASK) { | ||
1043 | if ((mask_info.mask_value == 0) | ||
1044 | && (kernel_mask_set_mod_init)) { | ||
1045 | /* | ||
1046 | * the kernel debug mask was set when the | ||
1047 | * kernel module was loaded; don't override | ||
1048 | * it if the client-core was started without | ||
1049 | * a value for ORANGEFS_KMODMASK. | ||
1050 | */ | ||
1051 | return 0; | ||
1052 | } | ||
1053 | debug_mask_to_string(&mask_info.mask_value, | ||
1054 | mask_info.mask_type); | ||
1055 | orangefs_gossip_debug_mask = mask_info.mask_value; | ||
1056 | pr_info("%s: kernel debug mask has been modified to " | ||
1057 | ":%s: :%llx:\n", | ||
1058 | __func__, | ||
1059 | kernel_debug_string, | ||
1060 | (unsigned long long)orangefs_gossip_debug_mask); | ||
1061 | } else if (mask_info.mask_type == CLIENT_MASK) { | ||
1062 | debug_mask_to_string(&mask_info.mask_value, | ||
1063 | mask_info.mask_type); | ||
1064 | pr_info("%s: client debug mask has been modified to" | ||
1065 | ":%s: :%llx:\n", | ||
1066 | __func__, | ||
1067 | client_debug_string, | ||
1068 | llu(mask_info.mask_value)); | ||
1069 | } else { | ||
1070 | gossip_lerr("Invalid mask type....\n"); | ||
1071 | return -EINVAL; | ||
1072 | } | ||
1073 | |||
1074 | return ret; | ||
1075 | } | ||
diff --git a/fs/orangefs/orangefs-debugfs.h b/fs/orangefs/orangefs-debugfs.h index e4828c0e3ef9..803517269ba6 100644 --- a/fs/orangefs/orangefs-debugfs.h +++ b/fs/orangefs/orangefs-debugfs.h | |||
@@ -1,3 +1,7 @@ | |||
1 | int orangefs_debugfs_init(void); | 1 | int orangefs_debugfs_init(int); |
2 | int orangefs_kernel_debug_init(void); | ||
3 | void orangefs_debugfs_cleanup(void); | 2 | void orangefs_debugfs_cleanup(void); |
3 | int orangefs_client_debug_init(void); | ||
4 | int orangefs_prepare_debugfs_help_string(int); | ||
5 | int orangefs_debugfs_new_client_mask(void __user *); | ||
6 | int orangefs_debugfs_new_client_string(void __user *); | ||
7 | int orangefs_debugfs_new_debug(void __user *); | ||
diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h index 633c07a6e3d8..67d391c85465 100644 --- a/fs/orangefs/orangefs-kernel.h +++ b/fs/orangefs/orangefs-kernel.h | |||
@@ -100,16 +100,6 @@ enum orangefs_vfs_op_states { | |||
100 | }; | 100 | }; |
101 | 101 | ||
102 | /* | 102 | /* |
103 | * An array of client_debug_mask will be built to hold debug keyword/mask | ||
104 | * values fetched from userspace. | ||
105 | */ | ||
106 | struct client_debug_mask { | ||
107 | char *keyword; | ||
108 | __u64 mask1; | ||
109 | __u64 mask2; | ||
110 | }; | ||
111 | |||
112 | /* | ||
113 | * orangefs kernel memory related flags | 103 | * orangefs kernel memory related flags |
114 | */ | 104 | */ |
115 | 105 | ||
@@ -119,29 +109,6 @@ struct client_debug_mask { | |||
119 | #define ORANGEFS_CACHE_CREATE_FLAGS 0 | 109 | #define ORANGEFS_CACHE_CREATE_FLAGS 0 |
120 | #endif /* ((defined ORANGEFS_KERNEL_DEBUG) && (defined CONFIG_DEBUG_SLAB)) */ | 110 | #endif /* ((defined ORANGEFS_KERNEL_DEBUG) && (defined CONFIG_DEBUG_SLAB)) */ |
121 | 111 | ||
122 | /* these functions are defined in orangefs-utils.c */ | ||
123 | int orangefs_prepare_cdm_array(char *debug_array_string); | ||
124 | int orangefs_prepare_debugfs_help_string(int); | ||
125 | |||
126 | /* defined in orangefs-debugfs.c */ | ||
127 | int orangefs_client_debug_init(void); | ||
128 | |||
129 | void debug_string_to_mask(char *, void *, int); | ||
130 | void do_c_mask(int, char *, struct client_debug_mask **); | ||
131 | void do_k_mask(int, char *, __u64 **); | ||
132 | |||
133 | void debug_mask_to_string(void *, int); | ||
134 | void do_k_string(void *, int); | ||
135 | void do_c_string(void *, int); | ||
136 | int check_amalgam_keyword(void *, int); | ||
137 | int keyword_is_amalgam(char *); | ||
138 | |||
139 | /*these variables are defined in orangefs-mod.c */ | ||
140 | extern char kernel_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN]; | ||
141 | extern char client_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN]; | ||
142 | extern char client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN]; | ||
143 | extern unsigned int kernel_mask_set_mod_init; | ||
144 | |||
145 | extern int orangefs_init_acl(struct inode *inode, struct inode *dir); | 112 | extern int orangefs_init_acl(struct inode *inode, struct inode *dir); |
146 | extern const struct xattr_handler *orangefs_xattr_handlers[]; | 113 | extern const struct xattr_handler *orangefs_xattr_handlers[]; |
147 | 114 | ||
diff --git a/fs/orangefs/orangefs-mod.c b/fs/orangefs/orangefs-mod.c index e9fd5755c05f..0028c60a46c7 100644 --- a/fs/orangefs/orangefs-mod.c +++ b/fs/orangefs/orangefs-mod.c | |||
@@ -21,30 +21,13 @@ | |||
21 | * global variables declared here | 21 | * global variables declared here |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* array of client debug keyword/mask values */ | ||
25 | struct client_debug_mask *cdm_array; | ||
26 | int cdm_element_count; | ||
27 | |||
28 | char kernel_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN] = "none"; | ||
29 | char client_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN]; | ||
30 | char client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN]; | ||
31 | |||
32 | char *debug_help_string; | ||
33 | int help_string_initialized; | ||
34 | struct dentry *help_file_dentry; | ||
35 | struct dentry *client_debug_dentry; | ||
36 | struct dentry *debug_dir; | ||
37 | int client_verbose_index; | ||
38 | int client_all_index; | ||
39 | struct orangefs_stats g_orangefs_stats; | 24 | struct orangefs_stats g_orangefs_stats; |
40 | 25 | ||
41 | /* the size of the hash tables for ops in progress */ | 26 | /* the size of the hash tables for ops in progress */ |
42 | int hash_table_size = 509; | 27 | int hash_table_size = 509; |
43 | 28 | ||
44 | static ulong module_parm_debug_mask; | 29 | static ulong module_parm_debug_mask; |
45 | __u64 gossip_debug_mask; | 30 | __u64 orangefs_gossip_debug_mask; |
46 | struct client_debug_mask client_debug_mask = { NULL, 0, 0 }; | ||
47 | unsigned int kernel_mask_set_mod_init; /* implicitly false */ | ||
48 | int op_timeout_secs = ORANGEFS_DEFAULT_OP_TIMEOUT_SECS; | 31 | int op_timeout_secs = ORANGEFS_DEFAULT_OP_TIMEOUT_SECS; |
49 | int slot_timeout_secs = ORANGEFS_DEFAULT_SLOT_TIMEOUT_SECS; | 32 | int slot_timeout_secs = ORANGEFS_DEFAULT_SLOT_TIMEOUT_SECS; |
50 | int dcache_timeout_msecs = 50; | 33 | int dcache_timeout_msecs = 50; |
@@ -100,32 +83,6 @@ static int __init orangefs_init(void) | |||
100 | int ret = -1; | 83 | int ret = -1; |
101 | __u32 i = 0; | 84 | __u32 i = 0; |
102 | 85 | ||
103 | /* convert input debug mask to a 64-bit unsigned integer */ | ||
104 | gossip_debug_mask = (unsigned long long) module_parm_debug_mask; | ||
105 | |||
106 | /* | ||
107 | * set the kernel's gossip debug string; invalid mask values will | ||
108 | * be ignored. | ||
109 | */ | ||
110 | debug_mask_to_string(&gossip_debug_mask, 0); | ||
111 | |||
112 | /* remove any invalid values from the mask */ | ||
113 | debug_string_to_mask(kernel_debug_string, &gossip_debug_mask, 0); | ||
114 | |||
115 | /* | ||
116 | * if the mask has a non-zero value, then indicate that the mask | ||
117 | * was set when the kernel module was loaded. The orangefs dev ioctl | ||
118 | * command will look at this boolean to determine if the kernel's | ||
119 | * debug mask should be overwritten when the client-core is started. | ||
120 | */ | ||
121 | if (gossip_debug_mask != 0) | ||
122 | kernel_mask_set_mod_init = true; | ||
123 | |||
124 | pr_info("%s: called with debug mask: :%s: :%llx:\n", | ||
125 | __func__, | ||
126 | kernel_debug_string, | ||
127 | (unsigned long long)gossip_debug_mask); | ||
128 | |||
129 | ret = bdi_init(&orangefs_backing_dev_info); | 86 | ret = bdi_init(&orangefs_backing_dev_info); |
130 | 87 | ||
131 | if (ret) | 88 | if (ret) |
@@ -179,14 +136,10 @@ static int __init orangefs_init(void) | |||
179 | if (ret) | 136 | if (ret) |
180 | goto cleanup_key_table; | 137 | goto cleanup_key_table; |
181 | 138 | ||
182 | ret = orangefs_debugfs_init(); | 139 | ret = orangefs_debugfs_init(module_parm_debug_mask); |
183 | if (ret) | 140 | if (ret) |
184 | goto debugfs_init_failed; | 141 | goto debugfs_init_failed; |
185 | 142 | ||
186 | ret = orangefs_kernel_debug_init(); | ||
187 | if (ret) | ||
188 | goto kernel_debug_init_failed; | ||
189 | |||
190 | ret = orangefs_sysfs_init(); | 143 | ret = orangefs_sysfs_init(); |
191 | if (ret) | 144 | if (ret) |
192 | goto sysfs_init_failed; | 145 | goto sysfs_init_failed; |
@@ -214,8 +167,6 @@ cleanup_device: | |||
214 | 167 | ||
215 | sysfs_init_failed: | 168 | sysfs_init_failed: |
216 | 169 | ||
217 | kernel_debug_init_failed: | ||
218 | |||
219 | debugfs_init_failed: | 170 | debugfs_init_failed: |
220 | orangefs_debugfs_cleanup(); | 171 | orangefs_debugfs_cleanup(); |
221 | 172 | ||
diff --git a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c index 9a99285fe310..f7328f26cb00 100644 --- a/fs/orangefs/orangefs-utils.c +++ b/fs/orangefs/orangefs-utils.c | |||
@@ -656,401 +656,3 @@ __s32 ORANGEFS_util_translate_mode(int mode) | |||
656 | return ret; | 656 | return ret; |
657 | } | 657 | } |
658 | #undef NUM_MODES | 658 | #undef NUM_MODES |
659 | |||
660 | /* | ||
661 | * After obtaining a string representation of the client's debug | ||
662 | * keywords and their associated masks, this function is called to build an | ||
663 | * array of these values. | ||
664 | */ | ||
665 | int orangefs_prepare_cdm_array(char *debug_array_string) | ||
666 | { | ||
667 | int i; | ||
668 | int rc = -EINVAL; | ||
669 | char *cds_head = NULL; | ||
670 | char *cds_delimiter = NULL; | ||
671 | int keyword_len = 0; | ||
672 | |||
673 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__); | ||
674 | |||
675 | /* | ||
676 | * figure out how many elements the cdm_array needs. | ||
677 | */ | ||
678 | for (i = 0; i < strlen(debug_array_string); i++) | ||
679 | if (debug_array_string[i] == '\n') | ||
680 | cdm_element_count++; | ||
681 | |||
682 | if (!cdm_element_count) { | ||
683 | pr_info("No elements in client debug array string!\n"); | ||
684 | goto out; | ||
685 | } | ||
686 | |||
687 | cdm_array = | ||
688 | kzalloc(cdm_element_count * sizeof(struct client_debug_mask), | ||
689 | GFP_KERNEL); | ||
690 | if (!cdm_array) { | ||
691 | pr_info("malloc failed for cdm_array!\n"); | ||
692 | rc = -ENOMEM; | ||
693 | goto out; | ||
694 | } | ||
695 | |||
696 | cds_head = debug_array_string; | ||
697 | |||
698 | for (i = 0; i < cdm_element_count; i++) { | ||
699 | cds_delimiter = strchr(cds_head, '\n'); | ||
700 | *cds_delimiter = '\0'; | ||
701 | |||
702 | keyword_len = strcspn(cds_head, " "); | ||
703 | |||
704 | cdm_array[i].keyword = kzalloc(keyword_len + 1, GFP_KERNEL); | ||
705 | if (!cdm_array[i].keyword) { | ||
706 | rc = -ENOMEM; | ||
707 | goto out; | ||
708 | } | ||
709 | |||
710 | sscanf(cds_head, | ||
711 | "%s %llx %llx", | ||
712 | cdm_array[i].keyword, | ||
713 | (unsigned long long *)&(cdm_array[i].mask1), | ||
714 | (unsigned long long *)&(cdm_array[i].mask2)); | ||
715 | |||
716 | if (!strcmp(cdm_array[i].keyword, ORANGEFS_VERBOSE)) | ||
717 | client_verbose_index = i; | ||
718 | |||
719 | if (!strcmp(cdm_array[i].keyword, ORANGEFS_ALL)) | ||
720 | client_all_index = i; | ||
721 | |||
722 | cds_head = cds_delimiter + 1; | ||
723 | } | ||
724 | |||
725 | rc = cdm_element_count; | ||
726 | |||
727 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: rc:%d:\n", __func__, rc); | ||
728 | |||
729 | out: | ||
730 | |||
731 | return rc; | ||
732 | |||
733 | } | ||
734 | |||
735 | /* | ||
736 | * /sys/kernel/debug/orangefs/debug-help can be catted to | ||
737 | * see all the available kernel and client debug keywords. | ||
738 | * | ||
739 | * When the kernel boots, we have no idea what keywords the | ||
740 | * client supports, nor their associated masks. | ||
741 | * | ||
742 | * We pass through this function once at boot and stamp a | ||
743 | * boilerplate "we don't know" message for the client in the | ||
744 | * debug-help file. We pass through here again when the client | ||
745 | * starts and then we can fill out the debug-help file fully. | ||
746 | * | ||
747 | * The client might be restarted any number of times between | ||
748 | * reboots, we only build the debug-help file the first time. | ||
749 | */ | ||
750 | int orangefs_prepare_debugfs_help_string(int at_boot) | ||
751 | { | ||
752 | int rc = -EINVAL; | ||
753 | int i; | ||
754 | int byte_count = 0; | ||
755 | char *client_title = "Client Debug Keywords:\n"; | ||
756 | char *kernel_title = "Kernel Debug Keywords:\n"; | ||
757 | |||
758 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__); | ||
759 | |||
760 | if (at_boot) { | ||
761 | byte_count += strlen(HELP_STRING_UNINITIALIZED); | ||
762 | client_title = HELP_STRING_UNINITIALIZED; | ||
763 | } else { | ||
764 | /* | ||
765 | * fill the client keyword/mask array and remember | ||
766 | * how many elements there were. | ||
767 | */ | ||
768 | cdm_element_count = | ||
769 | orangefs_prepare_cdm_array(client_debug_array_string); | ||
770 | if (cdm_element_count <= 0) | ||
771 | goto out; | ||
772 | |||
773 | /* Count the bytes destined for debug_help_string. */ | ||
774 | byte_count += strlen(client_title); | ||
775 | |||
776 | for (i = 0; i < cdm_element_count; i++) { | ||
777 | byte_count += strlen(cdm_array[i].keyword + 2); | ||
778 | if (byte_count >= DEBUG_HELP_STRING_SIZE) { | ||
779 | pr_info("%s: overflow 1!\n", __func__); | ||
780 | goto out; | ||
781 | } | ||
782 | } | ||
783 | |||
784 | gossip_debug(GOSSIP_UTILS_DEBUG, | ||
785 | "%s: cdm_element_count:%d:\n", | ||
786 | __func__, | ||
787 | cdm_element_count); | ||
788 | } | ||
789 | |||
790 | byte_count += strlen(kernel_title); | ||
791 | for (i = 0; i < num_kmod_keyword_mask_map; i++) { | ||
792 | byte_count += | ||
793 | strlen(s_kmod_keyword_mask_map[i].keyword + 2); | ||
794 | if (byte_count >= DEBUG_HELP_STRING_SIZE) { | ||
795 | pr_info("%s: overflow 2!\n", __func__); | ||
796 | goto out; | ||
797 | } | ||
798 | } | ||
799 | |||
800 | /* build debug_help_string. */ | ||
801 | debug_help_string = kzalloc(DEBUG_HELP_STRING_SIZE, GFP_KERNEL); | ||
802 | if (!debug_help_string) { | ||
803 | rc = -ENOMEM; | ||
804 | goto out; | ||
805 | } | ||
806 | |||
807 | strcat(debug_help_string, client_title); | ||
808 | |||
809 | if (!at_boot) { | ||
810 | for (i = 0; i < cdm_element_count; i++) { | ||
811 | strcat(debug_help_string, "\t"); | ||
812 | strcat(debug_help_string, cdm_array[i].keyword); | ||
813 | strcat(debug_help_string, "\n"); | ||
814 | } | ||
815 | } | ||
816 | |||
817 | strcat(debug_help_string, "\n"); | ||
818 | strcat(debug_help_string, kernel_title); | ||
819 | |||
820 | for (i = 0; i < num_kmod_keyword_mask_map; i++) { | ||
821 | strcat(debug_help_string, "\t"); | ||
822 | strcat(debug_help_string, s_kmod_keyword_mask_map[i].keyword); | ||
823 | strcat(debug_help_string, "\n"); | ||
824 | } | ||
825 | |||
826 | rc = 0; | ||
827 | |||
828 | out: | ||
829 | |||
830 | return rc; | ||
831 | |||
832 | } | ||
833 | |||
834 | /* | ||
835 | * kernel = type 0 | ||
836 | * client = type 1 | ||
837 | */ | ||
838 | void debug_mask_to_string(void *mask, int type) | ||
839 | { | ||
840 | int i; | ||
841 | int len = 0; | ||
842 | char *debug_string; | ||
843 | int element_count = 0; | ||
844 | |||
845 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__); | ||
846 | |||
847 | if (type) { | ||
848 | debug_string = client_debug_string; | ||
849 | element_count = cdm_element_count; | ||
850 | } else { | ||
851 | debug_string = kernel_debug_string; | ||
852 | element_count = num_kmod_keyword_mask_map; | ||
853 | } | ||
854 | |||
855 | memset(debug_string, 0, ORANGEFS_MAX_DEBUG_STRING_LEN); | ||
856 | |||
857 | /* | ||
858 | * Some keywords, like "all" or "verbose", are amalgams of | ||
859 | * numerous other keywords. Make a special check for those | ||
860 | * before grinding through the whole mask only to find out | ||
861 | * later... | ||
862 | */ | ||
863 | if (check_amalgam_keyword(mask, type)) | ||
864 | goto out; | ||
865 | |||
866 | /* Build the debug string. */ | ||
867 | for (i = 0; i < element_count; i++) | ||
868 | if (type) | ||
869 | do_c_string(mask, i); | ||
870 | else | ||
871 | do_k_string(mask, i); | ||
872 | |||
873 | len = strlen(debug_string); | ||
874 | |||
875 | if ((len) && (type)) | ||
876 | client_debug_string[len - 1] = '\0'; | ||
877 | else if (len) | ||
878 | kernel_debug_string[len - 1] = '\0'; | ||
879 | else if (type) | ||
880 | strcpy(client_debug_string, "none"); | ||
881 | else | ||
882 | strcpy(kernel_debug_string, "none"); | ||
883 | |||
884 | out: | ||
885 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: string:%s:\n", __func__, debug_string); | ||
886 | |||
887 | return; | ||
888 | |||
889 | } | ||
890 | |||
891 | void do_k_string(void *k_mask, int index) | ||
892 | { | ||
893 | __u64 *mask = (__u64 *) k_mask; | ||
894 | |||
895 | if (keyword_is_amalgam((char *) s_kmod_keyword_mask_map[index].keyword)) | ||
896 | goto out; | ||
897 | |||
898 | if (*mask & s_kmod_keyword_mask_map[index].mask_val) { | ||
899 | if ((strlen(kernel_debug_string) + | ||
900 | strlen(s_kmod_keyword_mask_map[index].keyword)) | ||
901 | < ORANGEFS_MAX_DEBUG_STRING_LEN - 1) { | ||
902 | strcat(kernel_debug_string, | ||
903 | s_kmod_keyword_mask_map[index].keyword); | ||
904 | strcat(kernel_debug_string, ","); | ||
905 | } else { | ||
906 | gossip_err("%s: overflow!\n", __func__); | ||
907 | strcpy(kernel_debug_string, ORANGEFS_ALL); | ||
908 | goto out; | ||
909 | } | ||
910 | } | ||
911 | |||
912 | out: | ||
913 | |||
914 | return; | ||
915 | } | ||
916 | |||
917 | void do_c_string(void *c_mask, int index) | ||
918 | { | ||
919 | struct client_debug_mask *mask = (struct client_debug_mask *) c_mask; | ||
920 | |||
921 | if (keyword_is_amalgam(cdm_array[index].keyword)) | ||
922 | goto out; | ||
923 | |||
924 | if ((mask->mask1 & cdm_array[index].mask1) || | ||
925 | (mask->mask2 & cdm_array[index].mask2)) { | ||
926 | if ((strlen(client_debug_string) + | ||
927 | strlen(cdm_array[index].keyword) + 1) | ||
928 | < ORANGEFS_MAX_DEBUG_STRING_LEN - 2) { | ||
929 | strcat(client_debug_string, | ||
930 | cdm_array[index].keyword); | ||
931 | strcat(client_debug_string, ","); | ||
932 | } else { | ||
933 | gossip_err("%s: overflow!\n", __func__); | ||
934 | strcpy(client_debug_string, ORANGEFS_ALL); | ||
935 | goto out; | ||
936 | } | ||
937 | } | ||
938 | out: | ||
939 | return; | ||
940 | } | ||
941 | |||
942 | int keyword_is_amalgam(char *keyword) | ||
943 | { | ||
944 | int rc = 0; | ||
945 | |||
946 | if ((!strcmp(keyword, ORANGEFS_ALL)) || (!strcmp(keyword, ORANGEFS_VERBOSE))) | ||
947 | rc = 1; | ||
948 | |||
949 | return rc; | ||
950 | } | ||
951 | |||
952 | /* | ||
953 | * kernel = type 0 | ||
954 | * client = type 1 | ||
955 | * | ||
956 | * return 1 if we found an amalgam. | ||
957 | */ | ||
958 | int check_amalgam_keyword(void *mask, int type) | ||
959 | { | ||
960 | __u64 *k_mask; | ||
961 | struct client_debug_mask *c_mask; | ||
962 | int k_all_index = num_kmod_keyword_mask_map - 1; | ||
963 | int rc = 0; | ||
964 | |||
965 | if (type) { | ||
966 | c_mask = (struct client_debug_mask *) mask; | ||
967 | |||
968 | if ((c_mask->mask1 == cdm_array[client_all_index].mask1) && | ||
969 | (c_mask->mask2 == cdm_array[client_all_index].mask2)) { | ||
970 | strcpy(client_debug_string, ORANGEFS_ALL); | ||
971 | rc = 1; | ||
972 | goto out; | ||
973 | } | ||
974 | |||
975 | if ((c_mask->mask1 == cdm_array[client_verbose_index].mask1) && | ||
976 | (c_mask->mask2 == cdm_array[client_verbose_index].mask2)) { | ||
977 | strcpy(client_debug_string, ORANGEFS_VERBOSE); | ||
978 | rc = 1; | ||
979 | goto out; | ||
980 | } | ||
981 | |||
982 | } else { | ||
983 | k_mask = (__u64 *) mask; | ||
984 | |||
985 | if (*k_mask >= s_kmod_keyword_mask_map[k_all_index].mask_val) { | ||
986 | strcpy(kernel_debug_string, ORANGEFS_ALL); | ||
987 | rc = 1; | ||
988 | goto out; | ||
989 | } | ||
990 | } | ||
991 | |||
992 | out: | ||
993 | |||
994 | return rc; | ||
995 | } | ||
996 | |||
997 | /* | ||
998 | * kernel = type 0 | ||
999 | * client = type 1 | ||
1000 | */ | ||
1001 | void debug_string_to_mask(char *debug_string, void *mask, int type) | ||
1002 | { | ||
1003 | char *unchecked_keyword; | ||
1004 | int i; | ||
1005 | char *strsep_fodder = kstrdup(debug_string, GFP_KERNEL); | ||
1006 | char *original_pointer; | ||
1007 | int element_count = 0; | ||
1008 | struct client_debug_mask *c_mask; | ||
1009 | __u64 *k_mask; | ||
1010 | |||
1011 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__); | ||
1012 | |||
1013 | if (type) { | ||
1014 | c_mask = (struct client_debug_mask *)mask; | ||
1015 | element_count = cdm_element_count; | ||
1016 | } else { | ||
1017 | k_mask = (__u64 *)mask; | ||
1018 | *k_mask = 0; | ||
1019 | element_count = num_kmod_keyword_mask_map; | ||
1020 | } | ||
1021 | |||
1022 | original_pointer = strsep_fodder; | ||
1023 | while ((unchecked_keyword = strsep(&strsep_fodder, ","))) | ||
1024 | if (strlen(unchecked_keyword)) { | ||
1025 | for (i = 0; i < element_count; i++) | ||
1026 | if (type) | ||
1027 | do_c_mask(i, | ||
1028 | unchecked_keyword, | ||
1029 | &c_mask); | ||
1030 | else | ||
1031 | do_k_mask(i, | ||
1032 | unchecked_keyword, | ||
1033 | &k_mask); | ||
1034 | } | ||
1035 | |||
1036 | kfree(original_pointer); | ||
1037 | } | ||
1038 | |||
1039 | void do_c_mask(int i, | ||
1040 | char *unchecked_keyword, | ||
1041 | struct client_debug_mask **sane_mask) | ||
1042 | { | ||
1043 | |||
1044 | if (!strcmp(cdm_array[i].keyword, unchecked_keyword)) { | ||
1045 | (**sane_mask).mask1 = (**sane_mask).mask1 | cdm_array[i].mask1; | ||
1046 | (**sane_mask).mask2 = (**sane_mask).mask2 | cdm_array[i].mask2; | ||
1047 | } | ||
1048 | } | ||
1049 | |||
1050 | void do_k_mask(int i, char *unchecked_keyword, __u64 **sane_mask) | ||
1051 | { | ||
1052 | |||
1053 | if (!strcmp(s_kmod_keyword_mask_map[i].keyword, unchecked_keyword)) | ||
1054 | **sane_mask = (**sane_mask) | | ||
1055 | s_kmod_keyword_mask_map[i].mask_val; | ||
1056 | } | ||
diff --git a/fs/orangefs/protocol.h b/fs/orangefs/protocol.h index 3d7418c728f5..971307ad69be 100644 --- a/fs/orangefs/protocol.h +++ b/fs/orangefs/protocol.h | |||
@@ -4,26 +4,6 @@ | |||
4 | #include <linux/slab.h> | 4 | #include <linux/slab.h> |
5 | #include <linux/ioctl.h> | 5 | #include <linux/ioctl.h> |
6 | 6 | ||
7 | extern struct client_debug_mask *cdm_array; | ||
8 | extern char *debug_help_string; | ||
9 | extern int help_string_initialized; | ||
10 | extern struct dentry *debug_dir; | ||
11 | extern struct dentry *help_file_dentry; | ||
12 | extern struct dentry *client_debug_dentry; | ||
13 | extern const struct file_operations debug_help_fops; | ||
14 | extern int client_all_index; | ||
15 | extern int client_verbose_index; | ||
16 | extern int cdm_element_count; | ||
17 | #define DEBUG_HELP_STRING_SIZE 4096 | ||
18 | #define HELP_STRING_UNINITIALIZED \ | ||
19 | "Client Debug Keywords are unknown until the first time\n" \ | ||
20 | "the client is started after boot.\n" | ||
21 | #define ORANGEFS_KMOD_DEBUG_HELP_FILE "debug-help" | ||
22 | #define ORANGEFS_KMOD_DEBUG_FILE "kernel-debug" | ||
23 | #define ORANGEFS_CLIENT_DEBUG_FILE "client-debug" | ||
24 | #define ORANGEFS_VERBOSE "verbose" | ||
25 | #define ORANGEFS_ALL "all" | ||
26 | |||
27 | /* pvfs2-config.h ***********************************************************/ | 7 | /* pvfs2-config.h ***********************************************************/ |
28 | #define ORANGEFS_VERSION_MAJOR 2 | 8 | #define ORANGEFS_VERSION_MAJOR 2 |
29 | #define ORANGEFS_VERSION_MINOR 9 | 9 | #define ORANGEFS_VERSION_MINOR 9 |
@@ -426,13 +406,12 @@ do { \ | |||
426 | printk(KERN_DEBUG fmt, ##__VA_ARGS__); \ | 406 | printk(KERN_DEBUG fmt, ##__VA_ARGS__); \ |
427 | } while (0) | 407 | } while (0) |
428 | #else | 408 | #else |
429 | extern __u64 gossip_debug_mask; | 409 | extern __u64 orangefs_gossip_debug_mask; |
430 | extern struct client_debug_mask client_debug_mask; | ||
431 | 410 | ||
432 | /* try to avoid function call overhead by checking masks in macro */ | 411 | /* try to avoid function call overhead by checking masks in macro */ |
433 | #define gossip_debug(mask, fmt, ...) \ | 412 | #define gossip_debug(mask, fmt, ...) \ |
434 | do { \ | 413 | do { \ |
435 | if (gossip_debug_mask & (mask)) \ | 414 | if (orangefs_gossip_debug_mask & (mask)) \ |
436 | printk(KERN_DEBUG fmt, ##__VA_ARGS__); \ | 415 | printk(KERN_DEBUG fmt, ##__VA_ARGS__); \ |
437 | } while (0) | 416 | } while (0) |
438 | #endif /* GOSSIP_DISABLE_DEBUG */ | 417 | #endif /* GOSSIP_DISABLE_DEBUG */ |