]> git.baikalelectronics.ru Git - kernel.git/commitdiff
[PATCH] Streamline generic_file_* interfaces and filemap cleanups
authorBadari Pulavarty <pbadari@us.ibm.com>
Sun, 1 Oct 2006 06:28:48 +0000 (23:28 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 1 Oct 2006 07:39:28 +0000 (00:39 -0700)
This patch cleans up generic_file_*_read/write() interfaces.  Christoph
Hellwig gave me the idea for this clean ups.

In a nutshell, all filesystems should set .aio_read/.aio_write methods and use
do_sync_read/ do_sync_write() as their .read/.write methods.  This allows us
to cleanup all variants of generic_file_* routines.

Final available interfaces:

generic_file_aio_read() - read handler
generic_file_aio_write() - write handler
generic_file_aio_write_nolock() - no lock write handler

__generic_file_aio_write_nolock() - internal worker routine

Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
27 files changed:
drivers/char/raw.c
fs/adfs/file.c
fs/affs/file.c
fs/bfs/file.c
fs/block_dev.c
fs/ext2/file.c
fs/fuse/file.c
fs/hfs/inode.c
fs/hfsplus/inode.c
fs/hostfs/hostfs_kern.c
fs/hpfs/file.c
fs/jffs/inode-v23.c
fs/jffs2/file.c
fs/jfs/file.c
fs/minix/file.c
fs/ntfs/file.c
fs/qnx4/file.c
fs/ramfs/file-mmu.c
fs/ramfs/file-nommu.c
fs/read_write.c
fs/smbfs/file.c
fs/sysv/file.c
fs/udf/file.c
fs/ufs/file.c
fs/xfs/linux-2.6/xfs_lrw.c
include/linux/fs.h
mm/filemap.c

index 490db531e2d83327f050eb651964ec81329d4883..89b718e326e5a0873ca0002cc76441a3c5469238 100644 (file)
@@ -238,21 +238,10 @@ out:
        return err;
 }
 
-static ssize_t raw_file_write(struct file *file, const char __user *buf,
-                                  size_t count, loff_t *ppos)
-{
-       struct iovec local_iov = {
-               .iov_base = (char __user *)buf,
-               .iov_len = count
-       };
-
-       return generic_file_write_nolock(file, &local_iov, 1, ppos);
-}
-
 static const struct file_operations raw_fops = {
-       .read   =       generic_file_read,
+       .read   =       do_sync_read,
        .aio_read =     generic_file_aio_read,
-       .write  =       raw_file_write,
+       .write  =       do_sync_write,
        .aio_write =    generic_file_aio_write_nolock,
        .open   =       raw_open,
        .release=       raw_release,
index 1014b9f2117b2bd2e6bc00086f8bcc9d84475d0e..6101ea679cb1bf7772ba5da5342d7fb6def023ee 100644 (file)
 
 const struct file_operations adfs_file_operations = {
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
        .mmap           = generic_file_mmap,
        .fsync          = file_fsync,
-       .write          = generic_file_write,
+       .write          = do_sync_write,
+       .aio_write      = generic_file_aio_write,
        .sendfile       = generic_file_sendfile,
 };
 
index 3de8590e4f6a56a35d13e09be2e8a3012df2fb54..05b5e22de759e10513301ac7b441bc4127c3b492 100644 (file)
@@ -27,8 +27,10 @@ static int affs_file_release(struct inode *inode, struct file *filp);
 
 const struct file_operations affs_file_operations = {
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
-       .write          = generic_file_write,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
+       .write          = do_sync_write,
+       .aio_write      = generic_file_aio_write,
        .mmap           = generic_file_mmap,
        .open           = affs_file_open,
        .release        = affs_file_release,
index 3d5aca28a0a0980922c83c0b197d1cf52cb27593..a9164a87f8deebfee1ceefd1f722bb0baac75491 100644 (file)
 
 const struct file_operations bfs_file_operations = {
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
-       .write          = generic_file_write,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
+       .write          = do_sync_write,
+       .aio_write      = generic_file_aio_write,
        .mmap           = generic_file_mmap,
        .sendfile       = generic_file_sendfile,
 };
index 0f143094ef1d455bf5152a30dede77b13e24f7df..bc8f27cc448314b2eaf99cc93628671d51d5adc1 100644 (file)
@@ -1154,14 +1154,6 @@ static int blkdev_close(struct inode * inode, struct file * filp)
        return blkdev_put(bdev);
 }
 
-static ssize_t blkdev_file_write(struct file *file, const char __user *buf,
-                                  size_t count, loff_t *ppos)
-{
-       struct iovec local_iov = { .iov_base = (void __user *)buf, .iov_len = count };
-
-       return generic_file_write_nolock(file, &local_iov, 1, ppos);
-}
-
 static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg)
 {
        return blkdev_ioctl(file->f_mapping->host, file, cmd, arg);
@@ -1181,8 +1173,8 @@ const struct file_operations def_blk_fops = {
        .open           = blkdev_open,
        .release        = blkdev_close,
        .llseek         = block_llseek,
-       .read           = generic_file_read,
-       .write          = blkdev_file_write,
+       .read           = do_sync_read,
+       .write          = do_sync_write,
        .aio_read       = generic_file_aio_read,
        .aio_write      = generic_file_aio_write_nolock,
        .mmap           = generic_file_mmap,
index e893e2be9ed408294586ac02e70601488526c83e..2dba473c524ad33282402305b6b1afe837caf5d3 100644 (file)
@@ -41,8 +41,8 @@ static int ext2_release_file (struct inode * inode, struct file * filp)
  */
 const struct file_operations ext2_file_operations = {
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
-       .write          = generic_file_write,
+       .read           = do_sync_read,
+       .write          = do_sync_write,
        .aio_read       = generic_file_aio_read,
        .aio_write      = generic_file_aio_write,
        .ioctl          = ext2_ioctl,
index 5c4fcd1dbf5908d29401aa3f83d1aac23a1d8244..183626868eea602d4658e5395ec31f46130c0afe 100644 (file)
@@ -753,8 +753,10 @@ static int fuse_file_lock(struct file *file, int cmd, struct file_lock *fl)
 
 static const struct file_operations fuse_file_operations = {
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
-       .write          = generic_file_write,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
+       .write          = do_sync_write,
+       .aio_write      = generic_file_aio_write,
        .mmap           = fuse_file_mmap,
        .open           = fuse_open,
        .flush          = fuse_flush,
index d05641c35fc902e1f385a076977bc704f1cc05bf..02f5573e03491b597a7d68b40fb45f72f87e4a07 100644 (file)
@@ -601,8 +601,10 @@ int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr)
 
 static const struct file_operations hfs_file_operations = {
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
-       .write          = generic_file_write,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
+       .write          = do_sync_write,
+       .aio_write      = generic_file_aio_write,
        .mmap           = generic_file_mmap,
        .sendfile       = generic_file_sendfile,
        .fsync          = file_fsync,
index 0eb1a60926682bec544dcbd697c293cec407973d..9e36752496336fa86ea19a7fbb3bdf6e73e8d2fd 100644 (file)
@@ -282,8 +282,10 @@ static struct inode_operations hfsplus_file_inode_operations = {
 
 static const struct file_operations hfsplus_file_operations = {
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
-       .write          = generic_file_write,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
+       .write          = do_sync_write,
+       .aio_write      = generic_file_aio_write,
        .mmap           = generic_file_mmap,
        .sendfile       = generic_file_sendfile,
        .fsync          = file_fsync,
index 4908c38a58852e161fa446f623c7467e4e85d400..b6bd33ca3731edafe9866ce0a7a725a2bc3287c3 100644 (file)
@@ -385,11 +385,11 @@ int hostfs_fsync(struct file *file, struct dentry *dentry, int datasync)
 
 static const struct file_operations hostfs_file_fops = {
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
+       .read           = do_sync_read,
        .sendfile       = generic_file_sendfile,
        .aio_read       = generic_file_aio_read,
        .aio_write      = generic_file_aio_write,
-       .write          = generic_file_write,
+       .write          = do_sync_write,
        .mmap           = generic_file_mmap,
        .open           = hostfs_file_open,
        .release        = NULL,
index d9eb19b7b8aecef05ef1d49d0a12feca4b184755..8b94d24855f00b7ece487dc2b1cd5b5a741af0db 100644 (file)
@@ -113,7 +113,7 @@ static ssize_t hpfs_file_write(struct file *file, const char __user *buf,
 {
        ssize_t retval;
 
-       retval = generic_file_write(file, buf, count, ppos);
+       retval = do_sync_write(file, buf, count, ppos);
        if (retval > 0)
                hpfs_i(file->f_dentry->d_inode)->i_dirty = 1;
        return retval;
@@ -122,8 +122,10 @@ static ssize_t hpfs_file_write(struct file *file, const char __user *buf,
 const struct file_operations hpfs_file_ops =
 {
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
        .write          = hpfs_file_write,
+       .aio_write      = generic_file_aio_write,
        .mmap           = generic_file_mmap,
        .release        = hpfs_file_release,
        .fsync          = hpfs_file_fsync,
index f5cf9c93e24380ef1c5347749f4d1f3d5c7d38cb..068ef0de8de2b63400da3a81be3e423cfc8d93ce 100644 (file)
@@ -1632,8 +1632,10 @@ static const struct file_operations jffs_file_operations =
 {
        .open           = generic_file_open,
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
-       .write          = generic_file_write,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
+       .write          = do_sync_write,
+       .aio_write      = generic_file_aio_write,
        .ioctl          = jffs_ioctl,
        .mmap           = generic_file_readonly_mmap,
        .fsync          = jffs_fsync,
index 3ed6e3e120b602fb814051606dc7fc7f89edc430..242875f77cb38261fec2c2da5e35e3db08b15773 100644 (file)
@@ -42,8 +42,10 @@ const struct file_operations jffs2_file_operations =
 {
        .llseek =       generic_file_llseek,
        .open =         generic_file_open,
-       .read =         generic_file_read,
-       .write =        generic_file_write,
+       .read =         do_sync_read,
+       .aio_read =     generic_file_aio_read,
+       .write =        do_sync_write,
+       .aio_write =    generic_file_aio_write,
        .ioctl =        jffs2_ioctl,
        .mmap =         generic_file_readonly_mmap,
        .fsync =        jffs2_fsync,
index f535f2911c12dd751ab4daaf995863537c506d20..976e90dc2d1b52c33c82a3d5404b2043494ffb0d 100644 (file)
@@ -103,8 +103,8 @@ struct inode_operations jfs_file_inode_operations = {
 const struct file_operations jfs_file_operations = {
        .open           = jfs_open,
        .llseek         = generic_file_llseek,
-       .write          = generic_file_write,
-       .read           = generic_file_read,
+       .write          = do_sync_write,
+       .read           = do_sync_read,
        .aio_read       = generic_file_aio_read,
        .aio_write      = generic_file_aio_write,
        .mmap           = generic_file_mmap,
index 420b32882a10ce6f55c8cd6d396d5045f334d5d6..40eac2e60d25deb803bebfbd4712e5caae5a65b6 100644 (file)
@@ -17,8 +17,10 @@ int minix_sync_file(struct file *, struct dentry *, int);
 
 const struct file_operations minix_file_operations = {
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
-       .write          = generic_file_write,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
+       .write          = do_sync_write,
+       .aio_write      = generic_file_aio_write,
        .mmap           = generic_file_mmap,
        .fsync          = minix_sync_file,
        .sendfile       = generic_file_sendfile,
index 2f9b5a0953ff0e4e5f1207b4d00809a7097e890c..ae2fe0016d2c7be63adf1029f878b798fa1af7b6 100644 (file)
@@ -2296,7 +2296,7 @@ static int ntfs_file_fsync(struct file *filp, struct dentry *dentry,
 
 const struct file_operations ntfs_file_ops = {
        .llseek         = generic_file_llseek,   /* Seek inside file. */
-       .read           = generic_file_read,     /* Read from file. */
+       .read           = do_sync_read,          /* Read from file. */
        .aio_read       = generic_file_aio_read, /* Async read from file. */
 #ifdef NTFS_RW
        .write          = ntfs_file_write,       /* Write to file. */
index 62af4b1348bda336cfcc90420a6f1b208f7f807f..467e5ac7280e739eb65a3ee63267ef5e46fbef20 100644 (file)
 const struct file_operations qnx4_file_operations =
 {
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
        .mmap           = generic_file_mmap,
        .sendfile       = generic_file_sendfile,
 #ifdef CONFIG_QNX4FS_RW
-       .write          = generic_file_write,
+       .write          = do_sync_write,
+       .aio_write      = generic_file_aio_write,
        .fsync          = qnx4_sync_file,
 #endif
 };
index 86f14cacf64120569f2fd0ad8e6ee573de98eb4e..0947fb57dcf3425bb4952eb947dd9d3af05bfe2e 100644 (file)
@@ -33,8 +33,10 @@ const struct address_space_operations ramfs_aops = {
 };
 
 const struct file_operations ramfs_file_operations = {
-       .read           = generic_file_read,
-       .write          = generic_file_write,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
+       .write          = do_sync_write,
+       .aio_write      = generic_file_aio_write,
        .mmap           = generic_file_mmap,
        .fsync          = simple_sync_file,
        .sendfile       = generic_file_sendfile,
index 677139b48e000d0d98100122c851eff5572aa14a..bfe5dbf1002e597a5b0b5ca25cfb9ea411b1c36e 100644 (file)
@@ -36,8 +36,10 @@ const struct address_space_operations ramfs_aops = {
 const struct file_operations ramfs_file_operations = {
        .mmap                   = ramfs_nommu_mmap,
        .get_unmapped_area      = ramfs_nommu_get_unmapped_area,
-       .read                   = generic_file_read,
-       .write                  = generic_file_write,
+       .read                   = do_sync_read,
+       .aio_read               = generic_file_aio_read,
+       .write                  = do_sync_write,
+       .aio_write              = generic_file_aio_write,
        .fsync                  = simple_sync_file,
        .sendfile               = generic_file_sendfile,
        .llseek                 = generic_file_llseek,
index 32d54cca9bd917323f6ea45e19652403f68793e2..4ed839bcb91caa3301f13245cf725bc0c46873bf 100644 (file)
@@ -22,7 +22,8 @@
 
 const struct file_operations generic_ro_fops = {
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
        .mmap           = generic_file_readonly_mmap,
        .sendfile       = generic_file_sendfile,
 };
index dae67048baba345fcbd6358e4a84fd890f834633..50784d13c87b55a542d9db3dce156ede054b5a1a 100644 (file)
@@ -214,13 +214,15 @@ smb_updatepage(struct file *file, struct page *page, unsigned long offset,
 }
 
 static ssize_t
-smb_file_read(struct file * file, char __user * buf, size_t count, loff_t *ppos)
+smb_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
+                       unsigned long nr_segs, loff_t pos)
 {
+       struct file * file = iocb->ki_filp;
        struct dentry * dentry = file->f_dentry;
        ssize_t status;
 
        VERBOSE("file %s/%s, count=%lu@%lu\n", DENTRY_PATH(dentry),
-               (unsigned long) count, (unsigned long) *ppos);
+               (unsigned long) iocb->ki_left, (unsigned long) pos);
 
        status = smb_revalidate_inode(dentry);
        if (status) {
@@ -233,7 +235,7 @@ smb_file_read(struct file * file, char __user * buf, size_t count, loff_t *ppos)
                (long)dentry->d_inode->i_size,
                dentry->d_inode->i_flags, dentry->d_inode->i_atime);
 
-       status = generic_file_read(file, buf, count, ppos);
+       status = generic_file_aio_read(iocb, iov, nr_segs, pos);
 out:
        return status;
 }
@@ -317,14 +319,16 @@ const struct address_space_operations smb_file_aops = {
  * Write to a file (through the page cache).
  */
 static ssize_t
-smb_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
+smb_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
+                              unsigned long nr_segs, loff_t pos)
 {
+       struct file * file = iocb->ki_filp;
        struct dentry * dentry = file->f_dentry;
        ssize_t result;
 
        VERBOSE("file %s/%s, count=%lu@%lu\n",
                DENTRY_PATH(dentry),
-               (unsigned long) count, (unsigned long) *ppos);
+               (unsigned long) iocb->ki_left, (unsigned long) pos);
 
        result = smb_revalidate_inode(dentry);
        if (result) {
@@ -337,8 +341,8 @@ smb_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
        if (result)
                goto out;
 
-       if (count > 0) {
-               result = generic_file_write(file, buf, count, ppos);
+       if (iocb->ki_left > 0) {
+               result = generic_file_aio_write(iocb, iov, nr_segs, pos);
                VERBOSE("pos=%ld, size=%ld, mtime=%ld, atime=%ld\n",
                        (long) file->f_pos, (long) dentry->d_inode->i_size,
                        dentry->d_inode->i_mtime, dentry->d_inode->i_atime);
@@ -402,8 +406,10 @@ smb_file_permission(struct inode *inode, int mask, struct nameidata *nd)
 const struct file_operations smb_file_operations =
 {
        .llseek         = remote_llseek,
-       .read           = smb_file_read,
-       .write          = smb_file_write,
+       .read           = do_sync_read,
+       .aio_read       = smb_file_aio_read,
+       .write          = do_sync_write,
+       .aio_write      = smb_file_aio_write,
        .ioctl          = smb_ioctl,
        .mmap           = smb_file_mmap,
        .open           = smb_file_open,
index a59e303135fa02feca937e45706c87b14f8d0c5b..47a4b728f15b49bfdf84d7b30d17568e08a13b1c 100644 (file)
  */
 const struct file_operations sysv_file_operations = {
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
-       .write          = generic_file_write,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
+       .write          = do_sync_write,
+       .aio_write      = generic_file_aio_write,
        .mmap           = generic_file_mmap,
        .fsync          = sysv_sync_file,
        .sendfile       = generic_file_sendfile,
index a59e5f33daf6f7ed5225d8f85c349acbf29f05ab..7aedd552cba12c205706fb921dd0bde45ec68e11 100644 (file)
@@ -103,19 +103,21 @@ const struct address_space_operations udf_adinicb_aops = {
        .commit_write           = udf_adinicb_commit_write,
 };
 
-static ssize_t udf_file_write(struct file * file, const char __user * buf,
-       size_t count, loff_t *ppos)
+static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
+                             unsigned long nr_segs, loff_t ppos)
 {
        ssize_t retval;
+       struct file *file = iocb->ki_filp;
        struct inode *inode = file->f_dentry->d_inode;
        int err, pos;
+       size_t count = iocb->ki_left;
 
        if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
        {
                if (file->f_flags & O_APPEND)
                        pos = inode->i_size;
                else
-                       pos = *ppos;
+                       pos = ppos;
 
                if (inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) +
                        pos + count))
@@ -136,7 +138,7 @@ static ssize_t udf_file_write(struct file * file, const char __user * buf,
                }
        }
 
-       retval = generic_file_write(file, buf, count, ppos);
+       retval = generic_file_aio_write(iocb, iov, nr_segs, ppos);
 
        if (retval > 0)
                mark_inode_dirty(inode);
@@ -249,11 +251,13 @@ static int udf_release_file(struct inode * inode, struct file * filp)
 }
 
 const struct file_operations udf_file_operations = {
-       .read                   = generic_file_read,
+       .read                   = do_sync_read,
+       .aio_read               = generic_file_aio_read,
        .ioctl                  = udf_ioctl,
        .open                   = generic_file_open,
        .mmap                   = generic_file_mmap,
-       .write                  = udf_file_write,
+       .write                  = do_sync_write,
+       .aio_write              = udf_file_aio_write,
        .release                = udf_release_file,
        .fsync                  = udf_fsync_file,
        .sendfile               = generic_file_sendfile,
index a9c6e5f04faea080ddc271602cab79f829295548..1e096323bad47f240bdbc30191922d46638a5612 100644 (file)
@@ -53,8 +53,10 @@ static int ufs_sync_file(struct file *file, struct dentry *dentry, int datasync)
  
 const struct file_operations ufs_file_operations = {
        .llseek         = generic_file_llseek,
-       .read           = generic_file_read,
-       .write          = generic_file_write,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
+       .write          = do_sync_write,
+       .aio_write      = generic_file_aio_write,
        .mmap           = generic_file_mmap,
        .open           = generic_file_open,
        .fsync          = ufs_sync_file,
index 55992b40353cad97de4dd7b20dd9a009bd3d5b63..fa842f1c9fa27b3511c86725a1cad2f3334f4b9c 100644 (file)
@@ -279,7 +279,9 @@ xfs_read(
 
        xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore,
                                (void *)iovp, segs, *offset, ioflags);
-       ret = __generic_file_aio_read(iocb, iovp, segs, offset);
+
+       iocb->ki_pos = *offset;
+       ret = generic_file_aio_read(iocb, iovp, segs, *offset);
        if (ret == -EIOCBQUEUED && !(ioflags & IO_ISAIO))
                ret = wait_on_sync_kiocb(iocb);
        if (ret > 0)
index afb6e6f89a018463f3a98b7b3de614eeb0e77ca1..011129f8803eb338d01e43e13b1ddf584aa42839 100644 (file)
@@ -1699,11 +1699,8 @@ extern int generic_file_mmap(struct file *, struct vm_area_struct *);
 extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
 extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
 extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
-extern ssize_t generic_file_read(struct file *, char __user *, size_t, loff_t *);
 int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
-extern ssize_t generic_file_write(struct file *, const char __user *, size_t, loff_t *);
 extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
-extern ssize_t __generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t *);
 extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
 extern ssize_t generic_file_aio_write_nolock(struct kiocb *, const struct iovec *,
                unsigned long, loff_t);
@@ -1713,8 +1710,6 @@ extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *,
                unsigned long, loff_t, loff_t *, size_t, ssize_t);
 extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
 extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
-ssize_t generic_file_write_nolock(struct file *file, const struct iovec *iov,
-                               unsigned long nr_segs, loff_t *ppos);
 extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *);
 extern void do_generic_mapping_read(struct address_space *mapping,
                                    struct file_ra_state *, struct file *,
index 48497094ae836118366d14b1e9cdaf1ec9f08528..ec469235985d6e2cd89d39bf8bd40405f133e142 100644 (file)
@@ -1149,13 +1149,14 @@ success:
  * that can use the page cache directly.
  */
 ssize_t
-__generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
-               unsigned long nr_segs, loff_t *ppos)
+generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
+               unsigned long nr_segs, loff_t pos)
 {
        struct file *filp = iocb->ki_filp;
        ssize_t retval;
        unsigned long seg;
        size_t count;
+       loff_t *ppos = &iocb->ki_pos;
 
        count = 0;
        for (seg = 0; seg < nr_segs; seg++) {
@@ -1179,7 +1180,7 @@ __generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
 
        /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */
        if (filp->f_flags & O_DIRECT) {
-               loff_t pos = *ppos, size;
+               loff_t size;
                struct address_space *mapping;
                struct inode *inode;
 
@@ -1223,32 +1224,8 @@ __generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
 out:
        return retval;
 }
-EXPORT_SYMBOL(__generic_file_aio_read);
-
-ssize_t
-generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
-               unsigned long nr_segs, loff_t pos)
-{
-       BUG_ON(iocb->ki_pos != pos);
-       return __generic_file_aio_read(iocb, iov, nr_segs, &iocb->ki_pos);
-}
 EXPORT_SYMBOL(generic_file_aio_read);
 
-ssize_t
-generic_file_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
-{
-       struct iovec local_iov = { .iov_base = buf, .iov_len = count };
-       struct kiocb kiocb;
-       ssize_t ret;
-
-       init_sync_kiocb(&kiocb, filp);
-       ret = __generic_file_aio_read(&kiocb, &local_iov, 1, ppos);
-       if (-EIOCBQUEUED == ret)
-               ret = wait_on_sync_kiocb(&kiocb);
-       return ret;
-}
-EXPORT_SYMBOL(generic_file_read);
-
 int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size)
 {
        ssize_t written;
@@ -2339,38 +2316,6 @@ ssize_t generic_file_aio_write_nolock(struct kiocb *iocb,
 }
 EXPORT_SYMBOL(generic_file_aio_write_nolock);
 
-static ssize_t
-__generic_file_write_nolock(struct file *file, const struct iovec *iov,
-                               unsigned long nr_segs, loff_t *ppos)
-{
-       struct kiocb kiocb;
-       ssize_t ret;
-
-       init_sync_kiocb(&kiocb, file);
-       kiocb.ki_pos = *ppos;
-       ret = __generic_file_aio_write_nolock(&kiocb, iov, nr_segs, ppos);
-       if (-EIOCBQUEUED == ret)
-               ret = wait_on_sync_kiocb(&kiocb);
-       return ret;
-}
-
-ssize_t
-generic_file_write_nolock(struct file *file, const struct iovec *iov,
-                               unsigned long nr_segs, loff_t *ppos)
-{
-       struct kiocb kiocb;
-       ssize_t ret;
-
-       init_sync_kiocb(&kiocb, file);
-       kiocb.ki_pos = *ppos;
-       ret = generic_file_aio_write_nolock(&kiocb, iov, nr_segs, *ppos);
-       if (-EIOCBQUEUED == ret)
-               ret = wait_on_sync_kiocb(&kiocb);
-       *ppos = kiocb.ki_pos;
-       return ret;
-}
-EXPORT_SYMBOL(generic_file_write_nolock);
-
 ssize_t generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
                unsigned long nr_segs, loff_t pos)
 {
@@ -2397,30 +2342,6 @@ ssize_t generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
 }
 EXPORT_SYMBOL(generic_file_aio_write);
 
-ssize_t generic_file_write(struct file *file, const char __user *buf,
-                          size_t count, loff_t *ppos)
-{
-       struct address_space *mapping = file->f_mapping;
-       struct inode *inode = mapping->host;
-       ssize_t ret;
-       struct iovec local_iov = { .iov_base = (void __user *)buf,
-                                       .iov_len = count };
-
-       mutex_lock(&inode->i_mutex);
-       ret = __generic_file_write_nolock(file, &local_iov, 1, ppos);
-       mutex_unlock(&inode->i_mutex);
-
-       if (ret > 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) {
-               ssize_t err;
-
-               err = sync_page_range(inode, mapping, *ppos - ret, ret);
-               if (err < 0)
-                       ret = err;
-       }
-       return ret;
-}
-EXPORT_SYMBOL(generic_file_write);
-
 /*
  * Called under i_mutex for writes to S_ISREG files.   Returns -EIO if something
  * went wrong during pagecache shootdown.