diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2012-09-18 19:20:29 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-09-24 22:46:28 -0400 |
commit | c9de5c80d536e556568ccd45b9599870d4993b7d (patch) | |
tree | 5ae40ff872bc69cf5be996f2e6a75ea746d8ed58 /fs/cifs | |
parent | 09a4707e7638247302c6d798061aed117141fb74 (diff) |
CIFS: Move async write to ops struct
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifsglob.h | 3 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 4 | ||||
-rw-r--r-- | fs/cifs/file.c | 13 | ||||
-rw-r--r-- | fs/cifs/smb1ops.c | 1 |
4 files changed, 18 insertions, 3 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 93dd582bb8d1..aef167470654 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -173,6 +173,7 @@ struct cifs_fattr; | |||
173 | struct smb_vol; | 173 | struct smb_vol; |
174 | struct cifs_fid; | 174 | struct cifs_fid; |
175 | struct cifs_readdata; | 175 | struct cifs_readdata; |
176 | struct cifs_writedata; | ||
176 | 177 | ||
177 | struct smb_version_operations { | 178 | struct smb_version_operations { |
178 | int (*send_cancel)(struct TCP_Server_Info *, void *, | 179 | int (*send_cancel)(struct TCP_Server_Info *, void *, |
@@ -283,6 +284,8 @@ struct smb_version_operations { | |||
283 | int (*flush)(const unsigned int, struct cifs_tcon *, struct cifs_fid *); | 284 | int (*flush)(const unsigned int, struct cifs_tcon *, struct cifs_fid *); |
284 | /* async read from the server */ | 285 | /* async read from the server */ |
285 | int (*async_readv)(struct cifs_readdata *); | 286 | int (*async_readv)(struct cifs_readdata *); |
287 | /* async write to the server */ | ||
288 | int (*async_writev)(struct cifs_writedata *); | ||
286 | }; | 289 | }; |
287 | 290 | ||
288 | struct smb_version_values { | 291 | struct smb_version_values { |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 8a07f218266f..2a9b27387708 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -1926,6 +1926,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata) | |||
1926 | { | 1926 | { |
1927 | int i, rc; | 1927 | int i, rc; |
1928 | struct inode *inode = wdata->cfile->dentry->d_inode; | 1928 | struct inode *inode = wdata->cfile->dentry->d_inode; |
1929 | struct TCP_Server_Info *server; | ||
1929 | 1930 | ||
1930 | for (i = 0; i < wdata->nr_pages; i++) { | 1931 | for (i = 0; i < wdata->nr_pages; i++) { |
1931 | lock_page(wdata->pages[i]); | 1932 | lock_page(wdata->pages[i]); |
@@ -1933,7 +1934,8 @@ cifs_writev_requeue(struct cifs_writedata *wdata) | |||
1933 | } | 1934 | } |
1934 | 1935 | ||
1935 | do { | 1936 | do { |
1936 | rc = cifs_async_writev(wdata); | 1937 | server = tlink_tcon(wdata->cfile->tlink)->ses->server; |
1938 | rc = server->ops->async_writev(wdata); | ||
1937 | } while (rc == -EAGAIN); | 1939 | } while (rc == -EAGAIN); |
1938 | 1940 | ||
1939 | for (i = 0; i < wdata->nr_pages; i++) { | 1941 | for (i = 0; i < wdata->nr_pages; i++) { |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 29ac8ee46039..703c1648b068 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1754,6 +1754,7 @@ static int cifs_writepages(struct address_space *mapping, | |||
1754 | bool done = false, scanned = false, range_whole = false; | 1754 | bool done = false, scanned = false, range_whole = false; |
1755 | pgoff_t end, index; | 1755 | pgoff_t end, index; |
1756 | struct cifs_writedata *wdata; | 1756 | struct cifs_writedata *wdata; |
1757 | struct TCP_Server_Info *server; | ||
1757 | struct page *page; | 1758 | struct page *page; |
1758 | int rc = 0; | 1759 | int rc = 0; |
1759 | 1760 | ||
@@ -1904,7 +1905,8 @@ retry: | |||
1904 | break; | 1905 | break; |
1905 | } | 1906 | } |
1906 | wdata->pid = wdata->cfile->pid; | 1907 | wdata->pid = wdata->cfile->pid; |
1907 | rc = cifs_async_writev(wdata); | 1908 | server = tlink_tcon(wdata->cfile->tlink)->ses->server; |
1909 | rc = server->ops->async_writev(wdata); | ||
1908 | } while (wbc->sync_mode == WB_SYNC_ALL && rc == -EAGAIN); | 1910 | } while (wbc->sync_mode == WB_SYNC_ALL && rc == -EAGAIN); |
1909 | 1911 | ||
1910 | for (i = 0; i < nr_pages; ++i) | 1912 | for (i = 0; i < nr_pages; ++i) |
@@ -2235,6 +2237,9 @@ static int | |||
2235 | cifs_uncached_retry_writev(struct cifs_writedata *wdata) | 2237 | cifs_uncached_retry_writev(struct cifs_writedata *wdata) |
2236 | { | 2238 | { |
2237 | int rc; | 2239 | int rc; |
2240 | struct TCP_Server_Info *server; | ||
2241 | |||
2242 | server = tlink_tcon(wdata->cfile->tlink)->ses->server; | ||
2238 | 2243 | ||
2239 | do { | 2244 | do { |
2240 | if (wdata->cfile->invalidHandle) { | 2245 | if (wdata->cfile->invalidHandle) { |
@@ -2242,7 +2247,7 @@ cifs_uncached_retry_writev(struct cifs_writedata *wdata) | |||
2242 | if (rc != 0) | 2247 | if (rc != 0) |
2243 | continue; | 2248 | continue; |
2244 | } | 2249 | } |
2245 | rc = cifs_async_writev(wdata); | 2250 | rc = server->ops->async_writev(wdata); |
2246 | } while (rc == -EAGAIN); | 2251 | } while (rc == -EAGAIN); |
2247 | 2252 | ||
2248 | return rc; | 2253 | return rc; |
@@ -2277,6 +2282,10 @@ cifs_iovec_write(struct file *file, const struct iovec *iov, | |||
2277 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | 2282 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); |
2278 | open_file = file->private_data; | 2283 | open_file = file->private_data; |
2279 | tcon = tlink_tcon(open_file->tlink); | 2284 | tcon = tlink_tcon(open_file->tlink); |
2285 | |||
2286 | if (!tcon->ses->server->ops->async_writev) | ||
2287 | return -ENOSYS; | ||
2288 | |||
2280 | offset = *poffset; | 2289 | offset = *poffset; |
2281 | 2290 | ||
2282 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) | 2291 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) |
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index e2dbd22cb136..50c3697af5aa 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
@@ -786,6 +786,7 @@ struct smb_version_operations smb1_operations = { | |||
786 | .close = cifs_close_file, | 786 | .close = cifs_close_file, |
787 | .flush = cifs_flush_file, | 787 | .flush = cifs_flush_file, |
788 | .async_readv = cifs_async_readv, | 788 | .async_readv = cifs_async_readv, |
789 | .async_writev = cifs_async_writev, | ||
789 | }; | 790 | }; |
790 | 791 | ||
791 | struct smb_version_values smb1_values = { | 792 | struct smb_version_values smb1_values = { |