Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa927894 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull second vfs update from Al Viro:
 "Now that net-next went in...  Here's the next big chunk - killing
  ->aio_read() and ->aio_write().

  There'll be one more pile today (direct_IO changes and
  generic_write_checks() cleanups/fixes), but I'd prefer to keep that
  one separate"

* 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (37 commits)
  ->aio_read and ->aio_write removed
  pcm: another weird API abuse
  infinibad: weird APIs switched to ->write_iter()
  kill do_sync_read/do_sync_write
  fuse: use iov_iter_get_pages() for non-splice path
  fuse: switch to ->read_iter/->write_iter
  switch drivers/char/mem.c to ->read_iter/->write_iter
  make new_sync_{read,write}() static
  coredump: accept any write method
  switch /dev/loop to vfs_iter_write()
  serial2002: switch to __vfs_read/__vfs_write
  ashmem: use __vfs_read()
  export __vfs_read()
  autofs: switch to __vfs_write()
  new helper: __vfs_write()
  switch hugetlbfs to ->read_iter()
  coda: switch to ->read_iter/->write_iter
  ncpfs: switch to ->read_iter/->write_iter
  net/9p: remove (now-)unused helpers
  p9_client_attach(): set fid->uid correctly
  ...
parents c841e12a 84363182
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -429,8 +429,6 @@ prototypes:
	loff_t (*llseek) (struct file *, loff_t, int);
	loff_t (*llseek) (struct file *, loff_t, int);
	ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
	ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
	ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
	ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
	ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
	ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
	ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
	ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
	ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
	ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
	int (*iterate) (struct file *, struct dir_context *);
	int (*iterate) (struct file *, struct dir_context *);
+12 −0
Original line number Original line Diff line number Diff line
@@ -471,3 +471,15 @@ in your dentry operations instead.
[mandatory]
[mandatory]
	f_dentry is gone; use f_path.dentry, or, better yet, see if you can avoid
	f_dentry is gone; use f_path.dentry, or, better yet, see if you can avoid
	it entirely.
	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.
--
[mandatory]
	->aio_read/->aio_write are gone.  Use ->read_iter/->write_iter.
+0 −6
Original line number Original line Diff line number Diff line
@@ -804,8 +804,6 @@ struct file_operations {
	loff_t (*llseek) (struct file *, loff_t, int);
	loff_t (*llseek) (struct file *, loff_t, int);
	ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
	ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
	ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
	ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
	ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
	ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
	ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
	ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
	ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
	ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
	int (*iterate) (struct file *, struct dir_context *);
	int (*iterate) (struct file *, struct dir_context *);
@@ -838,14 +836,10 @@ otherwise noted.


  read: called by read(2) and related system calls
  read: called by read(2) and related system calls


  aio_read: vectored, possibly asynchronous read

  read_iter: possibly asynchronous read with iov_iter as destination
  read_iter: possibly asynchronous read with iov_iter as destination


  write: called by write(2) and related system calls
  write: called by write(2) and related system calls


  aio_write: vectored, possibly asynchronous write

  write_iter: possibly asynchronous write with iov_iter as source
  write_iter: possibly asynchronous write with iov_iter as source


  iterate: called when the VFS needs to read the directory contents
  iterate: called when the VFS needs to read the directory contents
+0 −2
Original line number Original line Diff line number Diff line
@@ -437,8 +437,6 @@ struct dentry *hypfs_create_str(struct dentry *dir,
static const struct file_operations hypfs_file_ops = {
static const struct file_operations hypfs_file_ops = {
	.open		= hypfs_open,
	.open		= hypfs_open,
	.release	= hypfs_release,
	.release	= hypfs_release,
	.read		= new_sync_read,
	.write		= new_sync_write,
	.read_iter	= hypfs_read_iter,
	.read_iter	= hypfs_read_iter,
	.write_iter	= hypfs_write_iter,
	.write_iter	= hypfs_write_iter,
	.llseek		= no_llseek,
	.llseek		= no_llseek,
+7 −5
Original line number Original line Diff line number Diff line
@@ -75,6 +75,7 @@
#include <linux/sysfs.h>
#include <linux/sysfs.h>
#include <linux/miscdevice.h>
#include <linux/miscdevice.h>
#include <linux/falloc.h>
#include <linux/falloc.h>
#include <linux/uio.h>
#include "loop.h"
#include "loop.h"


#include <asm/uaccess.h>
#include <asm/uaccess.h>
@@ -229,13 +230,14 @@ lo_do_transfer(struct loop_device *lo, int cmd,
static int __do_lo_send_write(struct file *file,
static int __do_lo_send_write(struct file *file,
		u8 *buf, const int len, loff_t pos)
		u8 *buf, const int len, loff_t pos)
{
{
	struct kvec kvec = {.iov_base = buf, .iov_len = len};
	struct iov_iter from;
	ssize_t bw;
	ssize_t bw;
	mm_segment_t old_fs = get_fs();

	iov_iter_kvec(&from, ITER_KVEC | WRITE, &kvec, 1, len);


	file_start_write(file);
	file_start_write(file);
	set_fs(get_ds());
	bw = vfs_iter_write(file, &from, &pos);
	bw = file->f_op->write(file, buf, len, &pos);
	set_fs(old_fs);
	file_end_write(file);
	file_end_write(file);
	if (likely(bw == len))
	if (likely(bw == len))
		return 0;
		return 0;
@@ -767,7 +769,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
		goto out_putf;
		goto out_putf;


	if (!(file->f_mode & FMODE_WRITE) || !(mode & FMODE_WRITE) ||
	if (!(file->f_mode & FMODE_WRITE) || !(mode & FMODE_WRITE) ||
	    !file->f_op->write)
	    !file->f_op->write_iter)
		lo_flags |= LO_FLAGS_READ_ONLY;
		lo_flags |= LO_FLAGS_READ_ONLY;


	lo_blocksize = S_ISBLK(inode->i_mode) ?
	lo_blocksize = S_ISBLK(inode->i_mode) ?
Loading