|
@@ -1648,6 +1648,27 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * Marshal up the iov array, reserving the first one for the header. Also,
|
|
|
+ * set wdata->bytes.
|
|
|
+ */
|
|
|
+static void
|
|
|
+cifs_writepages_marshal_iov(struct kvec *iov, struct cifs_writedata *wdata)
|
|
|
+{
|
|
|
+ int i;
|
|
|
+ struct inode *inode = wdata->cfile->dentry->d_inode;
|
|
|
+ loff_t size = i_size_read(inode);
|
|
|
+
|
|
|
+ /* marshal up the pages into iov array */
|
|
|
+ wdata->bytes = 0;
|
|
|
+ for (i = 0; i < wdata->nr_pages; i++) {
|
|
|
+ iov[i + 1].iov_len = min(size - page_offset(wdata->pages[i]),
|
|
|
+ (loff_t)PAGE_CACHE_SIZE);
|
|
|
+ iov[i + 1].iov_base = kmap(wdata->pages[i]);
|
|
|
+ wdata->bytes += iov[i + 1].iov_len;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static int cifs_writepages(struct address_space *mapping,
|
|
|
struct writeback_control *wbc)
|
|
|
{
|
|
@@ -1792,6 +1813,7 @@ retry:
|
|
|
wdata->sync_mode = wbc->sync_mode;
|
|
|
wdata->nr_pages = nr_pages;
|
|
|
wdata->offset = page_offset(wdata->pages[0]);
|
|
|
+ wdata->marshal_iov = cifs_writepages_marshal_iov;
|
|
|
|
|
|
do {
|
|
|
if (wdata->cfile != NULL)
|