dcache_{readdir,dir_lseek}() users: switch to ->iterate_shared

no need to lock directory in dcache_dir_lseek(), while we are
at it - per-struct file exclusion is enough.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2016-04-20 19:52:15 -04:00
parent 3125d2650c
commit 4e82901cd6
3 changed files with 4 additions and 7 deletions

View File

@ -238,7 +238,7 @@ const struct file_operations spufs_context_fops = {
.release = spufs_dir_close, .release = spufs_dir_close,
.llseek = dcache_dir_lseek, .llseek = dcache_dir_lseek,
.read = generic_read_dir, .read = generic_read_dir,
.iterate = dcache_readdir, .iterate_shared = dcache_readdir,
.fsync = noop_fsync, .fsync = noop_fsync,
}; };
EXPORT_SYMBOL_GPL(spufs_context_fops); EXPORT_SYMBOL_GPL(spufs_context_fops);

View File

@ -39,7 +39,7 @@ const struct file_operations autofs4_root_operations = {
.open = dcache_dir_open, .open = dcache_dir_open,
.release = dcache_dir_close, .release = dcache_dir_close,
.read = generic_read_dir, .read = generic_read_dir,
.iterate = dcache_readdir, .iterate_shared = dcache_readdir,
.llseek = dcache_dir_lseek, .llseek = dcache_dir_lseek,
.unlocked_ioctl = autofs4_root_ioctl, .unlocked_ioctl = autofs4_root_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
@ -51,7 +51,7 @@ const struct file_operations autofs4_dir_operations = {
.open = autofs4_dir_open, .open = autofs4_dir_open,
.release = dcache_dir_close, .release = dcache_dir_close,
.read = generic_read_dir, .read = generic_read_dir,
.iterate = dcache_readdir, .iterate_shared = dcache_readdir,
.llseek = dcache_dir_lseek, .llseek = dcache_dir_lseek,
}; };

View File

@ -89,7 +89,6 @@ EXPORT_SYMBOL(dcache_dir_close);
loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
{ {
struct dentry *dentry = file->f_path.dentry; struct dentry *dentry = file->f_path.dentry;
inode_lock(d_inode(dentry));
switch (whence) { switch (whence) {
case 1: case 1:
offset += file->f_pos; offset += file->f_pos;
@ -97,7 +96,6 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
if (offset >= 0) if (offset >= 0)
break; break;
default: default:
inode_unlock(d_inode(dentry));
return -EINVAL; return -EINVAL;
} }
if (offset != file->f_pos) { if (offset != file->f_pos) {
@ -124,7 +122,6 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
} }
} }
inode_unlock(d_inode(dentry));
return offset; return offset;
} }
EXPORT_SYMBOL(dcache_dir_lseek); EXPORT_SYMBOL(dcache_dir_lseek);
@ -190,7 +187,7 @@ const struct file_operations simple_dir_operations = {
.release = dcache_dir_close, .release = dcache_dir_close,
.llseek = dcache_dir_lseek, .llseek = dcache_dir_lseek,
.read = generic_read_dir, .read = generic_read_dir,
.iterate = dcache_readdir, .iterate_shared = dcache_readdir,
.fsync = noop_fsync, .fsync = noop_fsync,
}; };
EXPORT_SYMBOL(simple_dir_operations); EXPORT_SYMBOL(simple_dir_operations);