aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-03-23 14:40:56 -0400
committerJeff Layton <jlayton@redhat.com>2012-03-23 14:40:56 -0400
commite9492871fb0546f1b73f309d9e8c0f030bfdfdca (patch)
treebe69a497fddd74de6b2f6ed18f525907a6dadab4 /fs/cifs/cifssmb.c
parenta7103b99e4cc00b9d40f6bad77389f9e2341820a (diff)
cifs: abstract out function to marshal up the iovec array for async writes
We'll need to do something a bit different depending on the caller. Abstract the code that marshals the page array into an iovec. Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Pavel Shilovsky <piastry@etersoft.ru>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 21ff4bff6c89..5ec0b90b0444 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -2142,7 +2142,6 @@ cifs_async_writev(struct cifs_writedata *wdata)
2142 WRITE_REQ *smb = NULL; 2142 WRITE_REQ *smb = NULL;
2143 int wct; 2143 int wct;
2144 struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink); 2144 struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink);
2145 struct inode *inode = wdata->cfile->dentry->d_inode;
2146 struct kvec *iov = NULL; 2145 struct kvec *iov = NULL;
2147 2146
2148 if (tcon->ses->capabilities & CAP_LARGE_FILES) { 2147 if (tcon->ses->capabilities & CAP_LARGE_FILES) {
@@ -2185,15 +2184,13 @@ cifs_async_writev(struct cifs_writedata *wdata)
2185 iov[0].iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4 + 1; 2184 iov[0].iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4 + 1;
2186 iov[0].iov_base = smb; 2185 iov[0].iov_base = smb;
2187 2186
2188 /* marshal up the pages into iov array */ 2187 /*
2189 wdata->bytes = 0; 2188 * This function should marshal up the page array into the kvec
2190 for (i = 0; i < wdata->nr_pages; i++) { 2189 * array, reserving [0] for the header. It should kmap the pages
2191 iov[i + 1].iov_len = min(inode->i_size - 2190 * and set the iov_len properly for each one. It may also set
2192 page_offset(wdata->pages[i]), 2191 * wdata->bytes too.
2193 (loff_t)PAGE_CACHE_SIZE); 2192 */
2194 iov[i + 1].iov_base = kmap(wdata->pages[i]); 2193 wdata->marshal_iov(iov, wdata);
2195 wdata->bytes += iov[i + 1].iov_len;
2196 }
2197 2194
2198 cFYI(1, "async write at %llu %u bytes", wdata->offset, wdata->bytes); 2195 cFYI(1, "async write at %llu %u bytes", wdata->offset, wdata->bytes);
2199 2196