aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 377839bed17..9f7f8b9ea1e 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -707,8 +707,8 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz
707/** 707/**
708 * nfs_file_direct_read - file direct read operation for NFS files 708 * nfs_file_direct_read - file direct read operation for NFS files
709 * @iocb: target I/O control block 709 * @iocb: target I/O control block
710 * @buf: user's buffer into which to read data 710 * @iov: vector of user buffers into which to read data
711 * @count: number of bytes to read 711 * @nr_segs: size of iov vector
712 * @pos: byte offset in file where reading starts 712 * @pos: byte offset in file where reading starts
713 * 713 *
714 * We use this function for direct reads instead of calling 714 * We use this function for direct reads instead of calling
@@ -725,17 +725,24 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz
725 * client must read the updated atime from the server back into its 725 * client must read the updated atime from the server back into its
726 * cache. 726 * cache.
727 */ 727 */
728ssize_t nfs_file_direct_read(struct kiocb *iocb, char __user *buf, size_t count, loff_t pos) 728ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
729 unsigned long nr_segs, loff_t pos)
729{ 730{
730 ssize_t retval = -EINVAL; 731 ssize_t retval = -EINVAL;
731 struct file *file = iocb->ki_filp; 732 struct file *file = iocb->ki_filp;
732 struct address_space *mapping = file->f_mapping; 733 struct address_space *mapping = file->f_mapping;
734 /* XXX: temporary */
735 const char __user *buf = iov[0].iov_base;
736 size_t count = iov[0].iov_len;
733 737
734 dprintk("nfs: direct read(%s/%s, %lu@%Ld)\n", 738 dprintk("nfs: direct read(%s/%s, %lu@%Ld)\n",
735 file->f_dentry->d_parent->d_name.name, 739 file->f_dentry->d_parent->d_name.name,
736 file->f_dentry->d_name.name, 740 file->f_dentry->d_name.name,
737 (unsigned long) count, (long long) pos); 741 (unsigned long) count, (long long) pos);
738 742
743 if (nr_segs != 1)
744 return -EINVAL;
745
739 if (count < 0) 746 if (count < 0)
740 goto out; 747 goto out;
741 retval = -EFAULT; 748 retval = -EFAULT;
@@ -760,8 +767,8 @@ out:
760/** 767/**
761 * nfs_file_direct_write - file direct write operation for NFS files 768 * nfs_file_direct_write - file direct write operation for NFS files
762 * @iocb: target I/O control block 769 * @iocb: target I/O control block
763 * @buf: user's buffer from which to write data 770 * @iov: vector of user buffers from which to write data
764 * @count: number of bytes to write 771 * @nr_segs: size of iov vector
765 * @pos: byte offset in file where writing starts 772 * @pos: byte offset in file where writing starts
766 * 773 *
767 * We use this function for direct writes instead of calling 774 * We use this function for direct writes instead of calling
@@ -782,17 +789,24 @@ out:
782 * Note that O_APPEND is not supported for NFS direct writes, as there 789 * Note that O_APPEND is not supported for NFS direct writes, as there
783 * is no atomic O_APPEND write facility in the NFS protocol. 790 * is no atomic O_APPEND write facility in the NFS protocol.
784 */ 791 */
785ssize_t nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t pos) 792ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
793 unsigned long nr_segs, loff_t pos)
786{ 794{
787 ssize_t retval; 795 ssize_t retval;
788 struct file *file = iocb->ki_filp; 796 struct file *file = iocb->ki_filp;
789 struct address_space *mapping = file->f_mapping; 797 struct address_space *mapping = file->f_mapping;
798 /* XXX: temporary */
799 const char __user *buf = iov[0].iov_base;
800 size_t count = iov[0].iov_len;
790 801
791 dfprintk(VFS, "nfs: direct write(%s/%s, %lu@%Ld)\n", 802 dfprintk(VFS, "nfs: direct write(%s/%s, %lu@%Ld)\n",
792 file->f_dentry->d_parent->d_name.name, 803 file->f_dentry->d_parent->d_name.name,
793 file->f_dentry->d_name.name, 804 file->f_dentry->d_name.name,
794 (unsigned long) count, (long long) pos); 805 (unsigned long) count, (long long) pos);
795 806
807 if (nr_segs != 1)
808 return -EINVAL;
809
796 retval = generic_write_checks(file, &pos, &count, 0); 810 retval = generic_write_checks(file, &pos, &count, 0);
797 if (retval) 811 if (retval)
798 goto out; 812 goto out;