diff options
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r-- | fs/nfs/file.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index e679d24c39d3..c40e4363e746 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/nfs_mount.h> | 26 | #include <linux/nfs_mount.h> |
27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
28 | #include <linux/pagemap.h> | 28 | #include <linux/pagemap.h> |
29 | #include <linux/aio.h> | ||
30 | #include <linux/gfp.h> | 29 | #include <linux/gfp.h> |
31 | #include <linux/swap.h> | 30 | #include <linux/swap.h> |
32 | 31 | ||
@@ -171,7 +170,7 @@ nfs_file_read(struct kiocb *iocb, struct iov_iter *to) | |||
171 | struct inode *inode = file_inode(iocb->ki_filp); | 170 | struct inode *inode = file_inode(iocb->ki_filp); |
172 | ssize_t result; | 171 | ssize_t result; |
173 | 172 | ||
174 | if (iocb->ki_filp->f_flags & O_DIRECT) | 173 | if (iocb->ki_flags & IOCB_DIRECT) |
175 | return nfs_file_direct_read(iocb, to, iocb->ki_pos); | 174 | return nfs_file_direct_read(iocb, to, iocb->ki_pos); |
176 | 175 | ||
177 | dprintk("NFS: read(%pD2, %zu@%lu)\n", | 176 | dprintk("NFS: read(%pD2, %zu@%lu)\n", |
@@ -675,17 +674,20 @@ ssize_t nfs_file_write(struct kiocb *iocb, struct iov_iter *from) | |||
675 | unsigned long written = 0; | 674 | unsigned long written = 0; |
676 | ssize_t result; | 675 | ssize_t result; |
677 | size_t count = iov_iter_count(from); | 676 | size_t count = iov_iter_count(from); |
678 | loff_t pos = iocb->ki_pos; | ||
679 | 677 | ||
680 | result = nfs_key_timeout_notify(file, inode); | 678 | result = nfs_key_timeout_notify(file, inode); |
681 | if (result) | 679 | if (result) |
682 | return result; | 680 | return result; |
683 | 681 | ||
684 | if (file->f_flags & O_DIRECT) | 682 | if (iocb->ki_flags & IOCB_DIRECT) { |
685 | return nfs_file_direct_write(iocb, from, pos); | 683 | result = generic_write_checks(iocb, from); |
684 | if (result <= 0) | ||
685 | return result; | ||
686 | return nfs_file_direct_write(iocb, from); | ||
687 | } | ||
686 | 688 | ||
687 | dprintk("NFS: write(%pD2, %zu@%Ld)\n", | 689 | dprintk("NFS: write(%pD2, %zu@%Ld)\n", |
688 | file, count, (long long) pos); | 690 | file, count, (long long) iocb->ki_pos); |
689 | 691 | ||
690 | result = -EBUSY; | 692 | result = -EBUSY; |
691 | if (IS_SWAPFILE(inode)) | 693 | if (IS_SWAPFILE(inode)) |
@@ -693,7 +695,7 @@ ssize_t nfs_file_write(struct kiocb *iocb, struct iov_iter *from) | |||
693 | /* | 695 | /* |
694 | * O_APPEND implies that we must revalidate the file length. | 696 | * O_APPEND implies that we must revalidate the file length. |
695 | */ | 697 | */ |
696 | if (file->f_flags & O_APPEND) { | 698 | if (iocb->ki_flags & IOCB_APPEND) { |
697 | result = nfs_revalidate_file_size(inode, file); | 699 | result = nfs_revalidate_file_size(inode, file); |
698 | if (result) | 700 | if (result) |
699 | goto out; | 701 | goto out; |
@@ -927,8 +929,6 @@ EXPORT_SYMBOL_GPL(nfs_flock); | |||
927 | 929 | ||
928 | const struct file_operations nfs_file_operations = { | 930 | const struct file_operations nfs_file_operations = { |
929 | .llseek = nfs_file_llseek, | 931 | .llseek = nfs_file_llseek, |
930 | .read = new_sync_read, | ||
931 | .write = new_sync_write, | ||
932 | .read_iter = nfs_file_read, | 932 | .read_iter = nfs_file_read, |
933 | .write_iter = nfs_file_write, | 933 | .write_iter = nfs_file_write, |
934 | .mmap = nfs_file_mmap, | 934 | .mmap = nfs_file_mmap, |