[linux-cifs-client] [PATCH] non-direct reading

Pavel Shilovsky piastry at etersoft.ru
Tue Mar 31 20:09:17 GMT 2009


I found bug in my patch, Here is right variant.

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 3ae62fb..6525661 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -622,6 +622,23 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
        return written;
 }

+static ssize_t cifs_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
+                                 unsigned long nr_segs, loff_t pos)
+{
+       struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
+       ssize_t read;
+
+       if (CIFS_I(inode)->clientCanCacheRead)
+               read = generic_file_aio_read(iocb, iov, nr_segs, pos);
+       else {
+               read = cifs_user_read(iocb->ki_filp, iov->iov_base,
+                               iov->iov_len, &pos);
+               iocb->ki_pos = pos;
+       }
+       return read;
+}
+
+
 static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
 {
        /* origin == SEEK_END => we must revalidate the cached file length */
@@ -733,7 +750,7 @@ const struct inode_operations cifs_symlink_inode_ops = {
 const struct file_operations cifs_file_ops = {
        .read = do_sync_read,
        .write = do_sync_write,
-       .aio_read = generic_file_aio_read,
+       .aio_read = cifs_file_aio_read,
        .aio_write = cifs_file_aio_write,
        .open = cifs_open,
        .release = cifs_close,

-- 
Best regards,
Pavel Shilovsky.


More information about the linux-cifs-client mailing list