提交 c9de5c80 编写于 作者: P Pavel Shilovsky 提交者: Steve French

CIFS: Move async write to ops struct

Signed-off-by: NPavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: NSteve French <smfrench@gmail.com>
上级 09a4707e
...@@ -173,6 +173,7 @@ struct cifs_fattr; ...@@ -173,6 +173,7 @@ struct cifs_fattr;
struct smb_vol; struct smb_vol;
struct cifs_fid; struct cifs_fid;
struct cifs_readdata; struct cifs_readdata;
struct cifs_writedata;
struct smb_version_operations { struct smb_version_operations {
int (*send_cancel)(struct TCP_Server_Info *, void *, int (*send_cancel)(struct TCP_Server_Info *, void *,
...@@ -283,6 +284,8 @@ struct smb_version_operations { ...@@ -283,6 +284,8 @@ struct smb_version_operations {
int (*flush)(const unsigned int, struct cifs_tcon *, struct cifs_fid *); int (*flush)(const unsigned int, struct cifs_tcon *, struct cifs_fid *);
/* async read from the server */ /* async read from the server */
int (*async_readv)(struct cifs_readdata *); int (*async_readv)(struct cifs_readdata *);
/* async write to the server */
int (*async_writev)(struct cifs_writedata *);
}; };
struct smb_version_values { struct smb_version_values {
......
...@@ -1926,6 +1926,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata) ...@@ -1926,6 +1926,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
{ {
int i, rc; int i, rc;
struct inode *inode = wdata->cfile->dentry->d_inode; struct inode *inode = wdata->cfile->dentry->d_inode;
struct TCP_Server_Info *server;
for (i = 0; i < wdata->nr_pages; i++) { for (i = 0; i < wdata->nr_pages; i++) {
lock_page(wdata->pages[i]); lock_page(wdata->pages[i]);
...@@ -1933,7 +1934,8 @@ cifs_writev_requeue(struct cifs_writedata *wdata) ...@@ -1933,7 +1934,8 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
} }
do { do {
rc = cifs_async_writev(wdata); server = tlink_tcon(wdata->cfile->tlink)->ses->server;
rc = server->ops->async_writev(wdata);
} while (rc == -EAGAIN); } while (rc == -EAGAIN);
for (i = 0; i < wdata->nr_pages; i++) { for (i = 0; i < wdata->nr_pages; i++) {
......
...@@ -1754,6 +1754,7 @@ static int cifs_writepages(struct address_space *mapping, ...@@ -1754,6 +1754,7 @@ static int cifs_writepages(struct address_space *mapping,
bool done = false, scanned = false, range_whole = false; bool done = false, scanned = false, range_whole = false;
pgoff_t end, index; pgoff_t end, index;
struct cifs_writedata *wdata; struct cifs_writedata *wdata;
struct TCP_Server_Info *server;
struct page *page; struct page *page;
int rc = 0; int rc = 0;
...@@ -1904,7 +1905,8 @@ static int cifs_writepages(struct address_space *mapping, ...@@ -1904,7 +1905,8 @@ static int cifs_writepages(struct address_space *mapping,
break; break;
} }
wdata->pid = wdata->cfile->pid; 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); } while (wbc->sync_mode == WB_SYNC_ALL && rc == -EAGAIN);
for (i = 0; i < nr_pages; ++i) for (i = 0; i < nr_pages; ++i)
...@@ -2235,6 +2237,9 @@ static int ...@@ -2235,6 +2237,9 @@ static int
cifs_uncached_retry_writev(struct cifs_writedata *wdata) cifs_uncached_retry_writev(struct cifs_writedata *wdata)
{ {
int rc; int rc;
struct TCP_Server_Info *server;
server = tlink_tcon(wdata->cfile->tlink)->ses->server;
do { do {
if (wdata->cfile->invalidHandle) { if (wdata->cfile->invalidHandle) {
...@@ -2242,7 +2247,7 @@ cifs_uncached_retry_writev(struct cifs_writedata *wdata) ...@@ -2242,7 +2247,7 @@ cifs_uncached_retry_writev(struct cifs_writedata *wdata)
if (rc != 0) if (rc != 0)
continue; continue;
} }
rc = cifs_async_writev(wdata); rc = server->ops->async_writev(wdata);
} while (rc == -EAGAIN); } while (rc == -EAGAIN);
return rc; return rc;
...@@ -2277,6 +2282,10 @@ cifs_iovec_write(struct file *file, const struct iovec *iov, ...@@ -2277,6 +2282,10 @@ cifs_iovec_write(struct file *file, const struct iovec *iov,
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
open_file = file->private_data; open_file = file->private_data;
tcon = tlink_tcon(open_file->tlink); tcon = tlink_tcon(open_file->tlink);
if (!tcon->ses->server->ops->async_writev)
return -ENOSYS;
offset = *poffset; offset = *poffset;
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
......
...@@ -786,6 +786,7 @@ struct smb_version_operations smb1_operations = { ...@@ -786,6 +786,7 @@ struct smb_version_operations smb1_operations = {
.close = cifs_close_file, .close = cifs_close_file,
.flush = cifs_flush_file, .flush = cifs_flush_file,
.async_readv = cifs_async_readv, .async_readv = cifs_async_readv,
.async_writev = cifs_async_writev,
}; };
struct smb_version_values smb1_values = { struct smb_version_values smb1_values = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册