diff options
Diffstat (limited to 'fs/read_write.c')
-rw-r--r-- | fs/read_write.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index 7d9318c3d43c..c0805c93b6fa 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -412,6 +412,23 @@ ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *p | |||
412 | 412 | ||
413 | EXPORT_SYMBOL(new_sync_read); | 413 | EXPORT_SYMBOL(new_sync_read); |
414 | 414 | ||
415 | ssize_t __vfs_read(struct file *file, char __user *buf, size_t count, | ||
416 | loff_t *pos) | ||
417 | { | ||
418 | ssize_t ret; | ||
419 | |||
420 | if (file->f_op->read) | ||
421 | ret = file->f_op->read(file, buf, count, pos); | ||
422 | else if (file->f_op->aio_read) | ||
423 | ret = do_sync_read(file, buf, count, pos); | ||
424 | else if (file->f_op->read_iter) | ||
425 | ret = new_sync_read(file, buf, count, pos); | ||
426 | else | ||
427 | ret = -EINVAL; | ||
428 | |||
429 | return ret; | ||
430 | } | ||
431 | |||
415 | ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos) | 432 | ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos) |
416 | { | 433 | { |
417 | ssize_t ret; | 434 | ssize_t ret; |
@@ -426,12 +443,7 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos) | |||
426 | ret = rw_verify_area(READ, file, pos, count); | 443 | ret = rw_verify_area(READ, file, pos, count); |
427 | if (ret >= 0) { | 444 | if (ret >= 0) { |
428 | count = ret; | 445 | count = ret; |
429 | if (file->f_op->read) | 446 | ret = __vfs_read(file, buf, count, pos); |
430 | ret = file->f_op->read(file, buf, count, pos); | ||
431 | else if (file->f_op->aio_read) | ||
432 | ret = do_sync_read(file, buf, count, pos); | ||
433 | else | ||
434 | ret = new_sync_read(file, buf, count, pos); | ||
435 | if (ret > 0) { | 447 | if (ret > 0) { |
436 | fsnotify_access(file); | 448 | fsnotify_access(file); |
437 | add_rchar(current, ret); | 449 | add_rchar(current, ret); |