timers/nohz: Capitalize 'CPU' consistently
[cascardo/linux.git] / fs / cifs / file.c
index c03d074..9793ae0 100644 (file)
@@ -271,7 +271,7 @@ struct cifsFileInfo *
 cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
                  struct tcon_link *tlink, __u32 oplock)
 {
-       struct dentry *dentry = file->f_path.dentry;
+       struct dentry *dentry = file_dentry(file);
        struct inode *inode = d_inode(dentry);
        struct cifsInodeInfo *cinode = CIFS_I(inode);
        struct cifsFileInfo *cfile;
@@ -461,7 +461,7 @@ int cifs_open(struct inode *inode, struct file *file)
        tcon = tlink_tcon(tlink);
        server = tcon->ses->server;
 
-       full_path = build_path_from_dentry(file->f_path.dentry);
+       full_path = build_path_from_dentry(file_dentry(file));
        if (full_path == NULL) {
                rc = -ENOMEM;
                goto out;
@@ -2687,11 +2687,8 @@ cifs_writev(struct kiocb *iocb, struct iov_iter *from)
 out:
        inode_unlock(inode);
 
-       if (rc > 0) {
-               ssize_t err = generic_write_sync(file, iocb->ki_pos - rc, rc);
-               if (err < 0)
-                       rc = err;
-       }
+       if (rc > 0)
+               rc = generic_write_sync(iocb, rc);
        up_read(&cinode->lock_sem);
        return rc;
 }
@@ -2855,39 +2852,31 @@ cifs_uncached_read_into_pages(struct TCP_Server_Info *server,
        int result = 0;
        unsigned int i;
        unsigned int nr_pages = rdata->nr_pages;
-       struct kvec iov;
 
        rdata->got_bytes = 0;
        rdata->tailsz = PAGE_SIZE;
        for (i = 0; i < nr_pages; i++) {
                struct page *page = rdata->pages[i];
+               size_t n;
 
-               if (len >= PAGE_SIZE) {
-                       /* enough data to fill the page */
-                       iov.iov_base = kmap(page);
-                       iov.iov_len = PAGE_SIZE;
-                       cifs_dbg(FYI, "%u: iov_base=%p iov_len=%zu\n",
-                                i, iov.iov_base, iov.iov_len);
-                       len -= PAGE_SIZE;
-               } else if (len > 0) {
-                       /* enough for partial page, fill and zero the rest */
-                       iov.iov_base = kmap(page);
-                       iov.iov_len = len;
-                       cifs_dbg(FYI, "%u: iov_base=%p iov_len=%zu\n",
-                                i, iov.iov_base, iov.iov_len);
-                       memset(iov.iov_base + len, '\0', PAGE_SIZE - len);
-                       rdata->tailsz = len;
-                       len = 0;
-               } else {
+               if (len <= 0) {
                        /* no need to hold page hostage */
                        rdata->pages[i] = NULL;
                        rdata->nr_pages--;
                        put_page(page);
                        continue;
                }
-
-               result = cifs_readv_from_socket(server, &iov, 1, iov.iov_len);
-               kunmap(page);
+               n = len;
+               if (len >= PAGE_SIZE) {
+                       /* enough data to fill the page */
+                       n = PAGE_SIZE;
+                       len -= n;
+               } else {
+                       zero_user(page, len, PAGE_SIZE - len);
+                       rdata->tailsz = len;
+                       len = 0;
+               }
+               result = cifs_read_page_from_socket(server, page, n);
                if (result < 0)
                        break;
 
@@ -3303,7 +3292,6 @@ cifs_readpages_read_into_pages(struct TCP_Server_Info *server,
        u64 eof;
        pgoff_t eof_index;
        unsigned int nr_pages = rdata->nr_pages;
-       struct kvec iov;
 
        /* determine the eof that the server (probably) has */
        eof = CIFS_I(rdata->mapping->host)->server_eof;
@@ -3314,23 +3302,14 @@ cifs_readpages_read_into_pages(struct TCP_Server_Info *server,
        rdata->tailsz = PAGE_SIZE;
        for (i = 0; i < nr_pages; i++) {
                struct page *page = rdata->pages[i];
+               size_t n = PAGE_SIZE;
 
                if (len >= PAGE_SIZE) {
-                       /* enough data to fill the page */
-                       iov.iov_base = kmap(page);
-                       iov.iov_len = PAGE_SIZE;
-                       cifs_dbg(FYI, "%u: idx=%lu iov_base=%p iov_len=%zu\n",
-                                i, page->index, iov.iov_base, iov.iov_len);
                        len -= PAGE_SIZE;
                } else if (len > 0) {
                        /* enough for partial page, fill and zero the rest */
-                       iov.iov_base = kmap(page);
-                       iov.iov_len = len;
-                       cifs_dbg(FYI, "%u: idx=%lu iov_base=%p iov_len=%zu\n",
-                                i, page->index, iov.iov_base, iov.iov_len);
-                       memset(iov.iov_base + len,
-                               '\0', PAGE_SIZE - len);
-                       rdata->tailsz = len;
+                       zero_user(page, len, PAGE_SIZE - len);
+                       n = rdata->tailsz = len;
                        len = 0;
                } else if (page->index > eof_index) {
                        /*
@@ -3360,8 +3339,7 @@ cifs_readpages_read_into_pages(struct TCP_Server_Info *server,
                        continue;
                }
 
-               result = cifs_readv_from_socket(server, &iov, 1, iov.iov_len);
-               kunmap(page);
+               result = cifs_read_page_from_socket(server, page, n);
                if (result < 0)
                        break;
 
@@ -3854,7 +3832,7 @@ void cifs_oplock_break(struct work_struct *work)
  * Direct IO is not yet supported in the cached mode. 
  */
 static ssize_t
-cifs_direct_io(struct kiocb *iocb, struct iov_iter *iter, loff_t pos)
+cifs_direct_io(struct kiocb *iocb, struct iov_iter *iter)
 {
         /*
          * FIXME