aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/v9fs.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-11-28 13:40:46 -0500
committerEric Van Hensbergen <ericvh@gmail.com>2012-01-05 11:51:44 -0500
commit5d3851530d6d68564e4e0ce04d0547d4d106fc72 (patch)
treed47065fcc1f93f00070afe597a98ab185fd13859 /fs/9p/v9fs.c
parenta0ea787b027b79cf2e01c6758e5246db06520158 (diff)
9p: Reduce object size with CONFIG_NET_9P_DEBUG
Reduce object size by deduplicating formats. Use vsprintf extension %pV. Rename P9_DPRINTK uses to p9_debug, align arguments. Add function for _p9_debug and macro to add __func__. Add missing "\n"s to p9_debug uses. Remove embedded function names as p9_debug adds it. Remove P9_EPRINTK macro and convert use to pr_<level>. Add and use pr_fmt and pr_<level>. $ size fs/9p/built-in.o* text data bss dec hex filename 62133 984 16000 79117 1350d fs/9p/built-in.o.new 67342 984 16928 85254 14d06 fs/9p/built-in.o.old $ size net/9p/built-in.o* text data bss dec hex filename 88792 4148 22024 114964 1c114 net/9p/built-in.o.new 94072 4148 23232 121452 1da6c net/9p/built-in.o.old Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/v9fs.c')
-rw-r--r--fs/9p/v9fs.c59
1 files changed, 30 insertions, 29 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 2b78014a124a..1964f98e74be 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -23,6 +23,8 @@
23 * 23 *
24 */ 24 */
25 25
26#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
27
26#include <linux/module.h> 28#include <linux/module.h>
27#include <linux/errno.h> 29#include <linux/errno.h>
28#include <linux/fs.h> 30#include <linux/fs.h>
@@ -85,15 +87,15 @@ static int get_cache_mode(char *s)
85 87
86 if (!strcmp(s, "loose")) { 88 if (!strcmp(s, "loose")) {
87 version = CACHE_LOOSE; 89 version = CACHE_LOOSE;
88 P9_DPRINTK(P9_DEBUG_9P, "Cache mode: loose\n"); 90 p9_debug(P9_DEBUG_9P, "Cache mode: loose\n");
89 } else if (!strcmp(s, "fscache")) { 91 } else if (!strcmp(s, "fscache")) {
90 version = CACHE_FSCACHE; 92 version = CACHE_FSCACHE;
91 P9_DPRINTK(P9_DEBUG_9P, "Cache mode: fscache\n"); 93 p9_debug(P9_DEBUG_9P, "Cache mode: fscache\n");
92 } else if (!strcmp(s, "none")) { 94 } else if (!strcmp(s, "none")) {
93 version = CACHE_NONE; 95 version = CACHE_NONE;
94 P9_DPRINTK(P9_DEBUG_9P, "Cache mode: none\n"); 96 p9_debug(P9_DEBUG_9P, "Cache mode: none\n");
95 } else 97 } else
96 printk(KERN_INFO "9p: Unknown Cache mode %s.\n", s); 98 pr_info("Unknown Cache mode %s\n", s);
97 return version; 99 return version;
98} 100}
99 101
@@ -140,8 +142,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
140 case Opt_debug: 142 case Opt_debug:
141 r = match_int(&args[0], &option); 143 r = match_int(&args[0], &option);
142 if (r < 0) { 144 if (r < 0) {
143 P9_DPRINTK(P9_DEBUG_ERROR, 145 p9_debug(P9_DEBUG_ERROR,
144 "integer field, but no integer?\n"); 146 "integer field, but no integer?\n");
145 ret = r; 147 ret = r;
146 continue; 148 continue;
147 } 149 }
@@ -154,8 +156,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
154 case Opt_dfltuid: 156 case Opt_dfltuid:
155 r = match_int(&args[0], &option); 157 r = match_int(&args[0], &option);
156 if (r < 0) { 158 if (r < 0) {
157 P9_DPRINTK(P9_DEBUG_ERROR, 159 p9_debug(P9_DEBUG_ERROR,
158 "integer field, but no integer?\n"); 160 "integer field, but no integer?\n");
159 ret = r; 161 ret = r;
160 continue; 162 continue;
161 } 163 }
@@ -164,8 +166,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
164 case Opt_dfltgid: 166 case Opt_dfltgid:
165 r = match_int(&args[0], &option); 167 r = match_int(&args[0], &option);
166 if (r < 0) { 168 if (r < 0) {
167 P9_DPRINTK(P9_DEBUG_ERROR, 169 p9_debug(P9_DEBUG_ERROR,
168 "integer field, but no integer?\n"); 170 "integer field, but no integer?\n");
169 ret = r; 171 ret = r;
170 continue; 172 continue;
171 } 173 }
@@ -174,8 +176,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
174 case Opt_afid: 176 case Opt_afid:
175 r = match_int(&args[0], &option); 177 r = match_int(&args[0], &option);
176 if (r < 0) { 178 if (r < 0) {
177 P9_DPRINTK(P9_DEBUG_ERROR, 179 p9_debug(P9_DEBUG_ERROR,
178 "integer field, but no integer?\n"); 180 "integer field, but no integer?\n");
179 ret = r; 181 ret = r;
180 continue; 182 continue;
181 } 183 }
@@ -205,8 +207,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
205 s = match_strdup(&args[0]); 207 s = match_strdup(&args[0]);
206 if (!s) { 208 if (!s) {
207 ret = -ENOMEM; 209 ret = -ENOMEM;
208 P9_DPRINTK(P9_DEBUG_ERROR, 210 p9_debug(P9_DEBUG_ERROR,
209 "problem allocating copy of cache arg\n"); 211 "problem allocating copy of cache arg\n");
210 goto free_and_return; 212 goto free_and_return;
211 } 213 }
212 ret = get_cache_mode(s); 214 ret = get_cache_mode(s);
@@ -223,8 +225,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
223 s = match_strdup(&args[0]); 225 s = match_strdup(&args[0]);
224 if (!s) { 226 if (!s) {
225 ret = -ENOMEM; 227 ret = -ENOMEM;
226 P9_DPRINTK(P9_DEBUG_ERROR, 228 p9_debug(P9_DEBUG_ERROR,
227 "problem allocating copy of access arg\n"); 229 "problem allocating copy of access arg\n");
228 goto free_and_return; 230 goto free_and_return;
229 } 231 }
230 232
@@ -240,8 +242,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
240 v9ses->uid = simple_strtoul(s, &e, 10); 242 v9ses->uid = simple_strtoul(s, &e, 10);
241 if (*e != '\0') { 243 if (*e != '\0') {
242 ret = -EINVAL; 244 ret = -EINVAL;
243 printk(KERN_INFO "9p: Unknown access " 245 pr_info("Unknown access argument %s\n",
244 "argument %s.\n", s); 246 s);
245 kfree(s); 247 kfree(s);
246 goto free_and_return; 248 goto free_and_return;
247 } 249 }
@@ -254,9 +256,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
254#ifdef CONFIG_9P_FS_POSIX_ACL 256#ifdef CONFIG_9P_FS_POSIX_ACL
255 v9ses->flags |= V9FS_POSIX_ACL; 257 v9ses->flags |= V9FS_POSIX_ACL;
256#else 258#else
257 P9_DPRINTK(P9_DEBUG_ERROR, 259 p9_debug(P9_DEBUG_ERROR,
258 "Not defined CONFIG_9P_FS_POSIX_ACL. " 260 "Not defined CONFIG_9P_FS_POSIX_ACL. Ignoring posixacl option\n");
259 "Ignoring posixacl option\n");
260#endif 261#endif
261 break; 262 break;
262 263
@@ -318,7 +319,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
318 if (IS_ERR(v9ses->clnt)) { 319 if (IS_ERR(v9ses->clnt)) {
319 retval = PTR_ERR(v9ses->clnt); 320 retval = PTR_ERR(v9ses->clnt);
320 v9ses->clnt = NULL; 321 v9ses->clnt = NULL;
321 P9_DPRINTK(P9_DEBUG_ERROR, "problem initializing 9p client\n"); 322 p9_debug(P9_DEBUG_ERROR, "problem initializing 9p client\n");
322 goto error; 323 goto error;
323 } 324 }
324 325
@@ -371,7 +372,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
371 if (IS_ERR(fid)) { 372 if (IS_ERR(fid)) {
372 retval = PTR_ERR(fid); 373 retval = PTR_ERR(fid);
373 fid = NULL; 374 fid = NULL;
374 P9_DPRINTK(P9_DEBUG_ERROR, "cannot attach\n"); 375 p9_debug(P9_DEBUG_ERROR, "cannot attach\n");
375 goto error; 376 goto error;
376 } 377 }
377 378
@@ -429,7 +430,7 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
429 */ 430 */
430 431
431void v9fs_session_cancel(struct v9fs_session_info *v9ses) { 432void v9fs_session_cancel(struct v9fs_session_info *v9ses) {
432 P9_DPRINTK(P9_DEBUG_ERROR, "cancel session %p\n", v9ses); 433 p9_debug(P9_DEBUG_ERROR, "cancel session %p\n", v9ses);
433 p9_client_disconnect(v9ses->clnt); 434 p9_client_disconnect(v9ses->clnt);
434} 435}
435 436
@@ -442,7 +443,7 @@ void v9fs_session_cancel(struct v9fs_session_info *v9ses) {
442 443
443void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses) 444void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses)
444{ 445{
445 P9_DPRINTK(P9_DEBUG_ERROR, "begin cancel session %p\n", v9ses); 446 p9_debug(P9_DEBUG_ERROR, "begin cancel session %p\n", v9ses);
446 p9_client_begin_disconnect(v9ses->clnt); 447 p9_client_begin_disconnect(v9ses->clnt);
447} 448}
448 449
@@ -591,23 +592,23 @@ static void v9fs_cache_unregister(void)
591static int __init init_v9fs(void) 592static int __init init_v9fs(void)
592{ 593{
593 int err; 594 int err;
594 printk(KERN_INFO "Installing v9fs 9p2000 file system support\n"); 595 pr_info("Installing v9fs 9p2000 file system support\n");
595 /* TODO: Setup list of registered trasnport modules */ 596 /* TODO: Setup list of registered trasnport modules */
596 err = register_filesystem(&v9fs_fs_type); 597 err = register_filesystem(&v9fs_fs_type);
597 if (err < 0) { 598 if (err < 0) {
598 printk(KERN_ERR "Failed to register filesystem\n"); 599 pr_err("Failed to register filesystem\n");
599 return err; 600 return err;
600 } 601 }
601 602
602 err = v9fs_cache_register(); 603 err = v9fs_cache_register();
603 if (err < 0) { 604 if (err < 0) {
604 printk(KERN_ERR "Failed to register v9fs for caching\n"); 605 pr_err("Failed to register v9fs for caching\n");
605 goto out_fs_unreg; 606 goto out_fs_unreg;
606 } 607 }
607 608
608 err = v9fs_sysfs_init(); 609 err = v9fs_sysfs_init();
609 if (err < 0) { 610 if (err < 0) {
610 printk(KERN_ERR "Failed to register with sysfs\n"); 611 pr_err("Failed to register with sysfs\n");
611 goto out_sysfs_cleanup; 612 goto out_sysfs_cleanup;
612 } 613 }
613 614