Commit 0f386a7074aa758720a4fc1fa26123044849bcc6

Authored by Linus Torvalds

Merge branch 'akpm' (incoming from Andrew)

Merge a few more patches from Andrew Morton:
 "A few leftovers"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  fs/ncpfs/dir.c: fix indenting in ncp_lookup()
  ncpfs/inode.c: fix mismatch printk formats and arguments
  ncpfs: remove now unused PRINTK macro
  ncpfs: convert PPRINTK to ncp_vdbg
  ncpfs: convert DPRINTK/DDPRINTK to ncp_dbg
  ncpfs: Add pr_fmt and convert printks to pr_<level>
  arch/x86/mm/kmemcheck/kmemcheck.c: use kstrtoint() instead of sscanf()
  lib/percpu_counter.c: fix bad percpu counter state during suspend
  autofs4: check dev ioctl size before allocating
  mm: vmscan: do not swap anon pages just because free+file is low

Showing 14 changed files Side-by-side Diff

arch/x86/mm/kmemcheck/kmemcheck.c
... ... @@ -78,10 +78,16 @@
78 78 */
79 79 static int __init param_kmemcheck(char *str)
80 80 {
  81 + int val;
  82 + int ret;
  83 +
81 84 if (!str)
82 85 return -EINVAL;
83 86  
84   - sscanf(str, "%d", &kmemcheck_enabled);
  87 + ret = kstrtoint(str, 0, &val);
  88 + if (ret)
  89 + return ret;
  90 + kmemcheck_enabled = val;
85 91 return 0;
86 92 }
87 93  
fs/autofs4/dev-ioctl.c
... ... @@ -103,6 +103,9 @@
103 103 if (tmp.size < sizeof(tmp))
104 104 return ERR_PTR(-EINVAL);
105 105  
  106 + if (tmp.size > (PATH_MAX + sizeof(tmp)))
  107 + return ERR_PTR(-ENAMETOOLONG);
  108 +
106 109 return memdup_user(in, tmp.size);
107 110 }
108 111  
... ... @@ -339,7 +339,7 @@
339 339 if (val)
340 340 goto finished;
341 341  
342   - DDPRINTK("ncp_lookup_validate: %pd2 not valid, age=%ld, server lookup\n",
  342 + ncp_dbg(2, "%pd2 not valid, age=%ld, server lookup\n",
343 343 dentry, NCP_GET_AGE(dentry));
344 344  
345 345 len = sizeof(__name);
... ... @@ -358,7 +358,7 @@
358 358 res = ncp_obtain_info(server, dir, __name, &(finfo.i));
359 359 }
360 360 finfo.volume = finfo.i.volNumber;
361   - DDPRINTK("ncp_lookup_validate: looked for %pd/%s, res=%d\n",
  361 + ncp_dbg(2, "looked for %pd/%s, res=%d\n",
362 362 dentry->d_parent, __name, res);
363 363 /*
364 364 * If we didn't find it, or if it has a different dirEntNum to
365 365  
... ... @@ -372,14 +372,14 @@
372 372 ncp_new_dentry(dentry);
373 373 val=1;
374 374 } else
375   - DDPRINTK("ncp_lookup_validate: found, but dirEntNum changed\n");
  375 + ncp_dbg(2, "found, but dirEntNum changed\n");
376 376  
377 377 ncp_update_inode2(inode, &finfo);
378 378 mutex_unlock(&inode->i_mutex);
379 379 }
380 380  
381 381 finished:
382   - DDPRINTK("ncp_lookup_validate: result=%d\n", val);
  382 + ncp_dbg(2, "result=%d\n", val);
383 383 dput(parent);
384 384 return val;
385 385 }
... ... @@ -453,8 +453,7 @@
453 453 ctl.page = NULL;
454 454 ctl.cache = NULL;
455 455  
456   - DDPRINTK("ncp_readdir: reading %pD2, pos=%d\n", file,
457   - (int) ctx->pos);
  456 + ncp_dbg(2, "reading %pD2, pos=%d\n", file, (int)ctx->pos);
458 457  
459 458 result = -EIO;
460 459 /* Do not generate '.' and '..' when server is dead. */
... ... @@ -697,8 +696,7 @@
697 696 struct ncp_entry_info entry;
698 697 int i;
699 698  
700   - DPRINTK("ncp_read_volume_list: pos=%ld\n",
701   - (unsigned long) ctx->pos);
  699 + ncp_dbg(1, "pos=%ld\n", (unsigned long)ctx->pos);
702 700  
703 701 for (i = 0; i < NCP_NUMBER_OF_VOLUMES; i++) {
704 702 int inval_dentry;
705 703  
... ... @@ -708,12 +706,11 @@
708 706 if (!strlen(info.volume_name))
709 707 continue;
710 708  
711   - DPRINTK("ncp_read_volume_list: found vol: %s\n",
712   - info.volume_name);
  709 + ncp_dbg(1, "found vol: %s\n", info.volume_name);
713 710  
714 711 if (ncp_lookup_volume(server, info.volume_name,
715 712 &entry.i)) {
716   - DPRINTK("ncpfs: could not lookup vol %s\n",
  713 + ncp_dbg(1, "could not lookup vol %s\n",
717 714 info.volume_name);
718 715 continue;
719 716 }
720 717  
... ... @@ -738,14 +735,13 @@
738 735 int more;
739 736 size_t bufsize;
740 737  
741   - DPRINTK("ncp_do_readdir: %pD2, fpos=%ld\n", file,
742   - (unsigned long) ctx->pos);
743   - PPRINTK("ncp_do_readdir: init %pD, volnum=%d, dirent=%u\n",
744   - file, NCP_FINFO(dir)->volNumber, NCP_FINFO(dir)->dirEntNum);
  738 + ncp_dbg(1, "%pD2, fpos=%ld\n", file, (unsigned long)ctx->pos);
  739 + ncp_vdbg("init %pD, volnum=%d, dirent=%u\n",
  740 + file, NCP_FINFO(dir)->volNumber, NCP_FINFO(dir)->dirEntNum);
745 741  
746 742 err = ncp_initialize_search(server, dir, &seq);
747 743 if (err) {
748   - DPRINTK("ncp_do_readdir: init failed, err=%d\n", err);
  744 + ncp_dbg(1, "init failed, err=%d\n", err);
749 745 return;
750 746 }
751 747 /* We MUST NOT use server->buffer_size handshaked with server if we are
... ... @@ -808,8 +804,7 @@
808 804 goto out;
809 805 result = -ENOENT;
810 806 if (ncp_get_volume_root(server, __name, &volNumber, &dirEntNum, &DosDirNum)) {
811   - PPRINTK("ncp_conn_logged_in: %s not found\n",
812   - server->m.mounted_vol);
  807 + ncp_vdbg("%s not found\n", server->m.mounted_vol);
813 808 goto out;
814 809 }
815 810 dent = sb->s_root;
816 811  
... ... @@ -822,10 +817,10 @@
822 817 NCP_FINFO(ino)->DosDirNum = DosDirNum;
823 818 result = 0;
824 819 } else {
825   - DPRINTK("ncpfs: sb->s_root->d_inode == NULL!\n");
  820 + ncp_dbg(1, "sb->s_root->d_inode == NULL!\n");
826 821 }
827 822 } else {
828   - DPRINTK("ncpfs: sb->s_root == NULL!\n");
  823 + ncp_dbg(1, "sb->s_root == NULL!\n");
829 824 }
830 825 } else
831 826 result = 0;
... ... @@ -846,7 +841,7 @@
846 841 if (!ncp_conn_valid(server))
847 842 goto finished;
848 843  
849   - PPRINTK("ncp_lookup: server lookup for %pd2\n", dentry);
  844 + ncp_vdbg("server lookup for %pd2\n", dentry);
850 845  
851 846 len = sizeof(__name);
852 847 if (ncp_is_server_root(dir)) {
853 848  
... ... @@ -854,15 +849,15 @@
854 849 dentry->d_name.len, 1);
855 850 if (!res)
856 851 res = ncp_lookup_volume(server, __name, &(finfo.i));
857   - if (!res)
858   - ncp_update_known_namespace(server, finfo.i.volNumber, NULL);
  852 + if (!res)
  853 + ncp_update_known_namespace(server, finfo.i.volNumber, NULL);
859 854 } else {
860 855 res = ncp_io2vol(server, __name, &len, dentry->d_name.name,
861 856 dentry->d_name.len, !ncp_preserve_case(dir));
862 857 if (!res)
863 858 res = ncp_obtain_info(server, dir, __name, &(finfo.i));
864 859 }
865   - PPRINTK("ncp_lookup: looked for %pd2, res=%d\n", dentry, res);
  860 + ncp_vdbg("looked for %pd2, res=%d\n", dentry, res);
866 861 /*
867 862 * If we didn't find an entry, make a negative dentry.
868 863 */
... ... @@ -886,7 +881,7 @@
886 881 }
887 882  
888 883 finished:
889   - PPRINTK("ncp_lookup: result=%d\n", error);
  884 + ncp_vdbg("result=%d\n", error);
890 885 return ERR_PTR(error);
891 886 }
892 887  
... ... @@ -909,7 +904,7 @@
909 904 return error;
910 905  
911 906 out_close:
912   - PPRINTK("ncp_instantiate: %pd2 failed, closing file\n", dentry);
  907 + ncp_vdbg("%pd2 failed, closing file\n", dentry);
913 908 ncp_close_file(NCP_SERVER(dir), finfo->file_handle);
914 909 goto out;
915 910 }
... ... @@ -923,7 +918,7 @@
923 918 int opmode;
924 919 __u8 __name[NCP_MAXPATHLEN + 1];
925 920  
926   - PPRINTK("ncp_create_new: creating %pd2, mode=%hx\n", dentry, mode);
  921 + ncp_vdbg("creating %pd2, mode=%hx\n", dentry, mode);
927 922  
928 923 ncp_age_dentry(server, dentry);
929 924 len = sizeof(__name);
... ... @@ -952,7 +947,7 @@
952 947 error = -ENAMETOOLONG;
953 948 else if (result < 0)
954 949 error = result;
955   - DPRINTK("ncp_create: %pd2 failed\n", dentry);
  950 + ncp_dbg(1, "%pd2 failed\n", dentry);
956 951 goto out;
957 952 }
958 953 opmode = O_WRONLY;
... ... @@ -985,7 +980,7 @@
985 980 int error, len;
986 981 __u8 __name[NCP_MAXPATHLEN + 1];
987 982  
988   - DPRINTK("ncp_mkdir: making %pd2\n", dentry);
  983 + ncp_dbg(1, "making %pd2\n", dentry);
989 984  
990 985 ncp_age_dentry(server, dentry);
991 986 len = sizeof(__name);
... ... @@ -1022,7 +1017,7 @@
1022 1017 int error, result, len;
1023 1018 __u8 __name[NCP_MAXPATHLEN + 1];
1024 1019  
1025   - DPRINTK("ncp_rmdir: removing %pd2\n", dentry);
  1020 + ncp_dbg(1, "removing %pd2\n", dentry);
1026 1021  
1027 1022 len = sizeof(__name);
1028 1023 error = ncp_io2vol(server, __name, &len, dentry->d_name.name,
1029 1024  
... ... @@ -1067,13 +1062,13 @@
1067 1062 int error;
1068 1063  
1069 1064 server = NCP_SERVER(dir);
1070   - DPRINTK("ncp_unlink: unlinking %pd2\n", dentry);
  1065 + ncp_dbg(1, "unlinking %pd2\n", dentry);
1071 1066  
1072 1067 /*
1073 1068 * Check whether to close the file ...
1074 1069 */
1075 1070 if (inode) {
1076   - PPRINTK("ncp_unlink: closing file\n");
  1071 + ncp_vdbg("closing file\n");
1077 1072 ncp_make_closed(inode);
1078 1073 }
1079 1074  
... ... @@ -1087,7 +1082,7 @@
1087 1082 #endif
1088 1083 switch (error) {
1089 1084 case 0x00:
1090   - DPRINTK("ncp: removed %pd2\n", dentry);
  1085 + ncp_dbg(1, "removed %pd2\n", dentry);
1091 1086 break;
1092 1087 case 0x85:
1093 1088 case 0x8A:
... ... @@ -1120,7 +1115,7 @@
1120 1115 int old_len, new_len;
1121 1116 __u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1];
1122 1117  
1123   - DPRINTK("ncp_rename: %pd2 to %pd2\n", old_dentry, new_dentry);
  1118 + ncp_dbg(1, "%pd2 to %pd2\n", old_dentry, new_dentry);
1124 1119  
1125 1120 ncp_age_dentry(server, old_dentry);
1126 1121 ncp_age_dentry(server, new_dentry);
... ... @@ -1150,8 +1145,8 @@
1150 1145 #endif
1151 1146 switch (error) {
1152 1147 case 0x00:
1153   - DPRINTK("ncp renamed %pd -> %pd.\n",
1154   - old_dentry, new_dentry);
  1148 + ncp_dbg(1, "renamed %pd -> %pd\n",
  1149 + old_dentry, new_dentry);
1155 1150 break;
1156 1151 case 0x9E:
1157 1152 error = -ENAMETOOLONG;
... ... @@ -1173,7 +1168,7 @@
1173 1168 if (!new_valid_dev(rdev))
1174 1169 return -EINVAL;
1175 1170 if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber)) {
1176   - DPRINTK(KERN_DEBUG "ncp_mknod: mode = 0%ho\n", mode);
  1171 + ncp_dbg(1, "mode = 0%ho\n", mode);
1177 1172 return ncp_create_new(dir, dentry, mode, rdev, 0);
1178 1173 }
1179 1174 return -EPERM; /* Strange, but true */
... ... @@ -6,6 +6,8 @@
6 6 *
7 7 */
8 8  
  9 +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  10 +
9 11 #include <asm/uaccess.h>
10 12  
11 13 #include <linux/time.h>
12 14  
... ... @@ -34,11 +36,11 @@
34 36  
35 37 error = -EINVAL;
36 38 if (!inode) {
37   - printk(KERN_ERR "ncp_make_open: got NULL inode\n");
  39 + pr_err("%s: got NULL inode\n", __func__);
38 40 goto out;
39 41 }
40 42  
41   - DPRINTK("ncp_make_open: opened=%d, volume # %u, dir entry # %u\n",
  43 + ncp_dbg(1, "opened=%d, volume # %u, dir entry # %u\n",
42 44 atomic_read(&NCP_FINFO(inode)->opened),
43 45 NCP_FINFO(inode)->volNumber,
44 46 NCP_FINFO(inode)->dirEntNum);
... ... @@ -71,7 +73,7 @@
71 73 break;
72 74 }
73 75 if (result) {
74   - PPRINTK("ncp_make_open: failed, result=%d\n", result);
  76 + ncp_vdbg("failed, result=%d\n", result);
75 77 goto out_unlock;
76 78 }
77 79 /*
... ... @@ -83,7 +85,7 @@
83 85 }
84 86  
85 87 access = NCP_FINFO(inode)->access;
86   - PPRINTK("ncp_make_open: file open, access=%x\n", access);
  88 + ncp_vdbg("file open, access=%x\n", access);
87 89 if (access == right || access == O_RDWR) {
88 90 atomic_inc(&NCP_FINFO(inode)->opened);
89 91 error = 0;
... ... @@ -107,7 +109,7 @@
107 109 void* freepage;
108 110 size_t freelen;
109 111  
110   - DPRINTK("ncp_file_read: enter %pd2\n", dentry);
  112 + ncp_dbg(1, "enter %pd2\n", dentry);
111 113  
112 114 pos = *ppos;
113 115  
... ... @@ -124,7 +126,7 @@
124 126  
125 127 error = ncp_make_open(inode, O_RDONLY);
126 128 if (error) {
127   - DPRINTK(KERN_ERR "ncp_file_read: open failed, error=%d\n", error);
  129 + ncp_dbg(1, "open failed, error=%d\n", error);
128 130 return error;
129 131 }
130 132  
... ... @@ -165,7 +167,7 @@
165 167  
166 168 file_accessed(file);
167 169  
168   - DPRINTK("ncp_file_read: exit %pd2\n", dentry);
  170 + ncp_dbg(1, "exit %pd2\n", dentry);
169 171 outrel:
170 172 ncp_inode_close(inode);
171 173 return already_read ? already_read : error;
... ... @@ -182,7 +184,7 @@
182 184 int errno;
183 185 void* bouncebuffer;
184 186  
185   - DPRINTK("ncp_file_write: enter %pd2\n", dentry);
  187 + ncp_dbg(1, "enter %pd2\n", dentry);
186 188 if ((ssize_t) count < 0)
187 189 return -EINVAL;
188 190 pos = *ppos;
... ... @@ -211,7 +213,7 @@
211 213 return 0;
212 214 errno = ncp_make_open(inode, O_WRONLY);
213 215 if (errno) {
214   - DPRINTK(KERN_ERR "ncp_file_write: open failed, error=%d\n", errno);
  216 + ncp_dbg(1, "open failed, error=%d\n", errno);
215 217 return errno;
216 218 }
217 219 bufsize = NCP_SERVER(inode)->buffer_size;
... ... @@ -261,7 +263,7 @@
261 263 i_size_write(inode, pos);
262 264 mutex_unlock(&inode->i_mutex);
263 265 }
264   - DPRINTK("ncp_file_write: exit %pd2\n", dentry);
  266 + ncp_dbg(1, "exit %pd2\n", dentry);
265 267 outrel:
266 268 ncp_inode_close(inode);
267 269 return already_written ? already_written : errno;
... ... @@ -269,7 +271,7 @@
269 271  
270 272 static int ncp_release(struct inode *inode, struct file *file) {
271 273 if (ncp_make_closed(inode)) {
272   - DPRINTK("ncp_release: failed to close\n");
  274 + ncp_dbg(1, "failed to close\n");
273 275 }
274 276 return 0;
275 277 }
... ... @@ -2,6 +2,8 @@
2 2 * getopt.c
3 3 */
4 4  
  5 +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  6 +
5 7 #include <linux/kernel.h>
6 8 #include <linux/string.h>
7 9  
... ... @@ -46,8 +48,8 @@
46 48 if (opts->has_arg & OPT_NOPARAM) {
47 49 return opts->val;
48 50 }
49   - printk(KERN_INFO "%s: the %s option requires an argument\n",
50   - caller, token);
  51 + pr_info("%s: the %s option requires an argument\n",
  52 + caller, token);
51 53 return -EINVAL;
52 54 }
53 55 if (opts->has_arg & OPT_INT) {
54 56  
55 57  
... ... @@ -57,19 +59,19 @@
57 59 if (!*v) {
58 60 return opts->val;
59 61 }
60   - printk(KERN_INFO "%s: invalid numeric value in %s=%s\n",
  62 + pr_info("%s: invalid numeric value in %s=%s\n",
61 63 caller, token, val);
62 64 return -EDOM;
63 65 }
64 66 if (opts->has_arg & OPT_STRING) {
65 67 return opts->val;
66 68 }
67   - printk(KERN_INFO "%s: unexpected argument %s to the %s option\n",
  69 + pr_info("%s: unexpected argument %s to the %s option\n",
68 70 caller, val, token);
69 71 return -EINVAL;
70 72 }
71 73 }
72   - printk(KERN_INFO "%s: Unrecognized mount option %s\n", caller, token);
  74 + pr_info("%s: Unrecognized mount option %s\n", caller, token);
73 75 return -EOPNOTSUPP;
74 76 }
... ... @@ -9,6 +9,8 @@
9 9 *
10 10 */
11 11  
  12 +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  13 +
12 14 #include <linux/module.h>
13 15  
14 16 #include <asm/uaccess.h>
... ... @@ -133,7 +135,7 @@
133 135 NCP_FINFO(inode)->access = nwinfo->access;
134 136 memcpy(NCP_FINFO(inode)->file_handle, nwinfo->file_handle,
135 137 sizeof(nwinfo->file_handle));
136   - DPRINTK("ncp_update_inode: updated %s, volnum=%d, dirent=%u\n",
  138 + ncp_dbg(1, "updated %s, volnum=%d, dirent=%u\n",
137 139 nwinfo->i.entryName, NCP_FINFO(inode)->volNumber,
138 140 NCP_FINFO(inode)->dirEntNum);
139 141 }
... ... @@ -141,8 +143,7 @@
141 143 static void ncp_update_dates(struct inode *inode, struct nw_info_struct *nwi)
142 144 {
143 145 /* NFS namespace mode overrides others if it's set. */
144   - DPRINTK(KERN_DEBUG "ncp_update_dates_and_mode: (%s) nfs.mode=0%o\n",
145   - nwi->entryName, nwi->nfs.mode);
  146 + ncp_dbg(1, "(%s) nfs.mode=0%o\n", nwi->entryName, nwi->nfs.mode);
146 147 if (nwi->nfs.mode) {
147 148 /* XXX Security? */
148 149 inode->i_mode = nwi->nfs.mode;
... ... @@ -230,7 +231,7 @@
230 231  
231 232 ncp_update_attrs(inode, nwinfo);
232 233  
233   - DDPRINTK("ncp_read_inode: inode->i_mode = %u\n", inode->i_mode);
  234 + ncp_dbg(2, "inode->i_mode = %u\n", inode->i_mode);
234 235  
235 236 set_nlink(inode, 1);
236 237 inode->i_uid = server->m.uid;
... ... @@ -258,7 +259,7 @@
258 259 struct inode *inode;
259 260  
260 261 if (info == NULL) {
261   - printk(KERN_ERR "ncp_iget: info is NULL\n");
  262 + pr_err("%s: info is NULL\n", __func__);
262 263 return NULL;
263 264 }
264 265  
... ... @@ -290,7 +291,7 @@
290 291 }
291 292 insert_inode_hash(inode);
292 293 } else
293   - printk(KERN_ERR "ncp_iget: iget failed!\n");
  294 + pr_err("%s: iget failed!\n", __func__);
294 295 return inode;
295 296 }
296 297  
297 298  
... ... @@ -301,12 +302,12 @@
301 302 clear_inode(inode);
302 303  
303 304 if (S_ISDIR(inode->i_mode)) {
304   - DDPRINTK("ncp_evict_inode: put directory %ld\n", inode->i_ino);
  305 + ncp_dbg(2, "put directory %ld\n", inode->i_ino);
305 306 }
306 307  
307 308 if (ncp_make_closed(inode) != 0) {
308 309 /* We can't do anything but complain. */
309   - printk(KERN_ERR "ncp_evict_inode: could not close\n");
  310 + pr_err("%s: could not close\n", __func__);
310 311 }
311 312 }
312 313  
... ... @@ -621,7 +622,7 @@
621 622 now because of PATH_MAX changes.. */
622 623 if (server->m.time_out < 1) {
623 624 server->m.time_out = 10;
624   - printk(KERN_INFO "You need to recompile your ncpfs utils..\n");
  625 + pr_info("You need to recompile your ncpfs utils..\n");
625 626 }
626 627 server->m.time_out = server->m.time_out * HZ / 100;
627 628 server->m.file_mode = (server->m.file_mode & S_IRWXUGO) | S_IFREG;
... ... @@ -682,7 +683,7 @@
682 683 ncp_unlock_server(server);
683 684 if (error < 0)
684 685 goto out_rxbuf;
685   - DPRINTK("ncp_fill_super: NCP_SBP(sb) = %x\n", (int) NCP_SBP(sb));
  686 + ncp_dbg(1, "NCP_SBP(sb) = %p\n", NCP_SBP(sb));
686 687  
687 688 error = -EMSGSIZE; /* -EREMOTESIDEINCOMPATIBLE */
688 689 #ifdef CONFIG_NCPFS_PACKET_SIGNING
... ... @@ -710,7 +711,7 @@
710 711 if (ncp_negotiate_buffersize(server, default_bufsize,
711 712 &(server->buffer_size)) != 0)
712 713 goto out_disconnect;
713   - DPRINTK("ncpfs: bufsize = %d\n", server->buffer_size);
  714 + ncp_dbg(1, "bufsize = %d\n", server->buffer_size);
714 715  
715 716 memset(&finfo, 0, sizeof(finfo));
716 717 finfo.i.attributes = aDIR;
... ... @@ -739,7 +740,7 @@
739 740 root_inode = ncp_iget(sb, &finfo);
740 741 if (!root_inode)
741 742 goto out_disconnect;
742   - DPRINTK("ncp_fill_super: root vol=%d\n", NCP_FINFO(root_inode)->volNumber);
  743 + ncp_dbg(1, "root vol=%d\n", NCP_FINFO(root_inode)->volNumber);
743 744 sb->s_root = d_make_root(root_inode);
744 745 if (!sb->s_root)
745 746 goto out_disconnect;
... ... @@ -985,8 +986,7 @@
985 986 if ((attr->ia_valid & ATTR_SIZE) != 0) {
986 987 int written;
987 988  
988   - DPRINTK("ncpfs: trying to change size to %ld\n",
989   - attr->ia_size);
  989 + ncp_dbg(1, "trying to change size to %llu\n", attr->ia_size);
990 990  
991 991 if ((result = ncp_make_open(inode, O_WRONLY)) < 0) {
992 992 result = -EACCES;
... ... @@ -1072,7 +1072,7 @@
1072 1072 static int __init init_ncp_fs(void)
1073 1073 {
1074 1074 int err;
1075   - DPRINTK("ncpfs: init_ncp_fs called\n");
  1075 + ncp_dbg(1, "called\n");
1076 1076  
1077 1077 err = init_inodecache();
1078 1078 if (err)
... ... @@ -1089,7 +1089,7 @@
1089 1089  
1090 1090 static void __exit exit_ncp_fs(void)
1091 1091 {
1092   - DPRINTK("ncpfs: exit_ncp_fs called\n");
  1092 + ncp_dbg(1, "called\n");
1093 1093 unregister_filesystem(&ncp_fs_type);
1094 1094 destroy_inodecache();
1095 1095 }
... ... @@ -41,7 +41,7 @@
41 41 return -EFAULT;
42 42  
43 43 if (info.version != NCP_GET_FS_INFO_VERSION) {
44   - DPRINTK("info.version invalid: %d\n", info.version);
  44 + ncp_dbg(1, "info.version invalid: %d\n", info.version);
45 45 return -EINVAL;
46 46 }
47 47 /* TODO: info.addr = server->m.serv_addr; */
... ... @@ -66,7 +66,7 @@
66 66 return -EFAULT;
67 67  
68 68 if (info2.version != NCP_GET_FS_INFO_VERSION_V2) {
69   - DPRINTK("info.version invalid: %d\n", info2.version);
  69 + ncp_dbg(1, "info.version invalid: %d\n", info2.version);
70 70 return -EINVAL;
71 71 }
72 72 info2.mounted_uid = from_kuid_munged(current_user_ns(), server->m.mounted_uid);
... ... @@ -132,7 +132,7 @@
132 132 return -EFAULT;
133 133  
134 134 if (info2.version != NCP_GET_FS_INFO_VERSION_V2) {
135   - DPRINTK("info.version invalid: %d\n", info2.version);
  135 + ncp_dbg(1, "info.version invalid: %d\n", info2.version);
136 136 return -EINVAL;
137 137 }
138 138 info2.mounted_uid = from_kuid_munged(current_user_ns(), server->m.mounted_uid);
... ... @@ -308,8 +308,7 @@
308 308 else
309 309 result = server->reply_size;
310 310 ncp_unlock_server(server);
311   - DPRINTK("ncp_ioctl: copy %d bytes\n",
312   - result);
  311 + ncp_dbg(1, "copy %d bytes\n", result);
313 312 if (result >= 0)
314 313 if (copy_to_user(request.data, bouncebuffer, result))
315 314 result = -EFAULT;
316 315  
... ... @@ -385,9 +384,9 @@
385 384 sr.namespace = server->name_space[sr.volNumber];
386 385 result = 0;
387 386 } else
388   - DPRINTK("ncpfs: s_root->d_inode==NULL\n");
  387 + ncp_dbg(1, "s_root->d_inode==NULL\n");
389 388 } else
390   - DPRINTK("ncpfs: s_root==NULL\n");
  389 + ncp_dbg(1, "s_root==NULL\n");
391 390 } else {
392 391 sr.volNumber = -1;
393 392 sr.namespace = 0;
394 393  
... ... @@ -440,11 +439,11 @@
440 439 NCP_FINFO(s_inode)->DosDirNum = dosde;
441 440 server->root_setuped = 1;
442 441 } else {
443   - DPRINTK("ncpfs: s_root->d_inode==NULL\n");
  442 + ncp_dbg(1, "s_root->d_inode==NULL\n");
444 443 result = -EIO;
445 444 }
446 445 } else {
447   - DPRINTK("ncpfs: s_root==NULL\n");
  446 + ncp_dbg(1, "s_root==NULL\n");
448 447 result = -EIO;
449 448 }
450 449 }
... ... @@ -107,7 +107,7 @@
107 107 {
108 108 struct inode *inode = file_inode(file);
109 109  
110   - DPRINTK("ncp_mmap: called\n");
  110 + ncp_dbg(1, "called\n");
111 111  
112 112 if (!ncp_conn_valid(NCP_SERVER(inode)))
113 113 return -EIO;
... ... @@ -2,29 +2,31 @@
2 2 #include "ncp_fs_i.h"
3 3 #include "ncp_fs_sb.h"
4 4  
5   -/* define because it is easy to change PRINTK to {*}PRINTK */
6   -#define PRINTK(format, args...) printk(KERN_DEBUG format , ## args)
7   -
8 5 #undef NCPFS_PARANOIA
9 6 #ifdef NCPFS_PARANOIA
10   -#define PPRINTK(format, args...) PRINTK(format , ## args)
  7 +#define ncp_vdbg(fmt, ...) \
  8 + pr_debug(fmt, ##__VA_ARGS__)
11 9 #else
12   -#define PPRINTK(format, args...)
  10 +#define ncp_vdbg(fmt, ...) \
  11 +do { \
  12 + if (0) \
  13 + pr_debug(fmt, ##__VA_ARGS__); \
  14 +} while (0)
13 15 #endif
14 16  
15 17 #ifndef DEBUG_NCP
16 18 #define DEBUG_NCP 0
17 19 #endif
18   -#if DEBUG_NCP > 0
19   -#define DPRINTK(format, args...) PRINTK(format , ## args)
20   -#else
21   -#define DPRINTK(format, args...)
  20 +
  21 +#if DEBUG_NCP > 0 && !defined(DEBUG)
  22 +#define DEBUG
22 23 #endif
23   -#if DEBUG_NCP > 1
24   -#define DDPRINTK(format, args...) PRINTK(format , ## args)
25   -#else
26   -#define DDPRINTK(format, args...)
27   -#endif
  24 +
  25 +#define ncp_dbg(level, fmt, ...) \
  26 +do { \
  27 + if (level <= DEBUG_NCP) \
  28 + pr_debug(fmt, ##__VA_ARGS__); \
  29 +} while (0)
28 30  
29 31 #define NCP_MAX_RPC_TIMEOUT (6*HZ)
30 32  
fs/ncpfs/ncplib_kernel.c
... ... @@ -9,14 +9,14 @@
9 9 *
10 10 */
11 11  
  12 +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
12 13  
13   -
14 14 #include "ncp_fs.h"
15 15  
16 16 static inline void assert_server_locked(struct ncp_server *server)
17 17 {
18 18 if (server->lock == 0) {
19   - DPRINTK("ncpfs: server not locked!\n");
  19 + ncp_dbg(1, "server not locked!\n");
20 20 }
21 21 }
22 22  
... ... @@ -75,7 +75,7 @@
75 75 int len = strlen(s);
76 76 assert_server_locked(server);
77 77 if (len > 255) {
78   - DPRINTK("ncpfs: string too long: %s\n", s);
  78 + ncp_dbg(1, "string too long: %s\n", s);
79 79 len = 255;
80 80 }
81 81 ncp_add_byte(server, len);
... ... @@ -225,7 +225,7 @@
225 225 result = -EIO;
226 226 len = ncp_reply_byte(server, 29);
227 227 if (len > NCP_VOLNAME_LEN) {
228   - DPRINTK("ncpfs: volume name too long: %d\n", len);
  228 + ncp_dbg(1, "volume name too long: %d\n", len);
229 229 goto out;
230 230 }
231 231 memcpy(&(target->volume_name), ncp_reply_data(server, 30), len);
... ... @@ -259,7 +259,7 @@
259 259 result = -EIO;
260 260 len = ncp_reply_byte(server, 21);
261 261 if (len > NCP_VOLNAME_LEN) {
262   - DPRINTK("ncpfs: volume name too long: %d\n", len);
  262 + ncp_dbg(1, "volume name too long: %d\n", len);
263 263 goto out;
264 264 }
265 265 memcpy(&(target->volume_name), ncp_reply_data(server, 22), len);
... ... @@ -295,9 +295,9 @@
295 295 err = ncp_close_file(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle);
296 296  
297 297 if (!err)
298   - PPRINTK("ncp_make_closed: volnum=%d, dirent=%u, error=%d\n",
299   - NCP_FINFO(inode)->volNumber,
300   - NCP_FINFO(inode)->dirEntNum, err);
  298 + ncp_vdbg("volnum=%d, dirent=%u, error=%d\n",
  299 + NCP_FINFO(inode)->volNumber,
  300 + NCP_FINFO(inode)->dirEntNum, err);
301 301 }
302 302 mutex_unlock(&NCP_FINFO(inode)->open_mutex);
303 303 return err;
... ... @@ -394,8 +394,7 @@
394 394  
395 395 if ((result = ncp_request(server, 87)) == 0) {
396 396 ncp_extract_nfs_info(ncp_reply_data(server, 0), &target->nfs);
397   - DPRINTK(KERN_DEBUG
398   - "ncp_obtain_nfs_info: (%s) mode=0%o, rdev=0x%x\n",
  397 + ncp_dbg(1, "(%s) mode=0%o, rdev=0x%x\n",
399 398 target->entryName, target->nfs.mode,
400 399 target->nfs.rdev);
401 400 } else {
... ... @@ -425,7 +424,7 @@
425 424 int result;
426 425  
427 426 if (target == NULL) {
428   - printk(KERN_ERR "ncp_obtain_info: invalid call\n");
  427 + pr_err("%s: invalid call\n", __func__);
429 428 return -EINVAL;
430 429 }
431 430 ncp_init_request(server);
... ... @@ -498,7 +497,7 @@
498 497 namespace = ncp_reply_data(server, 2);
499 498  
500 499 while (no_namespaces > 0) {
501   - DPRINTK("get_namespaces: found %d on %d\n", *namespace, volume);
  500 + ncp_dbg(1, "found %d on %d\n", *namespace, volume);
502 501  
503 502 #ifdef CONFIG_NCPFS_NFS_NS
504 503 if ((*namespace == NW_NS_NFS) && !(server->m.flags&NCP_MOUNT_NO_NFS))
... ... @@ -531,8 +530,7 @@
531 530 if (ret_ns)
532 531 *ret_ns = ns;
533 532  
534   - DPRINTK("lookup_vol: namespace[%d] = %d\n",
535   - volume, server->name_space[volume]);
  533 + ncp_dbg(1, "namespace[%d] = %d\n", volume, server->name_space[volume]);
536 534  
537 535 if (server->name_space[volume] == ns)
538 536 return 0;
... ... @@ -596,7 +594,7 @@
596 594 {
597 595 int result;
598 596  
599   - DPRINTK("ncp_get_volume_root: looking up vol %s\n", volname);
  597 + ncp_dbg(1, "looking up vol %s\n", volname);
600 598  
601 599 ncp_init_request(server);
602 600 ncp_add_byte(server, 22); /* Subfunction: Generate dir handle */
... ... @@ -8,6 +8,7 @@
8 8 *
9 9 */
10 10  
  11 +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
11 12  
12 13 #include <linux/time.h>
13 14 #include <linux/errno.h>
... ... @@ -231,7 +232,7 @@
231 232 return;
232 233  
233 234 if (result < 0) {
234   - printk(KERN_ERR "ncpfs: tcp: Send failed: %d\n", result);
  235 + pr_err("tcp: Send failed: %d\n", result);
235 236 __ncp_abort_request(server, rq, result);
236 237 return;
237 238 }
... ... @@ -332,7 +333,7 @@
332 333 mutex_lock(&server->rcv.creq_mutex);
333 334 if (!ncp_conn_valid(server)) {
334 335 mutex_unlock(&server->rcv.creq_mutex);
335   - printk(KERN_ERR "ncpfs: tcp: Server died\n");
  336 + pr_err("tcp: Server died\n");
336 337 return -EIO;
337 338 }
338 339 ncp_req_get(req);
339 340  
340 341  
... ... @@ -405,15 +406,15 @@
405 406 }
406 407 result = _recv(sock, buf, sizeof(buf), MSG_DONTWAIT);
407 408 if (result < 0) {
408   - DPRINTK("recv failed with %d\n", result);
  409 + ncp_dbg(1, "recv failed with %d\n", result);
409 410 continue;
410 411 }
411 412 if (result < 10) {
412   - DPRINTK("too short (%u) watchdog packet\n", result);
  413 + ncp_dbg(1, "too short (%u) watchdog packet\n", result);
413 414 continue;
414 415 }
415 416 if (buf[9] != '?') {
416   - DPRINTK("bad signature (%02X) in watchdog packet\n", buf[9]);
  417 + ncp_dbg(1, "bad signature (%02X) in watchdog packet\n", buf[9]);
417 418 continue;
418 419 }
419 420 buf[9] = 'Y';
... ... @@ -448,7 +449,7 @@
448 449 result -= 8;
449 450 hdrl = sock->sk->sk_family == AF_INET ? 8 : 6;
450 451 if (sign_verify_reply(server, server->rxbuf + hdrl, result - hdrl, cpu_to_le32(result), server->rxbuf + result)) {
451   - printk(KERN_INFO "ncpfs: Signature violation\n");
  452 + pr_info("Signature violation\n");
452 453 result = -EIO;
453 454 }
454 455 }
... ... @@ -524,7 +525,7 @@
524 525 return result;
525 526 }
526 527 if (result > len) {
527   - printk(KERN_ERR "ncpfs: tcp: bug in recvmsg (%u > %Zu)\n", result, len);
  528 + pr_err("tcp: bug in recvmsg (%u > %Zu)\n", result, len);
528 529 return -EIO;
529 530 }
530 531 return result;
531 532  
... ... @@ -552,9 +553,9 @@
552 553 __ncptcp_abort(server);
553 554 }
554 555 if (result < 0) {
555   - printk(KERN_ERR "ncpfs: tcp: error in recvmsg: %d\n", result);
  556 + pr_err("tcp: error in recvmsg: %d\n", result);
556 557 } else {
557   - DPRINTK(KERN_ERR "ncpfs: tcp: EOF\n");
  558 + ncp_dbg(1, "tcp: EOF\n");
558 559 }
559 560 return -EIO;
560 561 }
561 562  
562 563  
... ... @@ -566,20 +567,20 @@
566 567 switch (server->rcv.state) {
567 568 case 0:
568 569 if (server->rcv.buf.magic != htonl(NCP_TCP_RCVD_MAGIC)) {
569   - printk(KERN_ERR "ncpfs: tcp: Unexpected reply type %08X\n", ntohl(server->rcv.buf.magic));
  570 + pr_err("tcp: Unexpected reply type %08X\n", ntohl(server->rcv.buf.magic));
570 571 __ncptcp_abort(server);
571 572 return -EIO;
572 573 }
573 574 datalen = ntohl(server->rcv.buf.len) & 0x0FFFFFFF;
574 575 if (datalen < 10) {
575   - printk(KERN_ERR "ncpfs: tcp: Unexpected reply len %d\n", datalen);
  576 + pr_err("tcp: Unexpected reply len %d\n", datalen);
576 577 __ncptcp_abort(server);
577 578 return -EIO;
578 579 }
579 580 #ifdef CONFIG_NCPFS_PACKET_SIGNING
580 581 if (server->sign_active) {
581 582 if (datalen < 18) {
582   - printk(KERN_ERR "ncpfs: tcp: Unexpected reply len %d\n", datalen);
  583 + pr_err("tcp: Unexpected reply len %d\n", datalen);
583 584 __ncptcp_abort(server);
584 585 return -EIO;
585 586 }
... ... @@ -604,7 +605,7 @@
604 605 server->rcv.len = datalen - 10;
605 606 break;
606 607 }
607   - DPRINTK("ncpfs: tcp: Unexpected NCP type %02X\n", type);
  608 + ncp_dbg(1, "tcp: Unexpected NCP type %02X\n", type);
608 609 skipdata2:;
609 610 server->rcv.state = 2;
610 611 skipdata:;
611 612  
... ... @@ -614,11 +615,11 @@
614 615 }
615 616 req = server->rcv.creq;
616 617 if (!req) {
617   - DPRINTK(KERN_ERR "ncpfs: Reply without appropriate request\n");
  618 + ncp_dbg(1, "Reply without appropriate request\n");
618 619 goto skipdata2;
619 620 }
620 621 if (datalen > req->datalen + 8) {
621   - printk(KERN_ERR "ncpfs: tcp: Unexpected reply len %d (expected at most %Zd)\n", datalen, req->datalen + 8);
  622 + pr_err("tcp: Unexpected reply len %d (expected at most %Zd)\n", datalen, req->datalen + 8);
622 623 server->rcv.state = 3;
623 624 goto skipdata;
624 625 }
625 626  
... ... @@ -638,12 +639,12 @@
638 639 req = server->rcv.creq;
639 640 if (req->tx_type != NCP_ALLOC_SLOT_REQUEST) {
640 641 if (((struct ncp_reply_header*)server->rxbuf)->sequence != server->sequence) {
641   - printk(KERN_ERR "ncpfs: tcp: Bad sequence number\n");
  642 + pr_err("tcp: Bad sequence number\n");
642 643 __ncp_abort_request(server, req, -EIO);
643 644 return -EIO;
644 645 }
645 646 if ((((struct ncp_reply_header*)server->rxbuf)->conn_low | (((struct ncp_reply_header*)server->rxbuf)->conn_high << 8)) != server->connection) {
646   - printk(KERN_ERR "ncpfs: tcp: Connection number mismatch\n");
  647 + pr_err("tcp: Connection number mismatch\n");
647 648 __ncp_abort_request(server, req, -EIO);
648 649 return -EIO;
649 650 }
... ... @@ -651,7 +652,7 @@
651 652 #ifdef CONFIG_NCPFS_PACKET_SIGNING
652 653 if (server->sign_active && req->tx_type != NCP_DEALLOC_SLOT_REQUEST) {
653 654 if (sign_verify_reply(server, server->rxbuf + 6, req->datalen - 6, cpu_to_be32(req->datalen + 16), &server->rcv.buf.type)) {
654   - printk(KERN_ERR "ncpfs: tcp: Signature violation\n");
  655 + pr_err("tcp: Signature violation\n");
655 656 __ncp_abort_request(server, req, -EIO);
656 657 return -EIO;
657 658 }
... ... @@ -742,7 +743,7 @@
742 743 int result;
743 744  
744 745 if (server->lock == 0) {
745   - printk(KERN_ERR "ncpfs: Server not locked!\n");
  746 + pr_err("Server not locked!\n");
746 747 return -EIO;
747 748 }
748 749 if (!ncp_conn_valid(server)) {
... ... @@ -781,7 +782,7 @@
781 782 spin_unlock_irqrestore(&current->sighand->siglock, flags);
782 783 }
783 784  
784   - DDPRINTK("do_ncp_rpc_call returned %d\n", result);
  785 + ncp_dbg(2, "do_ncp_rpc_call returned %d\n", result);
785 786  
786 787 return result;
787 788 }
... ... @@ -811,7 +812,7 @@
811 812  
812 813 result = ncp_do_request(server, server->current_size, reply, size);
813 814 if (result < 0) {
814   - DPRINTK("ncp_request_error: %d\n", result);
  815 + ncp_dbg(1, "ncp_request_error: %d\n", result);
815 816 goto out;
816 817 }
817 818 server->completion = reply->completion_code;
... ... @@ -822,7 +823,7 @@
822 823 result = reply->completion_code;
823 824  
824 825 if (result != 0)
825   - PPRINTK("ncp_request: completion code=%x\n", result);
  826 + ncp_vdbg("completion code=%x\n", result);
826 827 out:
827 828 return result;
828 829 }
829 830  
... ... @@ -865,14 +866,14 @@
865 866 {
866 867 mutex_lock(&server->mutex);
867 868 if (server->lock)
868   - printk(KERN_WARNING "ncp_lock_server: was locked!\n");
  869 + pr_warn("%s: was locked!\n", __func__);
869 870 server->lock = 1;
870 871 }
871 872  
872 873 void ncp_unlock_server(struct ncp_server *server)
873 874 {
874 875 if (!server->lock) {
875   - printk(KERN_WARNING "ncp_unlock_server: was not locked!\n");
  876 + pr_warn("%s: was not locked!\n", __func__);
876 877 return;
877 878 }
878 879 server->lock = 0;
... ... @@ -112,7 +112,7 @@
112 112 __le32 attr;
113 113 unsigned int hdr;
114 114  
115   - DPRINTK("ncp_symlink(dir=%p,dentry=%p,symname=%s)\n",dir,dentry,symname);
  115 + ncp_dbg(1, "dir=%p, dentry=%p, symname=%s\n", dir, dentry, symname);
116 116  
117 117 if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber))
118 118 kludge = 0;
lib/percpu_counter.c
... ... @@ -169,7 +169,7 @@
169 169 struct percpu_counter *fbc;
170 170  
171 171 compute_batch_value();
172   - if (action != CPU_DEAD)
  172 + if (action != CPU_DEAD && action != CPU_DEAD_FROZEN)
173 173 return NOTIFY_OK;
174 174  
175 175 cpu = (unsigned long)hcpu;
... ... @@ -1862,7 +1862,7 @@
1862 1862 struct zone *zone = lruvec_zone(lruvec);
1863 1863 unsigned long anon_prio, file_prio;
1864 1864 enum scan_balance scan_balance;
1865   - unsigned long anon, file, free;
  1865 + unsigned long anon, file;
1866 1866 bool force_scan = false;
1867 1867 unsigned long ap, fp;
1868 1868 enum lru_list lru;
... ... @@ -1914,20 +1914,6 @@
1914 1914 get_lru_size(lruvec, LRU_INACTIVE_ANON);
1915 1915 file = get_lru_size(lruvec, LRU_ACTIVE_FILE) +
1916 1916 get_lru_size(lruvec, LRU_INACTIVE_FILE);
1917   -
1918   - /*
1919   - * If it's foreseeable that reclaiming the file cache won't be
1920   - * enough to get the zone back into a desirable shape, we have
1921   - * to swap. Better start now and leave the - probably heavily
1922   - * thrashing - remaining file pages alone.
1923   - */
1924   - if (global_reclaim(sc)) {
1925   - free = zone_page_state(zone, NR_FREE_PAGES);
1926   - if (unlikely(file + free <= high_wmark_pages(zone))) {
1927   - scan_balance = SCAN_ANON;
1928   - goto out;
1929   - }
1930   - }
1931 1917  
1932 1918 /*
1933 1919 * There is enough inactive page cache, do not reclaim