Skip to content

Commit

Permalink
make new_sync_{read,write}() static
Browse files Browse the repository at this point in the history
All places outside of core VFS that checked ->read and ->write for being NULL or
called the methods directly are gone now, so NULL {read,write} with non-NULL
{read,write}_iter will do the right thing in all cases.

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Apr 12, 2015
1 parent 86cc058 commit 5d5d568
Show file tree
Hide file tree
Showing 59 changed files with 11 additions and 153 deletions.
9 changes: 9 additions & 0 deletions Documentation/filesystems/porting
Original file line number Diff line number Diff line change
Expand Up @@ -471,3 +471,12 @@ in your dentry operations instead.
[mandatory]
f_dentry is gone; use f_path.dentry, or, better yet, see if you can avoid
it entirely.
--
[mandatory]
never call ->read() and ->write() directly; use __vfs_{read,write} or
wrappers; instead of checking for ->write or ->read being NULL, look for
FMODE_CAN_{WRITE,READ} in file->f_mode.
--
[mandatory]
do _not_ use new_sync_{read,write} for ->read/->write; leave it NULL
instead.
2 changes: 0 additions & 2 deletions arch/s390/hypfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,6 @@ struct dentry *hypfs_create_str(struct dentry *dir,
static const struct file_operations hypfs_file_ops = {
.open = hypfs_open,
.release = hypfs_release,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = hypfs_read_iter,
.write_iter = hypfs_write_iter,
.llseek = no_llseek,
Expand Down
2 changes: 0 additions & 2 deletions drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,6 @@ static const struct file_operations __maybe_unused port_fops = {

static const struct file_operations zero_fops = {
.llseek = zero_lseek,
.read = new_sync_read,
.write = write_zero,
.read_iter = read_iter_zero,
.aio_write = aio_write_zero,
Expand All @@ -776,7 +775,6 @@ static const struct file_operations zero_fops = {

static const struct file_operations full_fops = {
.llseek = full_lseek,
.read = new_sync_read,
.read_iter = read_iter_zero,
.write = write_full,
};
Expand Down
2 changes: 0 additions & 2 deletions drivers/char/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,7 @@ static long raw_ctl_compat_ioctl(struct file *file, unsigned int cmd,
#endif

static const struct file_operations raw_fops = {
.read = new_sync_read,
.read_iter = blkdev_read_iter,
.write = new_sync_write,
.write_iter = blkdev_write_iter,
.fsync = blkdev_fsync,
.open = raw_open,
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/macvtap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,8 +1118,6 @@ static const struct file_operations macvtap_fops = {
.owner = THIS_MODULE,
.open = macvtap_open,
.release = macvtap_release,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = macvtap_read_iter,
.write_iter = macvtap_write_iter,
.poll = macvtap_poll,
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -2223,8 +2223,6 @@ static void tun_chr_show_fdinfo(struct seq_file *m, struct file *f)
static const struct file_operations tun_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = tun_chr_read_iter,
.write_iter = tun_chr_write_iter,
.poll = tun_chr_poll,
Expand Down
6 changes: 0 additions & 6 deletions drivers/staging/lustre/lustre/llite/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3128,9 +3128,7 @@ int ll_inode_permission(struct inode *inode, int mask)

/* -o localflock - only provides locally consistent flock locks */
struct file_operations ll_file_operations = {
.read = new_sync_read,
.read_iter = ll_file_read_iter,
.write = new_sync_write,
.write_iter = ll_file_write_iter,
.unlocked_ioctl = ll_file_ioctl,
.open = ll_file_open,
Expand All @@ -3143,9 +3141,7 @@ struct file_operations ll_file_operations = {
};

struct file_operations ll_file_operations_flock = {
.read = new_sync_read,
.read_iter = ll_file_read_iter,
.write = new_sync_write,
.write_iter = ll_file_write_iter,
.unlocked_ioctl = ll_file_ioctl,
.open = ll_file_open,
Expand All @@ -3161,9 +3157,7 @@ struct file_operations ll_file_operations_flock = {

/* These are for -o noflock - to return ENOSYS on flock calls */
struct file_operations ll_file_operations_noflock = {
.read = new_sync_read,
.read_iter = ll_file_read_iter,
.write = new_sync_write,
.write_iter = ll_file_write_iter,
.unlocked_ioctl = ll_file_ioctl,
.open = ll_file_open,
Expand Down
2 changes: 0 additions & 2 deletions drivers/usb/gadget/function/f_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,8 +1061,6 @@ static const struct file_operations ffs_epfile_operations = {
.llseek = no_llseek,

.open = ffs_epfile_open,
.write = new_sync_write,
.read = new_sync_read,
.write_iter = ffs_epfile_write_iter,
.read_iter = ffs_epfile_read_iter,
.release = ffs_epfile_release,
Expand Down
2 changes: 0 additions & 2 deletions drivers/usb/gadget/legacy/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,6 @@ static const struct file_operations ep_io_operations = {
.open = ep_open,
.release = ep_release,
.llseek = no_llseek,
.read = new_sync_read,
.write = new_sync_write,
.unlocked_ioctl = ep_ioctl,
.read_iter = ep_read_iter,
.write_iter = ep_write_iter,
Expand Down
12 changes: 0 additions & 12 deletions fs/9p/vfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,6 @@ static const struct vm_operations_struct v9fs_mmap_file_vm_ops = {

const struct file_operations v9fs_cached_file_operations = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = generic_file_read_iter,
.write_iter = generic_file_write_iter,
.open = v9fs_file_open,
Expand All @@ -654,8 +652,6 @@ const struct file_operations v9fs_cached_file_operations = {

const struct file_operations v9fs_cached_file_operations_dotl = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = generic_file_read_iter,
.write_iter = generic_file_write_iter,
.open = v9fs_file_open,
Expand All @@ -668,8 +664,6 @@ const struct file_operations v9fs_cached_file_operations_dotl = {

const struct file_operations v9fs_file_operations = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = v9fs_file_read_iter,
.write_iter = v9fs_file_write_iter,
.open = v9fs_file_open,
Expand All @@ -681,8 +675,6 @@ const struct file_operations v9fs_file_operations = {

const struct file_operations v9fs_file_operations_dotl = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = v9fs_file_read_iter,
.write_iter = v9fs_file_write_iter,
.open = v9fs_file_open,
Expand All @@ -695,8 +687,6 @@ const struct file_operations v9fs_file_operations_dotl = {

const struct file_operations v9fs_mmap_file_operations = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = v9fs_mmap_file_read_iter,
.write_iter = v9fs_mmap_file_write_iter,
.open = v9fs_file_open,
Expand All @@ -708,8 +698,6 @@ const struct file_operations v9fs_mmap_file_operations = {

const struct file_operations v9fs_mmap_file_operations_dotl = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = v9fs_mmap_file_read_iter,
.write_iter = v9fs_mmap_file_write_iter,
.open = v9fs_file_open,
Expand Down
2 changes: 0 additions & 2 deletions fs/adfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@

const struct file_operations adfs_file_operations = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.read_iter = generic_file_read_iter,
.mmap = generic_file_mmap,
.fsync = generic_file_fsync,
.write = new_sync_write,
.write_iter = generic_file_write_iter,
.splice_read = generic_file_splice_read,
};
Expand Down
2 changes: 0 additions & 2 deletions fs/affs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,9 +969,7 @@ int affs_file_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
}
const struct file_operations affs_file_operations = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.read_iter = generic_file_read_iter,
.write = new_sync_write,
.write_iter = generic_file_write_iter,
.mmap = generic_file_mmap,
.open = affs_file_open,
Expand Down
2 changes: 0 additions & 2 deletions fs/afs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ const struct file_operations afs_file_operations = {
.open = afs_open,
.release = afs_release,
.llseek = generic_file_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = generic_file_read_iter,
.write_iter = afs_file_write,
.mmap = generic_file_readonly_mmap,
Expand Down
2 changes: 0 additions & 2 deletions fs/bfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@

const struct file_operations bfs_file_operations = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.read_iter = generic_file_read_iter,
.write = new_sync_write,
.write_iter = generic_file_write_iter,
.mmap = generic_file_mmap,
.splice_read = generic_file_splice_read,
Expand Down
2 changes: 0 additions & 2 deletions fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1659,8 +1659,6 @@ const struct file_operations def_blk_fops = {
.open = blkdev_open,
.release = blkdev_close,
.llseek = block_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = blkdev_read_iter,
.write_iter = blkdev_write_iter,
.mmap = generic_file_mmap,
Expand Down
2 changes: 0 additions & 2 deletions fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -2806,8 +2806,6 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int whence)

const struct file_operations btrfs_file_operations = {
.llseek = btrfs_file_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = generic_file_read_iter,
.splice_read = generic_file_splice_read,
.write_iter = btrfs_file_write_iter,
Expand Down
2 changes: 0 additions & 2 deletions fs/ceph/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1331,8 +1331,6 @@ const struct file_operations ceph_file_fops = {
.open = ceph_open,
.release = ceph_release,
.llseek = ceph_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = ceph_read_iter,
.write_iter = ceph_write_iter,
.mmap = ceph_mmap,
Expand Down
12 changes: 0 additions & 12 deletions fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,8 +906,6 @@ const struct inode_operations cifs_symlink_inode_ops = {
};

const struct file_operations cifs_file_ops = {
.read = new_sync_read,
.write = new_sync_write,
.read_iter = cifs_loose_read_iter,
.write_iter = cifs_file_write_iter,
.open = cifs_open,
Expand All @@ -926,8 +924,6 @@ const struct file_operations cifs_file_ops = {
};

const struct file_operations cifs_file_strict_ops = {
.read = new_sync_read,
.write = new_sync_write,
.read_iter = cifs_strict_readv,
.write_iter = cifs_strict_writev,
.open = cifs_open,
Expand All @@ -947,8 +943,6 @@ const struct file_operations cifs_file_strict_ops = {

const struct file_operations cifs_file_direct_ops = {
/* BB reevaluate whether they can be done with directio, no cache */
.read = new_sync_read,
.write = new_sync_write,
.read_iter = cifs_user_readv,
.write_iter = cifs_user_writev,
.open = cifs_open,
Expand All @@ -967,8 +961,6 @@ const struct file_operations cifs_file_direct_ops = {
};

const struct file_operations cifs_file_nobrl_ops = {
.read = new_sync_read,
.write = new_sync_write,
.read_iter = cifs_loose_read_iter,
.write_iter = cifs_file_write_iter,
.open = cifs_open,
Expand All @@ -986,8 +978,6 @@ const struct file_operations cifs_file_nobrl_ops = {
};

const struct file_operations cifs_file_strict_nobrl_ops = {
.read = new_sync_read,
.write = new_sync_write,
.read_iter = cifs_strict_readv,
.write_iter = cifs_strict_writev,
.open = cifs_open,
Expand All @@ -1006,8 +996,6 @@ const struct file_operations cifs_file_strict_nobrl_ops = {

const struct file_operations cifs_file_direct_nobrl_ops = {
/* BB reevaluate whether they can be done with directio, no cache */
.read = new_sync_read,
.write = new_sync_write,
.read_iter = cifs_user_readv,
.write_iter = cifs_user_writev,
.open = cifs_open,
Expand Down
2 changes: 0 additions & 2 deletions fs/coda/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync)

const struct file_operations coda_file_operations = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = coda_file_read_iter,
.write_iter = coda_file_write_iter,
.mmap = coda_file_mmap,
Expand Down
2 changes: 0 additions & 2 deletions fs/ecryptfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,7 @@ const struct file_operations ecryptfs_dir_fops = {

const struct file_operations ecryptfs_main_fops = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.read_iter = ecryptfs_read_update_atime,
.write = new_sync_write,
.write_iter = generic_file_write_iter,
.iterate = ecryptfs_readdir,
.unlocked_ioctl = ecryptfs_unlocked_ioctl,
Expand Down
2 changes: 0 additions & 2 deletions fs/exofs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ static int exofs_flush(struct file *file, fl_owner_t id)

const struct file_operations exofs_file_operations = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = generic_file_read_iter,
.write_iter = generic_file_write_iter,
.mmap = generic_file_mmap,
Expand Down
4 changes: 0 additions & 4 deletions fs/ext2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ int ext2_fsync(struct file *file, loff_t start, loff_t end, int datasync)
*/
const struct file_operations ext2_file_operations = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = generic_file_read_iter,
.write_iter = generic_file_write_iter,
.unlocked_ioctl = ext2_ioctl,
Expand All @@ -111,8 +109,6 @@ const struct file_operations ext2_file_operations = {
#ifdef CONFIG_FS_DAX
const struct file_operations ext2_dax_file_operations = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = generic_file_read_iter,
.write_iter = generic_file_write_iter,
.unlocked_ioctl = ext2_ioctl,
Expand Down
2 changes: 0 additions & 2 deletions fs/ext3/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ static int ext3_release_file (struct inode * inode, struct file * filp)

const struct file_operations ext3_file_operations = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = generic_file_read_iter,
.write_iter = generic_file_write_iter,
.unlocked_ioctl = ext3_ioctl,
Expand Down
4 changes: 0 additions & 4 deletions fs/ext4/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,6 @@ loff_t ext4_llseek(struct file *file, loff_t offset, int whence)

const struct file_operations ext4_file_operations = {
.llseek = ext4_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = generic_file_read_iter,
.write_iter = ext4_file_write_iter,
.unlocked_ioctl = ext4_ioctl,
Expand All @@ -627,8 +625,6 @@ const struct file_operations ext4_file_operations = {
#ifdef CONFIG_FS_DAX
const struct file_operations ext4_dax_file_operations = {
.llseek = ext4_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = generic_file_read_iter,
.write_iter = ext4_file_write_iter,
.unlocked_ioctl = ext4_ioctl,
Expand Down
2 changes: 0 additions & 2 deletions fs/f2fs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1104,8 +1104,6 @@ long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)

const struct file_operations f2fs_file_operations = {
.llseek = f2fs_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = generic_file_read_iter,
.write_iter = generic_file_write_iter,
.open = generic_file_open,
Expand Down
2 changes: 0 additions & 2 deletions fs/fat/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ int fat_file_fsync(struct file *filp, loff_t start, loff_t end, int datasync)

const struct file_operations fat_file_operations = {
.llseek = generic_file_llseek,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = generic_file_read_iter,
.write_iter = generic_file_write_iter,
.mmap = generic_file_mmap,
Expand Down
2 changes: 0 additions & 2 deletions fs/fuse/cuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ static long cuse_file_compat_ioctl(struct file *file, unsigned int cmd,

static const struct file_operations cuse_frontend_fops = {
.owner = THIS_MODULE,
.read = new_sync_read,
.write = new_sync_write,
.read_iter = cuse_read_iter,
.write_iter = cuse_write_iter,
.open = cuse_open,
Expand Down
Loading

0 comments on commit 5d5d568

Please sign in to comment.