]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
CIFS: Move async write to ops struct
authorPavel Shilovsky <pshilovsky@samba.org>
Tue, 18 Sep 2012 23:20:29 +0000 (16:20 -0700)
committerSteve French <smfrench@gmail.com>
Tue, 25 Sep 2012 02:46:28 +0000 (21:46 -0500)
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/cifsglob.h
fs/cifs/cifssmb.c
fs/cifs/file.c
fs/cifs/smb1ops.c

index 93dd582bb8d14e1db7a157eb5b822ada19487f53..aef167470654ec793a8e47b6b843986f9aed8e11 100644 (file)
@@ -173,6 +173,7 @@ struct cifs_fattr;
 struct smb_vol;
 struct cifs_fid;
 struct cifs_readdata;
+struct cifs_writedata;
 
 struct smb_version_operations {
        int (*send_cancel)(struct TCP_Server_Info *, void *,
@@ -283,6 +284,8 @@ struct smb_version_operations {
        int (*flush)(const unsigned int, struct cifs_tcon *, struct cifs_fid *);
        /* async read from the server */
        int (*async_readv)(struct cifs_readdata *);
+       /* async write to the server */
+       int (*async_writev)(struct cifs_writedata *);
 };
 
 struct smb_version_values {
index 8a07f218266fb9d2245a07a42ef1b6abbec28d54..2a9b2738770875597c14041154e2b7bcb964359d 100644 (file)
@@ -1926,6 +1926,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
 {
        int i, rc;
        struct inode *inode = wdata->cfile->dentry->d_inode;
+       struct TCP_Server_Info *server;
 
        for (i = 0; i < wdata->nr_pages; i++) {
                lock_page(wdata->pages[i]);
@@ -1933,7 +1934,8 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
        }
 
        do {
-               rc = cifs_async_writev(wdata);
+               server = tlink_tcon(wdata->cfile->tlink)->ses->server;
+               rc = server->ops->async_writev(wdata);
        } while (rc == -EAGAIN);
 
        for (i = 0; i < wdata->nr_pages; i++) {
index 29ac8ee46039c8c722e2c361fda993502d414a43..703c1648b068d0f267bc3d89e519b36a47e6c816 100644 (file)
@@ -1754,6 +1754,7 @@ static int cifs_writepages(struct address_space *mapping,
        bool done = false, scanned = false, range_whole = false;
        pgoff_t end, index;
        struct cifs_writedata *wdata;
+       struct TCP_Server_Info *server;
        struct page *page;
        int rc = 0;
 
@@ -1904,7 +1905,8 @@ retry:
                                break;
                        }
                        wdata->pid = wdata->cfile->pid;
-                       rc = cifs_async_writev(wdata);
+                       server = tlink_tcon(wdata->cfile->tlink)->ses->server;
+                       rc = server->ops->async_writev(wdata);
                } while (wbc->sync_mode == WB_SYNC_ALL && rc == -EAGAIN);
 
                for (i = 0; i < nr_pages; ++i)
@@ -2235,6 +2237,9 @@ static int
 cifs_uncached_retry_writev(struct cifs_writedata *wdata)
 {
        int rc;
+       struct TCP_Server_Info *server;
+
+       server = tlink_tcon(wdata->cfile->tlink)->ses->server;
 
        do {
                if (wdata->cfile->invalidHandle) {
@@ -2242,7 +2247,7 @@ cifs_uncached_retry_writev(struct cifs_writedata *wdata)
                        if (rc != 0)
                                continue;
                }
-               rc = cifs_async_writev(wdata);
+               rc = server->ops->async_writev(wdata);
        } while (rc == -EAGAIN);
 
        return rc;
@@ -2277,6 +2282,10 @@ cifs_iovec_write(struct file *file, const struct iovec *iov,
        cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
        open_file = file->private_data;
        tcon = tlink_tcon(open_file->tlink);
+
+       if (!tcon->ses->server->ops->async_writev)
+               return -ENOSYS;
+
        offset = *poffset;
 
        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
index e2dbd22cb136dcf680320b462c2e8b9ff00a1b0c..50c3697af5aae9432c2b7c58b99850bf91ebfe1d 100644 (file)
@@ -786,6 +786,7 @@ struct smb_version_operations smb1_operations = {
        .close = cifs_close_file,
        .flush = cifs_flush_file,
        .async_readv = cifs_async_readv,
+       .async_writev = cifs_async_writev,
 };
 
 struct smb_version_values smb1_values = {