Commit 0bbacc402e67abca8794a8401c1621dc0c0202e9

Authored by Chuck Lever
Committed by Trond Myklebust
1 parent c556b75496

NFS,SUNRPC,NLM: fix unused variable warnings when CONFIG_SYSCTL is disabled

Fix some dprintk's so that NLM, NFS client, and RPC client compile
 cleanly if CONFIG_SYSCTL is disabled.

 Test plan:
 Compile kernel with CONFIG_NFS enabled and CONFIG_SYSCTL disabled.

 Signed-off-by: Chuck Lever <cel@netapp.com>
 Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

Showing 4 changed files with 51 additions and 29 deletions Side-by-side Diff

... ... @@ -30,6 +30,36 @@
30 30 static struct nlm_file * nlm_files[FILE_NRHASH];
31 31 static DECLARE_MUTEX(nlm_file_sema);
32 32  
  33 +#ifdef NFSD_DEBUG
  34 +static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
  35 +{
  36 + u32 *fhp = (u32*)f->data;
  37 +
  38 + /* print the first 32 bytes of the fh */
  39 + dprintk("lockd: %s (%08x %08x %08x %08x %08x %08x %08x %08x)\n",
  40 + msg, fhp[0], fhp[1], fhp[2], fhp[3],
  41 + fhp[4], fhp[5], fhp[6], fhp[7]);
  42 +}
  43 +
  44 +static inline void nlm_debug_print_file(char *msg, struct nlm_file *file)
  45 +{
  46 + struct inode *inode = file->f_file->f_dentry->d_inode;
  47 +
  48 + dprintk("lockd: %s %s/%ld\n",
  49 + msg, inode->i_sb->s_id, inode->i_ino);
  50 +}
  51 +#else
  52 +static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
  53 +{
  54 + return;
  55 +}
  56 +
  57 +static inline void nlm_debug_print_file(char *msg, struct nlm_file *file)
  58 +{
  59 + return;
  60 +}
  61 +#endif
  62 +
33 63 static inline unsigned int file_hash(struct nfs_fh *f)
34 64 {
35 65 unsigned int tmp=0;
36 66  
37 67  
... ... @@ -55,12 +85,9 @@
55 85 struct nlm_file *file;
56 86 unsigned int hash;
57 87 u32 nfserr;
58   - u32 *fhp = (u32*)f->data;
59 88  
60   - dprintk("lockd: nlm_file_lookup(%08x %08x %08x %08x %08x %08x)\n",
61   - fhp[0], fhp[1], fhp[2], fhp[3], fhp[4], fhp[5]);
  89 + nlm_debug_print_fh("nlm_file_lookup", f);
62 90  
63   -
64 91 hash = file_hash(f);
65 92  
66 93 /* Lock file table */
... ... @@ -70,8 +97,7 @@
70 97 if (!nfs_compare_fh(&file->f_handle, f))
71 98 goto found;
72 99  
73   - dprintk("lockd: creating file for (%08x %08x %08x %08x %08x %08x)\n",
74   - fhp[0], fhp[1], fhp[2], fhp[3], fhp[4], fhp[5]);
  100 + nlm_debug_print_fh("creating file for", f);
75 101  
76 102 nfserr = nlm_lck_denied_nolocks;
77 103 file = (struct nlm_file *) kmalloc(sizeof(*file), GFP_KERNEL);
78 104  
... ... @@ -124,11 +150,10 @@
124 150 static inline void
125 151 nlm_delete_file(struct nlm_file *file)
126 152 {
127   - struct inode *inode = file->f_file->f_dentry->d_inode;
128 153 struct nlm_file **fp, *f;
129 154  
130   - dprintk("lockd: closing file %s/%ld\n",
131   - inode->i_sb->s_id, inode->i_ino);
  155 + nlm_debug_print_file("closing file", file);
  156 +
132 157 fp = nlm_files + file->f_hash;
133 158 while ((f = *fp) != NULL) {
134 159 if (f == file) {
... ... @@ -655,7 +655,6 @@
655 655 struct file *file = iocb->ki_filp;
656 656 struct nfs_open_context *ctx =
657 657 (struct nfs_open_context *) file->private_data;
658   - struct dentry *dentry = file->f_dentry;
659 658 struct address_space *mapping = file->f_mapping;
660 659 struct inode *inode = mapping->host;
661 660 struct iovec iov = {
... ... @@ -664,7 +663,8 @@
664 663 };
665 664  
666 665 dprintk("nfs: direct read(%s/%s, %lu@%lu)\n",
667   - dentry->d_parent->d_name.name, dentry->d_name.name,
  666 + file->f_dentry->d_parent->d_name.name,
  667 + file->f_dentry->d_name.name,
668 668 (unsigned long) count, (unsigned long) pos);
669 669  
670 670 if (!is_sync_kiocb(iocb))
... ... @@ -730,7 +730,6 @@
730 730 struct file *file = iocb->ki_filp;
731 731 struct nfs_open_context *ctx =
732 732 (struct nfs_open_context *) file->private_data;
733   - struct dentry *dentry = file->f_dentry;
734 733 struct address_space *mapping = file->f_mapping;
735 734 struct inode *inode = mapping->host;
736 735 struct iovec iov = {
... ... @@ -739,8 +738,9 @@
739 738 };
740 739  
741 740 dfprintk(VFS, "nfs: direct write(%s/%s(%ld), %lu@%lu)\n",
742   - dentry->d_parent->d_name.name, dentry->d_name.name,
743   - inode->i_ino, (unsigned long) count, (unsigned long) pos);
  741 + file->f_dentry->d_parent->d_name.name,
  742 + file->f_dentry->d_name.name, inode->i_ino,
  743 + (unsigned long) count, (unsigned long) pos);
744 744  
745 745 if (!is_sync_kiocb(iocb))
746 746 goto out;
... ... @@ -734,14 +734,14 @@
734 734 unsigned int offset, unsigned int count)
735 735 {
736 736 struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data;
737   - struct dentry *dentry = file->f_dentry;
738 737 struct inode *inode = page->mapping->host;
739 738 struct nfs_page *req;
740 739 int status = 0;
741 740  
742 741 dprintk("NFS: nfs_updatepage(%s/%s %d@%Ld)\n",
743   - dentry->d_parent->d_name.name, dentry->d_name.name,
744   - count, (long long)(page_offset(page) +offset));
  742 + file->f_dentry->d_parent->d_name.name,
  743 + file->f_dentry->d_name.name, count,
  744 + (long long)(page_offset(page) +offset));
745 745  
746 746 if (IS_SYNC(inode)) {
747 747 status = nfs_writepage_sync(ctx, inode, page, offset, count, 0);
... ... @@ -850,7 +850,6 @@
850 850 unsigned int count, unsigned int offset,
851 851 int how)
852 852 {
853   - struct rpc_task *task = &data->task;
854 853 struct inode *inode;
855 854  
856 855 /* Set up the RPC argument and reply structs
... ... @@ -881,7 +880,7 @@
881 880 data->task.tk_release = nfs_writedata_release;
882 881  
883 882 dprintk("NFS: %4d initiated write call (req %s/%Ld, %u bytes @ offset %Lu)\n",
884   - task->tk_pid,
  883 + data->task.tk_pid,
885 884 inode->i_sb->s_id,
886 885 (long long)NFS_FILEID(inode),
887 886 count,
... ... @@ -1217,7 +1216,6 @@
1217 1216 static void nfs_commit_rpcsetup(struct list_head *head,
1218 1217 struct nfs_write_data *data, int how)
1219 1218 {
1220   - struct rpc_task *task = &data->task;
1221 1219 struct nfs_page *first;
1222 1220 struct inode *inode;
1223 1221  
... ... @@ -1248,7 +1246,7 @@
1248 1246 /* Release requests */
1249 1247 data->task.tk_release = nfs_commit_release;
1250 1248  
1251   - dprintk("NFS: %4d initiated commit call\n", task->tk_pid);
  1249 + dprintk("NFS: %4d initiated commit call\n", data->task.tk_pid);
1252 1250 }
1253 1251  
1254 1252 /*
... ... @@ -299,11 +299,10 @@
299 299 void
300 300 rpcauth_unbindcred(struct rpc_task *task)
301 301 {
302   - struct rpc_auth *auth = task->tk_auth;
303 302 struct rpc_cred *cred = task->tk_msg.rpc_cred;
304 303  
305 304 dprintk("RPC: %4d releasing %s cred %p\n",
306   - task->tk_pid, auth->au_ops->au_name, cred);
  305 + task->tk_pid, task->tk_auth->au_ops->au_name, cred);
307 306  
308 307 put_rpccred(cred);
309 308 task->tk_msg.rpc_cred = NULL;
310 309  
311 310  
312 311  
... ... @@ -312,22 +311,22 @@
312 311 u32 *
313 312 rpcauth_marshcred(struct rpc_task *task, u32 *p)
314 313 {
315   - struct rpc_auth *auth = task->tk_auth;
316 314 struct rpc_cred *cred = task->tk_msg.rpc_cred;
317 315  
318 316 dprintk("RPC: %4d marshaling %s cred %p\n",
319   - task->tk_pid, auth->au_ops->au_name, cred);
  317 + task->tk_pid, task->tk_auth->au_ops->au_name, cred);
  318 +
320 319 return cred->cr_ops->crmarshal(task, p);
321 320 }
322 321  
323 322 u32 *
324 323 rpcauth_checkverf(struct rpc_task *task, u32 *p)
325 324 {
326   - struct rpc_auth *auth = task->tk_auth;
327 325 struct rpc_cred *cred = task->tk_msg.rpc_cred;
328 326  
329 327 dprintk("RPC: %4d validating %s cred %p\n",
330   - task->tk_pid, auth->au_ops->au_name, cred);
  328 + task->tk_pid, task->tk_auth->au_ops->au_name, cred);
  329 +
331 330 return cred->cr_ops->crvalidate(task, p);
332 331 }
333 332  
334 333  
... ... @@ -363,12 +362,12 @@
363 362 int
364 363 rpcauth_refreshcred(struct rpc_task *task)
365 364 {
366   - struct rpc_auth *auth = task->tk_auth;
367 365 struct rpc_cred *cred = task->tk_msg.rpc_cred;
368 366 int err;
369 367  
370 368 dprintk("RPC: %4d refreshing %s cred %p\n",
371   - task->tk_pid, auth->au_ops->au_name, cred);
  369 + task->tk_pid, task->tk_auth->au_ops->au_name, cred);
  370 +
372 371 err = cred->cr_ops->crrefresh(task);
373 372 if (err < 0)
374 373 task->tk_status = err;