nfs: use %p[dD] instead of open-coded (and often racy) equivalents

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2013-09-16 10:53:17 -04:00
parent 48bc06e74b
commit 6de1472f1a
11 changed files with 119 additions and 186 deletions

View file

@ -98,9 +98,7 @@ nfs_opendir(struct inode *inode, struct file *filp)
struct nfs_open_dir_context *ctx; struct nfs_open_dir_context *ctx;
struct rpc_cred *cred; struct rpc_cred *cred;
dfprintk(FILE, "NFS: open dir(%s/%s)\n", dfprintk(FILE, "NFS: open dir(%pD2)\n", filp);
filp->f_path.dentry->d_parent->d_name.name,
filp->f_path.dentry->d_name.name);
nfs_inc_stats(inode, NFSIOS_VFSOPEN); nfs_inc_stats(inode, NFSIOS_VFSOPEN);
@ -297,11 +295,10 @@ int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_des
if (ctx->duped > 0 if (ctx->duped > 0
&& ctx->dup_cookie == *desc->dir_cookie) { && ctx->dup_cookie == *desc->dir_cookie) {
if (printk_ratelimit()) { if (printk_ratelimit()) {
pr_notice("NFS: directory %s/%s contains a readdir loop." pr_notice("NFS: directory %pD2 contains a readdir loop."
"Please contact your server vendor. " "Please contact your server vendor. "
"The file: %s has duplicate cookie %llu\n", "The file: %s has duplicate cookie %llu\n",
desc->file->f_dentry->d_parent->d_name.name, desc->file,
desc->file->f_dentry->d_name.name,
array->array[i].string.name, array->array[i].string.name,
*desc->dir_cookie); *desc->dir_cookie);
} }
@ -822,9 +819,8 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)
struct nfs_open_dir_context *dir_ctx = file->private_data; struct nfs_open_dir_context *dir_ctx = file->private_data;
int res = 0; int res = 0;
dfprintk(FILE, "NFS: readdir(%s/%s) starting at cookie %llu\n", dfprintk(FILE, "NFS: readdir(%pD2) starting at cookie %llu\n",
dentry->d_parent->d_name.name, dentry->d_name.name, file, (long long)ctx->pos);
(long long)ctx->pos);
nfs_inc_stats(inode, NFSIOS_VFSGETDENTS); nfs_inc_stats(inode, NFSIOS_VFSGETDENTS);
/* /*
@ -880,22 +876,17 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)
nfs_unblock_sillyrename(dentry); nfs_unblock_sillyrename(dentry);
if (res > 0) if (res > 0)
res = 0; res = 0;
dfprintk(FILE, "NFS: readdir(%s/%s) returns %d\n", dfprintk(FILE, "NFS: readdir(%pD2) returns %d\n", file, res);
dentry->d_parent->d_name.name, dentry->d_name.name,
res);
return res; return res;
} }
static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence) static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
{ {
struct dentry *dentry = filp->f_path.dentry; struct inode *inode = file_inode(filp);
struct inode *inode = dentry->d_inode;
struct nfs_open_dir_context *dir_ctx = filp->private_data; struct nfs_open_dir_context *dir_ctx = filp->private_data;
dfprintk(FILE, "NFS: llseek dir(%s/%s, %lld, %d)\n", dfprintk(FILE, "NFS: llseek dir(%pD2, %lld, %d)\n",
dentry->d_parent->d_name.name, filp, offset, whence);
dentry->d_name.name,
offset, whence);
mutex_lock(&inode->i_mutex); mutex_lock(&inode->i_mutex);
switch (whence) { switch (whence) {
@ -925,15 +916,12 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
static int nfs_fsync_dir(struct file *filp, loff_t start, loff_t end, static int nfs_fsync_dir(struct file *filp, loff_t start, loff_t end,
int datasync) int datasync)
{ {
struct dentry *dentry = filp->f_path.dentry; struct inode *inode = file_inode(filp);
struct inode *inode = dentry->d_inode;
dfprintk(FILE, "NFS: fsync dir(%s/%s) datasync %d\n", dfprintk(FILE, "NFS: fsync dir(%pD2) datasync %d\n", filp, datasync);
dentry->d_parent->d_name.name, dentry->d_name.name,
datasync);
mutex_lock(&inode->i_mutex); mutex_lock(&inode->i_mutex);
nfs_inc_stats(dentry->d_inode, NFSIOS_VFSFSYNC); nfs_inc_stats(inode, NFSIOS_VFSFSYNC);
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
return 0; return 0;
} }
@ -1073,9 +1061,8 @@ static int nfs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
} }
if (is_bad_inode(inode)) { if (is_bad_inode(inode)) {
dfprintk(LOOKUPCACHE, "%s: %s/%s has dud inode\n", dfprintk(LOOKUPCACHE, "%s: %pd2 has dud inode\n",
__func__, dentry->d_parent->d_name.name, __func__, dentry);
dentry->d_name.name);
goto out_bad; goto out_bad;
} }
@ -1125,9 +1112,8 @@ static int nfs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
nfs_advise_use_readdirplus(dir); nfs_advise_use_readdirplus(dir);
out_valid_noent: out_valid_noent:
dput(parent); dput(parent);
dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is valid\n", dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) is valid\n",
__func__, dentry->d_parent->d_name.name, __func__, dentry);
dentry->d_name.name);
return 1; return 1;
out_zap_parent: out_zap_parent:
nfs_zap_caches(dir); nfs_zap_caches(dir);
@ -1147,18 +1133,16 @@ static int nfs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
goto out_valid; goto out_valid;
dput(parent); dput(parent);
dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is invalid\n", dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) is invalid\n",
__func__, dentry->d_parent->d_name.name, __func__, dentry);
dentry->d_name.name);
return 0; return 0;
out_error: out_error:
nfs_free_fattr(fattr); nfs_free_fattr(fattr);
nfs_free_fhandle(fhandle); nfs_free_fhandle(fhandle);
nfs4_label_free(label); nfs4_label_free(label);
dput(parent); dput(parent);
dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) lookup returned error %d\n", dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) lookup returned error %d\n",
__func__, dentry->d_parent->d_name.name, __func__, dentry, error);
dentry->d_name.name, error);
return error; return error;
} }
@ -1182,16 +1166,14 @@ static int nfs_weak_revalidate(struct dentry *dentry, unsigned int flags)
* eventually need to do something more here. * eventually need to do something more here.
*/ */
if (!inode) { if (!inode) {
dfprintk(LOOKUPCACHE, "%s: %s/%s has negative inode\n", dfprintk(LOOKUPCACHE, "%s: %pd2 has negative inode\n",
__func__, dentry->d_parent->d_name.name, __func__, dentry);
dentry->d_name.name);
return 1; return 1;
} }
if (is_bad_inode(inode)) { if (is_bad_inode(inode)) {
dfprintk(LOOKUPCACHE, "%s: %s/%s has dud inode\n", dfprintk(LOOKUPCACHE, "%s: %pd2 has dud inode\n",
__func__, dentry->d_parent->d_name.name, __func__, dentry);
dentry->d_name.name);
return 0; return 0;
} }
@ -1206,9 +1188,8 @@ static int nfs_weak_revalidate(struct dentry *dentry, unsigned int flags)
*/ */
static int nfs_dentry_delete(const struct dentry *dentry) static int nfs_dentry_delete(const struct dentry *dentry)
{ {
dfprintk(VFS, "NFS: dentry_delete(%s/%s, %x)\n", dfprintk(VFS, "NFS: dentry_delete(%pd2, %x)\n",
dentry->d_parent->d_name.name, dentry->d_name.name, dentry, dentry->d_flags);
dentry->d_flags);
/* Unhash any dentry with a stale inode */ /* Unhash any dentry with a stale inode */
if (dentry->d_inode != NULL && NFS_STALE(dentry->d_inode)) if (dentry->d_inode != NULL && NFS_STALE(dentry->d_inode))
@ -1286,8 +1267,7 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in
struct nfs4_label *label = NULL; struct nfs4_label *label = NULL;
int error; int error;
dfprintk(VFS, "NFS: lookup(%s/%s)\n", dfprintk(VFS, "NFS: lookup(%pd2)\n", dentry);
dentry->d_parent->d_name.name, dentry->d_name.name);
nfs_inc_stats(dir, NFSIOS_VFSLOOKUP); nfs_inc_stats(dir, NFSIOS_VFSLOOKUP);
res = ERR_PTR(-ENAMETOOLONG); res = ERR_PTR(-ENAMETOOLONG);
@ -1418,8 +1398,8 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
/* Expect a negative dentry */ /* Expect a negative dentry */
BUG_ON(dentry->d_inode); BUG_ON(dentry->d_inode);
dfprintk(VFS, "NFS: atomic_open(%s/%ld), %s\n", dfprintk(VFS, "NFS: atomic_open(%s/%ld), %pd\n",
dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); dir->i_sb->s_id, dir->i_ino, dentry);
err = nfs_check_flags(open_flags); err = nfs_check_flags(open_flags);
if (err) if (err)
@ -1608,8 +1588,8 @@ int nfs_create(struct inode *dir, struct dentry *dentry,
int open_flags = excl ? O_CREAT | O_EXCL : O_CREAT; int open_flags = excl ? O_CREAT | O_EXCL : O_CREAT;
int error; int error;
dfprintk(VFS, "NFS: create(%s/%ld), %s\n", dfprintk(VFS, "NFS: create(%s/%ld), %pd\n",
dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); dir->i_sb->s_id, dir->i_ino, dentry);
attr.ia_mode = mode; attr.ia_mode = mode;
attr.ia_valid = ATTR_MODE; attr.ia_valid = ATTR_MODE;
@ -1635,8 +1615,8 @@ nfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev)
struct iattr attr; struct iattr attr;
int status; int status;
dfprintk(VFS, "NFS: mknod(%s/%ld), %s\n", dfprintk(VFS, "NFS: mknod(%s/%ld), %pd\n",
dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); dir->i_sb->s_id, dir->i_ino, dentry);
if (!new_valid_dev(rdev)) if (!new_valid_dev(rdev))
return -EINVAL; return -EINVAL;
@ -1664,8 +1644,8 @@ int nfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
struct iattr attr; struct iattr attr;
int error; int error;
dfprintk(VFS, "NFS: mkdir(%s/%ld), %s\n", dfprintk(VFS, "NFS: mkdir(%s/%ld), %pd\n",
dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); dir->i_sb->s_id, dir->i_ino, dentry);
attr.ia_valid = ATTR_MODE; attr.ia_valid = ATTR_MODE;
attr.ia_mode = mode | S_IFDIR; attr.ia_mode = mode | S_IFDIR;
@ -1692,8 +1672,8 @@ int nfs_rmdir(struct inode *dir, struct dentry *dentry)
{ {
int error; int error;
dfprintk(VFS, "NFS: rmdir(%s/%ld), %s\n", dfprintk(VFS, "NFS: rmdir(%s/%ld), %pd\n",
dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); dir->i_sb->s_id, dir->i_ino, dentry);
trace_nfs_rmdir_enter(dir, dentry); trace_nfs_rmdir_enter(dir, dentry);
if (dentry->d_inode) { if (dentry->d_inode) {
@ -1728,8 +1708,7 @@ static int nfs_safe_remove(struct dentry *dentry)
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
int error = -EBUSY; int error = -EBUSY;
dfprintk(VFS, "NFS: safe_remove(%s/%s)\n", dfprintk(VFS, "NFS: safe_remove(%pd2)\n", dentry);
dentry->d_parent->d_name.name, dentry->d_name.name);
/* If the dentry was sillyrenamed, we simply call d_delete() */ /* If the dentry was sillyrenamed, we simply call d_delete() */
if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
@ -1762,8 +1741,8 @@ int nfs_unlink(struct inode *dir, struct dentry *dentry)
int error; int error;
int need_rehash = 0; int need_rehash = 0;
dfprintk(VFS, "NFS: unlink(%s/%ld, %s)\n", dir->i_sb->s_id, dfprintk(VFS, "NFS: unlink(%s/%ld, %pd)\n", dir->i_sb->s_id,
dir->i_ino, dentry->d_name.name); dir->i_ino, dentry);
trace_nfs_unlink_enter(dir, dentry); trace_nfs_unlink_enter(dir, dentry);
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
@ -1813,8 +1792,8 @@ int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
unsigned int pathlen = strlen(symname); unsigned int pathlen = strlen(symname);
int error; int error;
dfprintk(VFS, "NFS: symlink(%s/%ld, %s, %s)\n", dir->i_sb->s_id, dfprintk(VFS, "NFS: symlink(%s/%ld, %pd, %s)\n", dir->i_sb->s_id,
dir->i_ino, dentry->d_name.name, symname); dir->i_ino, dentry, symname);
if (pathlen > PAGE_SIZE) if (pathlen > PAGE_SIZE)
return -ENAMETOOLONG; return -ENAMETOOLONG;
@ -1836,9 +1815,9 @@ int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
error = NFS_PROTO(dir)->symlink(dir, dentry, page, pathlen, &attr); error = NFS_PROTO(dir)->symlink(dir, dentry, page, pathlen, &attr);
trace_nfs_symlink_exit(dir, dentry, error); trace_nfs_symlink_exit(dir, dentry, error);
if (error != 0) { if (error != 0) {
dfprintk(VFS, "NFS: symlink(%s/%ld, %s, %s) error %d\n", dfprintk(VFS, "NFS: symlink(%s/%ld, %pd, %s) error %d\n",
dir->i_sb->s_id, dir->i_ino, dir->i_sb->s_id, dir->i_ino,
dentry->d_name.name, symname, error); dentry, symname, error);
d_drop(dentry); d_drop(dentry);
__free_page(page); __free_page(page);
return error; return error;
@ -1865,9 +1844,8 @@ nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
struct inode *inode = old_dentry->d_inode; struct inode *inode = old_dentry->d_inode;
int error; int error;
dfprintk(VFS, "NFS: link(%s/%s -> %s/%s)\n", dfprintk(VFS, "NFS: link(%pd2 -> %pd2)\n",
old_dentry->d_parent->d_name.name, old_dentry->d_name.name, old_dentry, dentry);
dentry->d_parent->d_name.name, dentry->d_name.name);
trace_nfs_link_enter(inode, dir, dentry); trace_nfs_link_enter(inode, dir, dentry);
NFS_PROTO(inode)->return_delegation(inode); NFS_PROTO(inode)->return_delegation(inode);
@ -1915,9 +1893,8 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct dentry *dentry = NULL, *rehash = NULL; struct dentry *dentry = NULL, *rehash = NULL;
int error = -EBUSY; int error = -EBUSY;
dfprintk(VFS, "NFS: rename(%s/%s -> %s/%s, ct=%d)\n", dfprintk(VFS, "NFS: rename(%pd2 -> %pd2, ct=%d)\n",
old_dentry->d_parent->d_name.name, old_dentry->d_name.name, old_dentry, new_dentry,
new_dentry->d_parent->d_name.name, new_dentry->d_name.name,
d_count(new_dentry)); d_count(new_dentry));
trace_nfs_rename_enter(old_dir, old_dentry, new_dir, new_dentry); trace_nfs_rename_enter(old_dir, old_dentry, new_dir, new_dentry);

View file

@ -124,9 +124,8 @@ static inline int put_dreq(struct nfs_direct_req *dreq)
ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs) ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs)
{ {
#ifndef CONFIG_NFS_SWAP #ifndef CONFIG_NFS_SWAP
dprintk("NFS: nfs_direct_IO (%s) off/no(%Ld/%lu) EINVAL\n", dprintk("NFS: nfs_direct_IO (%pD) off/no(%Ld/%lu) EINVAL\n",
iocb->ki_filp->f_path.dentry->d_name.name, iocb->ki_filp, (long long) pos, nr_segs);
(long long) pos, nr_segs);
return -EINVAL; return -EINVAL;
#else #else
@ -909,10 +908,8 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
count = iov_length(iov, nr_segs); count = iov_length(iov, nr_segs);
nfs_add_stats(mapping->host, NFSIOS_DIRECTREADBYTES, count); nfs_add_stats(mapping->host, NFSIOS_DIRECTREADBYTES, count);
dfprintk(FILE, "NFS: direct read(%s/%s, %zd@%Ld)\n", dfprintk(FILE, "NFS: direct read(%pD2, %zd@%Ld)\n",
file->f_path.dentry->d_parent->d_name.name, file, count, (long long) pos);
file->f_path.dentry->d_name.name,
count, (long long) pos);
retval = 0; retval = 0;
if (!count) if (!count)
@ -965,10 +962,8 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
count = iov_length(iov, nr_segs); count = iov_length(iov, nr_segs);
nfs_add_stats(mapping->host, NFSIOS_DIRECTWRITTENBYTES, count); nfs_add_stats(mapping->host, NFSIOS_DIRECTWRITTENBYTES, count);
dfprintk(FILE, "NFS: direct write(%s/%s, %zd@%Ld)\n", dfprintk(FILE, "NFS: direct write(%pD2, %zd@%Ld)\n",
file->f_path.dentry->d_parent->d_name.name, file, count, (long long) pos);
file->f_path.dentry->d_name.name,
count, (long long) pos);
retval = generic_write_checks(file, &pos, &count, 0); retval = generic_write_checks(file, &pos, &count, 0);
if (retval) if (retval)

View file

@ -65,9 +65,7 @@ nfs_file_open(struct inode *inode, struct file *filp)
{ {
int res; int res;
dprintk("NFS: open file(%s/%s)\n", dprintk("NFS: open file(%pD2)\n", filp);
filp->f_path.dentry->d_parent->d_name.name,
filp->f_path.dentry->d_name.name);
nfs_inc_stats(inode, NFSIOS_VFSOPEN); nfs_inc_stats(inode, NFSIOS_VFSOPEN);
res = nfs_check_flags(filp->f_flags); res = nfs_check_flags(filp->f_flags);
@ -81,9 +79,7 @@ nfs_file_open(struct inode *inode, struct file *filp)
int int
nfs_file_release(struct inode *inode, struct file *filp) nfs_file_release(struct inode *inode, struct file *filp)
{ {
dprintk("NFS: release(%s/%s)\n", dprintk("NFS: release(%pD2)\n", filp);
filp->f_path.dentry->d_parent->d_name.name,
filp->f_path.dentry->d_name.name);
nfs_inc_stats(inode, NFSIOS_VFSRELEASE); nfs_inc_stats(inode, NFSIOS_VFSRELEASE);
return nfs_release(inode, filp); return nfs_release(inode, filp);
@ -123,10 +119,8 @@ static int nfs_revalidate_file_size(struct inode *inode, struct file *filp)
loff_t nfs_file_llseek(struct file *filp, loff_t offset, int whence) loff_t nfs_file_llseek(struct file *filp, loff_t offset, int whence)
{ {
dprintk("NFS: llseek file(%s/%s, %lld, %d)\n", dprintk("NFS: llseek file(%pD2, %lld, %d)\n",
filp->f_path.dentry->d_parent->d_name.name, filp, offset, whence);
filp->f_path.dentry->d_name.name,
offset, whence);
/* /*
* whence == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate * whence == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
@ -150,12 +144,9 @@ EXPORT_SYMBOL_GPL(nfs_file_llseek);
int int
nfs_file_flush(struct file *file, fl_owner_t id) nfs_file_flush(struct file *file, fl_owner_t id)
{ {
struct dentry *dentry = file->f_path.dentry; struct inode *inode = file_inode(file);
struct inode *inode = dentry->d_inode;
dprintk("NFS: flush(%s/%s)\n", dprintk("NFS: flush(%pD2)\n", file);
dentry->d_parent->d_name.name,
dentry->d_name.name);
nfs_inc_stats(inode, NFSIOS_VFSFLUSH); nfs_inc_stats(inode, NFSIOS_VFSFLUSH);
if ((file->f_mode & FMODE_WRITE) == 0) if ((file->f_mode & FMODE_WRITE) == 0)
@ -177,15 +168,14 @@ ssize_t
nfs_file_read(struct kiocb *iocb, const struct iovec *iov, nfs_file_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos) unsigned long nr_segs, loff_t pos)
{ {
struct dentry * dentry = iocb->ki_filp->f_path.dentry; struct inode *inode = file_inode(iocb->ki_filp);
struct inode * inode = dentry->d_inode;
ssize_t result; ssize_t result;
if (iocb->ki_filp->f_flags & O_DIRECT) if (iocb->ki_filp->f_flags & O_DIRECT)
return nfs_file_direct_read(iocb, iov, nr_segs, pos, true); return nfs_file_direct_read(iocb, iov, nr_segs, pos, true);
dprintk("NFS: read(%s/%s, %lu@%lu)\n", dprintk("NFS: read(%pD2, %lu@%lu)\n",
dentry->d_parent->d_name.name, dentry->d_name.name, iocb->ki_filp,
(unsigned long) iov_length(iov, nr_segs), (unsigned long) pos); (unsigned long) iov_length(iov, nr_segs), (unsigned long) pos);
result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping); result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping);
@ -203,13 +193,11 @@ nfs_file_splice_read(struct file *filp, loff_t *ppos,
struct pipe_inode_info *pipe, size_t count, struct pipe_inode_info *pipe, size_t count,
unsigned int flags) unsigned int flags)
{ {
struct dentry *dentry = filp->f_path.dentry; struct inode *inode = file_inode(filp);
struct inode *inode = dentry->d_inode;
ssize_t res; ssize_t res;
dprintk("NFS: splice_read(%s/%s, %lu@%Lu)\n", dprintk("NFS: splice_read(%pD2, %lu@%Lu)\n",
dentry->d_parent->d_name.name, dentry->d_name.name, filp, (unsigned long) count, (unsigned long long) *ppos);
(unsigned long) count, (unsigned long long) *ppos);
res = nfs_revalidate_mapping(inode, filp->f_mapping); res = nfs_revalidate_mapping(inode, filp->f_mapping);
if (!res) { if (!res) {
@ -224,12 +212,10 @@ EXPORT_SYMBOL_GPL(nfs_file_splice_read);
int int
nfs_file_mmap(struct file * file, struct vm_area_struct * vma) nfs_file_mmap(struct file * file, struct vm_area_struct * vma)
{ {
struct dentry *dentry = file->f_path.dentry; struct inode *inode = file_inode(file);
struct inode *inode = dentry->d_inode;
int status; int status;
dprintk("NFS: mmap(%s/%s)\n", dprintk("NFS: mmap(%pD2)\n", file);
dentry->d_parent->d_name.name, dentry->d_name.name);
/* Note: generic_file_mmap() returns ENOSYS on nommu systems /* Note: generic_file_mmap() returns ENOSYS on nommu systems
* so we call that before revalidating the mapping * so we call that before revalidating the mapping
@ -258,15 +244,12 @@ EXPORT_SYMBOL_GPL(nfs_file_mmap);
int int
nfs_file_fsync_commit(struct file *file, loff_t start, loff_t end, int datasync) nfs_file_fsync_commit(struct file *file, loff_t start, loff_t end, int datasync)
{ {
struct dentry *dentry = file->f_path.dentry;
struct nfs_open_context *ctx = nfs_file_open_context(file); struct nfs_open_context *ctx = nfs_file_open_context(file);
struct inode *inode = dentry->d_inode; struct inode *inode = file_inode(file);
int have_error, do_resend, status; int have_error, do_resend, status;
int ret = 0; int ret = 0;
dprintk("NFS: fsync file(%s/%s) datasync %d\n", dprintk("NFS: fsync file(%pD2) datasync %d\n", file, datasync);
dentry->d_parent->d_name.name, dentry->d_name.name,
datasync);
nfs_inc_stats(inode, NFSIOS_VFSFSYNC); nfs_inc_stats(inode, NFSIOS_VFSFSYNC);
do_resend = test_and_clear_bit(NFS_CONTEXT_RESEND_WRITES, &ctx->flags); do_resend = test_and_clear_bit(NFS_CONTEXT_RESEND_WRITES, &ctx->flags);
@ -371,10 +354,8 @@ static int nfs_write_begin(struct file *file, struct address_space *mapping,
struct page *page; struct page *page;
int once_thru = 0; int once_thru = 0;
dfprintk(PAGECACHE, "NFS: write_begin(%s/%s(%ld), %u@%lld)\n", dfprintk(PAGECACHE, "NFS: write_begin(%pD2(%ld), %u@%lld)\n",
file->f_path.dentry->d_parent->d_name.name, file, mapping->host->i_ino, len, (long long) pos);
file->f_path.dentry->d_name.name,
mapping->host->i_ino, len, (long long) pos);
start: start:
/* /*
@ -414,10 +395,8 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,
struct nfs_open_context *ctx = nfs_file_open_context(file); struct nfs_open_context *ctx = nfs_file_open_context(file);
int status; int status;
dfprintk(PAGECACHE, "NFS: write_end(%s/%s(%ld), %u@%lld)\n", dfprintk(PAGECACHE, "NFS: write_end(%pD2(%ld), %u@%lld)\n",
file->f_path.dentry->d_parent->d_name.name, file, mapping->host->i_ino, len, (long long) pos);
file->f_path.dentry->d_name.name,
mapping->host->i_ino, len, (long long) pos);
/* /*
* Zero any uninitialised parts of the page, and then mark the page * Zero any uninitialised parts of the page, and then mark the page
@ -601,22 +580,21 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
{ {
struct page *page = vmf->page; struct page *page = vmf->page;
struct file *filp = vma->vm_file; struct file *filp = vma->vm_file;
struct dentry *dentry = filp->f_path.dentry; struct inode *inode = file_inode(filp);
unsigned pagelen; unsigned pagelen;
int ret = VM_FAULT_NOPAGE; int ret = VM_FAULT_NOPAGE;
struct address_space *mapping; struct address_space *mapping;
dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%s/%s(%ld), offset %lld)\n", dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%pD2(%ld), offset %lld)\n",
dentry->d_parent->d_name.name, dentry->d_name.name, filp, filp->f_mapping->host->i_ino,
filp->f_mapping->host->i_ino,
(long long)page_offset(page)); (long long)page_offset(page));
/* make sure the cache has finished storing the page */ /* make sure the cache has finished storing the page */
nfs_fscache_wait_on_page_write(NFS_I(dentry->d_inode), page); nfs_fscache_wait_on_page_write(NFS_I(inode), page);
lock_page(page); lock_page(page);
mapping = page_file_mapping(page); mapping = page_file_mapping(page);
if (mapping != dentry->d_inode->i_mapping) if (mapping != inode->i_mapping)
goto out_unlock; goto out_unlock;
wait_on_page_writeback(page); wait_on_page_writeback(page);
@ -659,22 +637,21 @@ static int nfs_need_sync_write(struct file *filp, struct inode *inode)
ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov, ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos) unsigned long nr_segs, loff_t pos)
{ {
struct dentry * dentry = iocb->ki_filp->f_path.dentry; struct file *file = iocb->ki_filp;
struct inode * inode = dentry->d_inode; struct inode *inode = file_inode(file);
unsigned long written = 0; unsigned long written = 0;
ssize_t result; ssize_t result;
size_t count = iov_length(iov, nr_segs); size_t count = iov_length(iov, nr_segs);
result = nfs_key_timeout_notify(iocb->ki_filp, inode); result = nfs_key_timeout_notify(file, inode);
if (result) if (result)
return result; return result;
if (iocb->ki_filp->f_flags & O_DIRECT) if (file->f_flags & O_DIRECT)
return nfs_file_direct_write(iocb, iov, nr_segs, pos, true); return nfs_file_direct_write(iocb, iov, nr_segs, pos, true);
dprintk("NFS: write(%s/%s, %lu@%Ld)\n", dprintk("NFS: write(%pD2, %lu@%Ld)\n",
dentry->d_parent->d_name.name, dentry->d_name.name, file, (unsigned long) count, (long long) pos);
(unsigned long) count, (long long) pos);
result = -EBUSY; result = -EBUSY;
if (IS_SWAPFILE(inode)) if (IS_SWAPFILE(inode))
@ -682,8 +659,8 @@ ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
/* /*
* O_APPEND implies that we must revalidate the file length. * O_APPEND implies that we must revalidate the file length.
*/ */
if (iocb->ki_filp->f_flags & O_APPEND) { if (file->f_flags & O_APPEND) {
result = nfs_revalidate_file_size(inode, iocb->ki_filp); result = nfs_revalidate_file_size(inode, file);
if (result) if (result)
goto out; goto out;
} }
@ -697,8 +674,8 @@ ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
written = result; written = result;
/* Return error values for O_DSYNC and IS_SYNC() */ /* Return error values for O_DSYNC and IS_SYNC() */
if (result >= 0 && nfs_need_sync_write(iocb->ki_filp, inode)) { if (result >= 0 && nfs_need_sync_write(file, inode)) {
int err = vfs_fsync(iocb->ki_filp, 0); int err = vfs_fsync(file, 0);
if (err < 0) if (err < 0)
result = err; result = err;
} }
@ -717,14 +694,12 @@ ssize_t nfs_file_splice_write(struct pipe_inode_info *pipe,
struct file *filp, loff_t *ppos, struct file *filp, loff_t *ppos,
size_t count, unsigned int flags) size_t count, unsigned int flags)
{ {
struct dentry *dentry = filp->f_path.dentry; struct inode *inode = file_inode(filp);
struct inode *inode = dentry->d_inode;
unsigned long written = 0; unsigned long written = 0;
ssize_t ret; ssize_t ret;
dprintk("NFS splice_write(%s/%s, %lu@%llu)\n", dprintk("NFS splice_write(%pD2, %lu@%llu)\n",
dentry->d_parent->d_name.name, dentry->d_name.name, filp, (unsigned long) count, (unsigned long long) *ppos);
(unsigned long) count, (unsigned long long) *ppos);
/* /*
* The combination of splice and an O_APPEND destination is disallowed. * The combination of splice and an O_APPEND destination is disallowed.
@ -883,10 +858,8 @@ int nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
int ret = -ENOLCK; int ret = -ENOLCK;
int is_local = 0; int is_local = 0;
dprintk("NFS: lock(%s/%s, t=%x, fl=%x, r=%lld:%lld)\n", dprintk("NFS: lock(%pD2, t=%x, fl=%x, r=%lld:%lld)\n",
filp->f_path.dentry->d_parent->d_name.name, filp, fl->fl_type, fl->fl_flags,
filp->f_path.dentry->d_name.name,
fl->fl_type, fl->fl_flags,
(long long)fl->fl_start, (long long)fl->fl_end); (long long)fl->fl_start, (long long)fl->fl_end);
nfs_inc_stats(inode, NFSIOS_VFSLOCK); nfs_inc_stats(inode, NFSIOS_VFSLOCK);
@ -923,10 +896,8 @@ int nfs_flock(struct file *filp, int cmd, struct file_lock *fl)
struct inode *inode = filp->f_mapping->host; struct inode *inode = filp->f_mapping->host;
int is_local = 0; int is_local = 0;
dprintk("NFS: flock(%s/%s, t=%x, fl=%x)\n", dprintk("NFS: flock(%pD2, t=%x, fl=%x)\n",
filp->f_path.dentry->d_parent->d_name.name, filp, fl->fl_type, fl->fl_flags);
filp->f_path.dentry->d_name.name,
fl->fl_type, fl->fl_flags);
if (!(fl->fl_flags & FL_FLOCK)) if (!(fl->fl_flags & FL_FLOCK))
return -ENOLCK; return -ENOLCK;
@ -960,9 +931,7 @@ EXPORT_SYMBOL_GPL(nfs_flock);
*/ */
int nfs_setlease(struct file *file, long arg, struct file_lock **fl) int nfs_setlease(struct file *file, long arg, struct file_lock **fl)
{ {
dprintk("NFS: setlease(%s/%s, arg=%ld)\n", dprintk("NFS: setlease(%pD2, arg=%ld)\n", file, arg);
file->f_path.dentry->d_parent->d_name.name,
file->f_path.dentry->d_name.name, arg);
return -EINVAL; return -EINVAL;
} }
EXPORT_SYMBOL_GPL(nfs_setlease); EXPORT_SYMBOL_GPL(nfs_setlease);

View file

@ -253,9 +253,8 @@ struct vfsmount *nfs_do_submount(struct dentry *dentry, struct nfs_fh *fh,
dprintk("--> nfs_do_submount()\n"); dprintk("--> nfs_do_submount()\n");
dprintk("%s: submounting on %s/%s\n", __func__, dprintk("%s: submounting on %pd2\n", __func__,
dentry->d_parent->d_name.name, dentry);
dentry->d_name.name);
if (page == NULL) if (page == NULL)
goto out; goto out;
devname = nfs_devname(dentry, page, PAGE_SIZE); devname = nfs_devname(dentry, page, PAGE_SIZE);

View file

@ -321,7 +321,7 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
umode_t mode = sattr->ia_mode; umode_t mode = sattr->ia_mode;
int status = -ENOMEM; int status = -ENOMEM;
dprintk("NFS call create %s\n", dentry->d_name.name); dprintk("NFS call create %pd\n", dentry);
data = nfs3_alloc_createdata(); data = nfs3_alloc_createdata();
if (data == NULL) if (data == NULL)
@ -548,7 +548,7 @@ nfs3_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page,
if (len > NFS3_MAXPATHLEN) if (len > NFS3_MAXPATHLEN)
return -ENAMETOOLONG; return -ENAMETOOLONG;
dprintk("NFS call symlink %s\n", dentry->d_name.name); dprintk("NFS call symlink %pd\n", dentry);
data = nfs3_alloc_createdata(); data = nfs3_alloc_createdata();
if (data == NULL) if (data == NULL)
@ -576,7 +576,7 @@ nfs3_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr)
umode_t mode = sattr->ia_mode; umode_t mode = sattr->ia_mode;
int status = -ENOMEM; int status = -ENOMEM;
dprintk("NFS call mkdir %s\n", dentry->d_name.name); dprintk("NFS call mkdir %pd\n", dentry);
sattr->ia_mode &= ~current_umask(); sattr->ia_mode &= ~current_umask();
@ -695,7 +695,7 @@ nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
umode_t mode = sattr->ia_mode; umode_t mode = sattr->ia_mode;
int status = -ENOMEM; int status = -ENOMEM;
dprintk("NFS call mknod %s %u:%u\n", dentry->d_name.name, dprintk("NFS call mknod %pd %u:%u\n", dentry,
MAJOR(rdev), MINOR(rdev)); MAJOR(rdev), MINOR(rdev));
sattr->ia_mode &= ~current_umask(); sattr->ia_mode &= ~current_umask();

View file

@ -31,9 +31,7 @@ nfs4_file_open(struct inode *inode, struct file *filp)
* -EOPENSTALE. The VFS will retry the lookup/create/open. * -EOPENSTALE. The VFS will retry the lookup/create/open.
*/ */
dprintk("NFS: open file(%s/%s)\n", dprintk("NFS: open file(%pd2)\n", dentry);
dentry->d_parent->d_name.name,
dentry->d_name.name);
if ((openflags & O_ACCMODE) == 3) if ((openflags & O_ACCMODE) == 3)
openflags--; openflags--;

View file

@ -283,8 +283,7 @@ static struct vfsmount *nfs_follow_referral(struct dentry *dentry,
if (locations == NULL || locations->nlocations <= 0) if (locations == NULL || locations->nlocations <= 0)
goto out; goto out;
dprintk("%s: referral at %s/%s\n", __func__, dprintk("%s: referral at %pd2\n", __func__, dentry);
dentry->d_parent->d_name.name, dentry->d_name.name);
page = (char *) __get_free_page(GFP_USER); page = (char *) __get_free_page(GFP_USER);
if (!page) if (!page)
@ -348,8 +347,8 @@ static struct vfsmount *nfs_do_refmount(struct rpc_clnt *client, struct dentry *
mnt = ERR_PTR(-ENOENT); mnt = ERR_PTR(-ENOENT);
parent = dget_parent(dentry); parent = dget_parent(dentry);
dprintk("%s: getting locations for %s/%s\n", dprintk("%s: getting locations for %pd2\n",
__func__, parent->d_name.name, dentry->d_name.name); __func__, dentry);
err = nfs4_proc_fs_locations(client, parent->d_inode, &dentry->d_name, fs_locations, page); err = nfs4_proc_fs_locations(client, parent->d_inode, &dentry->d_name, fs_locations, page);
dput(parent); dput(parent);

View file

@ -3738,9 +3738,8 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
}; };
int status; int status;
dprintk("%s: dentry = %s/%s, cookie = %Lu\n", __func__, dprintk("%s: dentry = %pd2, cookie = %Lu\n", __func__,
dentry->d_parent->d_name.name, dentry,
dentry->d_name.name,
(unsigned long long)cookie); (unsigned long long)cookie);
nfs4_setup_readdir(cookie, NFS_I(dir)->cookieverf, dentry, &args); nfs4_setup_readdir(cookie, NFS_I(dir)->cookieverf, dentry, &args);
res.pgbase = args.pgbase; res.pgbase = args.pgbase;

View file

@ -235,7 +235,7 @@ nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
}; };
int status = -ENOMEM; int status = -ENOMEM;
dprintk("NFS call create %s\n", dentry->d_name.name); dprintk("NFS call create %pd\n", dentry);
data = nfs_alloc_createdata(dir, dentry, sattr); data = nfs_alloc_createdata(dir, dentry, sattr);
if (data == NULL) if (data == NULL)
goto out; goto out;
@ -265,7 +265,7 @@ nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
umode_t mode; umode_t mode;
int status = -ENOMEM; int status = -ENOMEM;
dprintk("NFS call mknod %s\n", dentry->d_name.name); dprintk("NFS call mknod %pd\n", dentry);
mode = sattr->ia_mode; mode = sattr->ia_mode;
if (S_ISFIFO(mode)) { if (S_ISFIFO(mode)) {
@ -423,7 +423,7 @@ nfs_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page,
}; };
int status = -ENAMETOOLONG; int status = -ENAMETOOLONG;
dprintk("NFS call symlink %s\n", dentry->d_name.name); dprintk("NFS call symlink %pd\n", dentry);
if (len > NFS2_MAXPATHLEN) if (len > NFS2_MAXPATHLEN)
goto out; goto out;
@ -462,7 +462,7 @@ nfs_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr)
}; };
int status = -ENOMEM; int status = -ENOMEM;
dprintk("NFS call mkdir %s\n", dentry->d_name.name); dprintk("NFS call mkdir %pd\n", dentry);
data = nfs_alloc_createdata(dir, dentry, sattr); data = nfs_alloc_createdata(dir, dentry, sattr);
if (data == NULL) if (data == NULL)
goto out; goto out;

View file

@ -495,9 +495,8 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry)
struct rpc_task *task; struct rpc_task *task;
int error = -EIO; int error = -EIO;
dfprintk(VFS, "NFS: silly-rename(%s/%s, ct=%d)\n", dfprintk(VFS, "NFS: silly-rename(%pd2, ct=%d)\n",
dentry->d_parent->d_name.name, dentry->d_name.name, dentry, d_count(dentry));
d_count(dentry));
nfs_inc_stats(dir, NFSIOS_SILLYRENAME); nfs_inc_stats(dir, NFSIOS_SILLYRENAME);
/* /*
@ -522,8 +521,8 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry)
SILLYNAME_FILEID_LEN, fileid, SILLYNAME_FILEID_LEN, fileid,
SILLYNAME_COUNTER_LEN, sillycounter); SILLYNAME_COUNTER_LEN, sillycounter);
dfprintk(VFS, "NFS: trying to rename %s to %s\n", dfprintk(VFS, "NFS: trying to rename %pd to %s\n",
dentry->d_name.name, silly); dentry, silly);
sdentry = lookup_one_len(silly, dentry->d_parent, slen); sdentry = lookup_one_len(silly, dentry->d_parent, slen);
/* /*

View file

@ -954,10 +954,8 @@ int nfs_updatepage(struct file *file, struct page *page,
nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE); nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE);
dprintk("NFS: nfs_updatepage(%s/%s %d@%lld)\n", dprintk("NFS: nfs_updatepage(%pD2 %d@%lld)\n",
file->f_path.dentry->d_parent->d_name.name, file, count, (long long)(page_file_offset(page) + offset));
file->f_path.dentry->d_name.name, count,
(long long)(page_file_offset(page) + offset));
if (nfs_can_extend_write(file, page, inode)) { if (nfs_can_extend_write(file, page, inode)) {
count = max(count + offset, nfs_page_length(page)); count = max(count + offset, nfs_page_length(page));