提交 0bbacc40 编写于 作者: C Chuck Lever 提交者: Trond Myklebust

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: NChuck Lever <cel@netapp.com>
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 c556b754
...@@ -30,6 +30,36 @@ ...@@ -30,6 +30,36 @@
static struct nlm_file * nlm_files[FILE_NRHASH]; static struct nlm_file * nlm_files[FILE_NRHASH];
static DECLARE_MUTEX(nlm_file_sema); static DECLARE_MUTEX(nlm_file_sema);
#ifdef NFSD_DEBUG
static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
{
u32 *fhp = (u32*)f->data;
/* print the first 32 bytes of the fh */
dprintk("lockd: %s (%08x %08x %08x %08x %08x %08x %08x %08x)\n",
msg, fhp[0], fhp[1], fhp[2], fhp[3],
fhp[4], fhp[5], fhp[6], fhp[7]);
}
static inline void nlm_debug_print_file(char *msg, struct nlm_file *file)
{
struct inode *inode = file->f_file->f_dentry->d_inode;
dprintk("lockd: %s %s/%ld\n",
msg, inode->i_sb->s_id, inode->i_ino);
}
#else
static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
{
return;
}
static inline void nlm_debug_print_file(char *msg, struct nlm_file *file)
{
return;
}
#endif
static inline unsigned int file_hash(struct nfs_fh *f) static inline unsigned int file_hash(struct nfs_fh *f)
{ {
unsigned int tmp=0; unsigned int tmp=0;
...@@ -55,11 +85,8 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result, ...@@ -55,11 +85,8 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
struct nlm_file *file; struct nlm_file *file;
unsigned int hash; unsigned int hash;
u32 nfserr; u32 nfserr;
u32 *fhp = (u32*)f->data;
dprintk("lockd: nlm_file_lookup(%08x %08x %08x %08x %08x %08x)\n",
fhp[0], fhp[1], fhp[2], fhp[3], fhp[4], fhp[5]);
nlm_debug_print_fh("nlm_file_lookup", f);
hash = file_hash(f); hash = file_hash(f);
...@@ -70,8 +97,7 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result, ...@@ -70,8 +97,7 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
if (!nfs_compare_fh(&file->f_handle, f)) if (!nfs_compare_fh(&file->f_handle, f))
goto found; goto found;
dprintk("lockd: creating file for (%08x %08x %08x %08x %08x %08x)\n", nlm_debug_print_fh("creating file for", f);
fhp[0], fhp[1], fhp[2], fhp[3], fhp[4], fhp[5]);
nfserr = nlm_lck_denied_nolocks; nfserr = nlm_lck_denied_nolocks;
file = (struct nlm_file *) kmalloc(sizeof(*file), GFP_KERNEL); file = (struct nlm_file *) kmalloc(sizeof(*file), GFP_KERNEL);
...@@ -124,11 +150,10 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result, ...@@ -124,11 +150,10 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
static inline void static inline void
nlm_delete_file(struct nlm_file *file) nlm_delete_file(struct nlm_file *file)
{ {
struct inode *inode = file->f_file->f_dentry->d_inode;
struct nlm_file **fp, *f; struct nlm_file **fp, *f;
dprintk("lockd: closing file %s/%ld\n", nlm_debug_print_file("closing file", file);
inode->i_sb->s_id, inode->i_ino);
fp = nlm_files + file->f_hash; fp = nlm_files + file->f_hash;
while ((f = *fp) != NULL) { while ((f = *fp) != NULL) {
if (f == file) { if (f == file) {
......
...@@ -655,7 +655,6 @@ nfs_file_direct_read(struct kiocb *iocb, char __user *buf, size_t count, loff_t ...@@ -655,7 +655,6 @@ nfs_file_direct_read(struct kiocb *iocb, char __user *buf, size_t count, loff_t
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct nfs_open_context *ctx = struct nfs_open_context *ctx =
(struct nfs_open_context *) file->private_data; (struct nfs_open_context *) file->private_data;
struct dentry *dentry = file->f_dentry;
struct address_space *mapping = file->f_mapping; struct address_space *mapping = file->f_mapping;
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
struct iovec iov = { struct iovec iov = {
...@@ -664,7 +663,8 @@ nfs_file_direct_read(struct kiocb *iocb, char __user *buf, size_t count, loff_t ...@@ -664,7 +663,8 @@ nfs_file_direct_read(struct kiocb *iocb, char __user *buf, size_t count, loff_t
}; };
dprintk("nfs: direct read(%s/%s, %lu@%lu)\n", dprintk("nfs: direct read(%s/%s, %lu@%lu)\n",
dentry->d_parent->d_name.name, dentry->d_name.name, file->f_dentry->d_parent->d_name.name,
file->f_dentry->d_name.name,
(unsigned long) count, (unsigned long) pos); (unsigned long) count, (unsigned long) pos);
if (!is_sync_kiocb(iocb)) if (!is_sync_kiocb(iocb))
...@@ -730,7 +730,6 @@ nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, size_t count, ...@@ -730,7 +730,6 @@ nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, size_t count,
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct nfs_open_context *ctx = struct nfs_open_context *ctx =
(struct nfs_open_context *) file->private_data; (struct nfs_open_context *) file->private_data;
struct dentry *dentry = file->f_dentry;
struct address_space *mapping = file->f_mapping; struct address_space *mapping = file->f_mapping;
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
struct iovec iov = { struct iovec iov = {
...@@ -739,8 +738,9 @@ nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, size_t count, ...@@ -739,8 +738,9 @@ nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, size_t count,
}; };
dfprintk(VFS, "nfs: direct write(%s/%s(%ld), %lu@%lu)\n", dfprintk(VFS, "nfs: direct write(%s/%s(%ld), %lu@%lu)\n",
dentry->d_parent->d_name.name, dentry->d_name.name, file->f_dentry->d_parent->d_name.name,
inode->i_ino, (unsigned long) count, (unsigned long) pos); file->f_dentry->d_name.name, inode->i_ino,
(unsigned long) count, (unsigned long) pos);
if (!is_sync_kiocb(iocb)) if (!is_sync_kiocb(iocb))
goto out; goto out;
......
...@@ -734,14 +734,14 @@ int nfs_updatepage(struct file *file, struct page *page, ...@@ -734,14 +734,14 @@ int nfs_updatepage(struct file *file, struct page *page,
unsigned int offset, unsigned int count) unsigned int offset, unsigned int count)
{ {
struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data;
struct dentry *dentry = file->f_dentry;
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
struct nfs_page *req; struct nfs_page *req;
int status = 0; int status = 0;
dprintk("NFS: nfs_updatepage(%s/%s %d@%Ld)\n", dprintk("NFS: nfs_updatepage(%s/%s %d@%Ld)\n",
dentry->d_parent->d_name.name, dentry->d_name.name, file->f_dentry->d_parent->d_name.name,
count, (long long)(page_offset(page) +offset)); file->f_dentry->d_name.name, count,
(long long)(page_offset(page) +offset));
if (IS_SYNC(inode)) { if (IS_SYNC(inode)) {
status = nfs_writepage_sync(ctx, inode, page, offset, count, 0); status = nfs_writepage_sync(ctx, inode, page, offset, count, 0);
...@@ -850,7 +850,6 @@ static void nfs_write_rpcsetup(struct nfs_page *req, ...@@ -850,7 +850,6 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
unsigned int count, unsigned int offset, unsigned int count, unsigned int offset,
int how) int how)
{ {
struct rpc_task *task = &data->task;
struct inode *inode; struct inode *inode;
/* Set up the RPC argument and reply structs /* Set up the RPC argument and reply structs
...@@ -881,7 +880,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req, ...@@ -881,7 +880,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
data->task.tk_release = nfs_writedata_release; data->task.tk_release = nfs_writedata_release;
dprintk("NFS: %4d initiated write call (req %s/%Ld, %u bytes @ offset %Lu)\n", dprintk("NFS: %4d initiated write call (req %s/%Ld, %u bytes @ offset %Lu)\n",
task->tk_pid, data->task.tk_pid,
inode->i_sb->s_id, inode->i_sb->s_id,
(long long)NFS_FILEID(inode), (long long)NFS_FILEID(inode),
count, count,
...@@ -1217,7 +1216,6 @@ static void nfs_commit_release(struct rpc_task *task) ...@@ -1217,7 +1216,6 @@ static void nfs_commit_release(struct rpc_task *task)
static void nfs_commit_rpcsetup(struct list_head *head, static void nfs_commit_rpcsetup(struct list_head *head,
struct nfs_write_data *data, int how) struct nfs_write_data *data, int how)
{ {
struct rpc_task *task = &data->task;
struct nfs_page *first; struct nfs_page *first;
struct inode *inode; struct inode *inode;
...@@ -1248,7 +1246,7 @@ static void nfs_commit_rpcsetup(struct list_head *head, ...@@ -1248,7 +1246,7 @@ static void nfs_commit_rpcsetup(struct list_head *head,
/* Release requests */ /* Release requests */
data->task.tk_release = nfs_commit_release; data->task.tk_release = nfs_commit_release;
dprintk("NFS: %4d initiated commit call\n", task->tk_pid); dprintk("NFS: %4d initiated commit call\n", data->task.tk_pid);
} }
/* /*
......
...@@ -299,11 +299,10 @@ put_rpccred(struct rpc_cred *cred) ...@@ -299,11 +299,10 @@ put_rpccred(struct rpc_cred *cred)
void void
rpcauth_unbindcred(struct rpc_task *task) rpcauth_unbindcred(struct rpc_task *task)
{ {
struct rpc_auth *auth = task->tk_auth;
struct rpc_cred *cred = task->tk_msg.rpc_cred; struct rpc_cred *cred = task->tk_msg.rpc_cred;
dprintk("RPC: %4d releasing %s cred %p\n", dprintk("RPC: %4d releasing %s cred %p\n",
task->tk_pid, auth->au_ops->au_name, cred); task->tk_pid, task->tk_auth->au_ops->au_name, cred);
put_rpccred(cred); put_rpccred(cred);
task->tk_msg.rpc_cred = NULL; task->tk_msg.rpc_cred = NULL;
...@@ -312,22 +311,22 @@ rpcauth_unbindcred(struct rpc_task *task) ...@@ -312,22 +311,22 @@ rpcauth_unbindcred(struct rpc_task *task)
u32 * u32 *
rpcauth_marshcred(struct rpc_task *task, u32 *p) rpcauth_marshcred(struct rpc_task *task, u32 *p)
{ {
struct rpc_auth *auth = task->tk_auth;
struct rpc_cred *cred = task->tk_msg.rpc_cred; struct rpc_cred *cred = task->tk_msg.rpc_cred;
dprintk("RPC: %4d marshaling %s cred %p\n", dprintk("RPC: %4d marshaling %s cred %p\n",
task->tk_pid, auth->au_ops->au_name, cred); task->tk_pid, task->tk_auth->au_ops->au_name, cred);
return cred->cr_ops->crmarshal(task, p); return cred->cr_ops->crmarshal(task, p);
} }
u32 * u32 *
rpcauth_checkverf(struct rpc_task *task, u32 *p) rpcauth_checkverf(struct rpc_task *task, u32 *p)
{ {
struct rpc_auth *auth = task->tk_auth;
struct rpc_cred *cred = task->tk_msg.rpc_cred; struct rpc_cred *cred = task->tk_msg.rpc_cred;
dprintk("RPC: %4d validating %s cred %p\n", dprintk("RPC: %4d validating %s cred %p\n",
task->tk_pid, auth->au_ops->au_name, cred); task->tk_pid, task->tk_auth->au_ops->au_name, cred);
return cred->cr_ops->crvalidate(task, p); return cred->cr_ops->crvalidate(task, p);
} }
...@@ -363,12 +362,12 @@ rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, ...@@ -363,12 +362,12 @@ rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp,
int int
rpcauth_refreshcred(struct rpc_task *task) rpcauth_refreshcred(struct rpc_task *task)
{ {
struct rpc_auth *auth = task->tk_auth;
struct rpc_cred *cred = task->tk_msg.rpc_cred; struct rpc_cred *cred = task->tk_msg.rpc_cred;
int err; int err;
dprintk("RPC: %4d refreshing %s cred %p\n", dprintk("RPC: %4d refreshing %s cred %p\n",
task->tk_pid, auth->au_ops->au_name, cred); task->tk_pid, task->tk_auth->au_ops->au_name, cred);
err = cred->cr_ops->crrefresh(task); err = cred->cr_ops->crrefresh(task);
if (err < 0) if (err < 0)
task->tk_status = err; task->tk_status = err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册