diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-15 16:22:56 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-15 16:22:56 -0400 |
| commit | fa927894bbb4a4c7669c72bad1924991022fda38 (patch) | |
| tree | 93560f1a096973235fe9ff50c436f5239c1c499a /drivers/block/loop.c | |
| parent | c841e12add6926d64aa608687893465330b5a03e (diff) | |
| parent | 8436318205b9f29e45db88850ec60e326327e241 (diff) | |
Merge branch 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
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
...
Diffstat (limited to 'drivers/block/loop.c')
| -rw-r--r-- | drivers/block/loop.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index d1f168b73634..c4fd1e45ce1e 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
| @@ -75,6 +75,7 @@ | |||
| 75 | #include <linux/sysfs.h> | 75 | #include <linux/sysfs.h> |
| 76 | #include <linux/miscdevice.h> | 76 | #include <linux/miscdevice.h> |
| 77 | #include <linux/falloc.h> | 77 | #include <linux/falloc.h> |
| 78 | #include <linux/uio.h> | ||
| 78 | #include "loop.h" | 79 | #include "loop.h" |
| 79 | 80 | ||
| 80 | #include <asm/uaccess.h> | 81 | #include <asm/uaccess.h> |
| @@ -229,13 +230,14 @@ lo_do_transfer(struct loop_device *lo, int cmd, | |||
| 229 | static int __do_lo_send_write(struct file *file, | 230 | static int __do_lo_send_write(struct file *file, |
| 230 | u8 *buf, const int len, loff_t pos) | 231 | u8 *buf, const int len, loff_t pos) |
| 231 | { | 232 | { |
| 233 | struct kvec kvec = {.iov_base = buf, .iov_len = len}; | ||
| 234 | struct iov_iter from; | ||
| 232 | ssize_t bw; | 235 | ssize_t bw; |
| 233 | mm_segment_t old_fs = get_fs(); | 236 | |
| 237 | iov_iter_kvec(&from, ITER_KVEC | WRITE, &kvec, 1, len); | ||
| 234 | 238 | ||
| 235 | file_start_write(file); | 239 | file_start_write(file); |
| 236 | set_fs(get_ds()); | 240 | bw = vfs_iter_write(file, &from, &pos); |
| 237 | bw = file->f_op->write(file, buf, len, &pos); | ||
| 238 | set_fs(old_fs); | ||
| 239 | file_end_write(file); | 241 | file_end_write(file); |
| 240 | if (likely(bw == len)) | 242 | if (likely(bw == len)) |
| 241 | return 0; | 243 | return 0; |
| @@ -767,7 +769,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, | |||
| 767 | goto out_putf; | 769 | goto out_putf; |
| 768 | 770 | ||
| 769 | if (!(file->f_mode & FMODE_WRITE) || !(mode & FMODE_WRITE) || | 771 | if (!(file->f_mode & FMODE_WRITE) || !(mode & FMODE_WRITE) || |
| 770 | !file->f_op->write) | 772 | !file->f_op->write_iter) |
| 771 | lo_flags |= LO_FLAGS_READ_ONLY; | 773 | lo_flags |= LO_FLAGS_READ_ONLY; |
| 772 | 774 | ||
| 773 | lo_blocksize = S_ISBLK(inode->i_mode) ? | 775 | lo_blocksize = S_ISBLK(inode->i_mode) ? |
