summaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2014-07-10 09:31:53 +0200
committerSteve French <smfrench@gmail.com>2014-08-02 08:23:04 +0200
commitb770ddfa26fcb22ac85fbcdd0f5e88e65a118e01 (patch)
tree223519e4720c916958de7d2c9e89fa8b67419fe3 /fs/cifs/file.c
parentCIFS: Optimize cifs_user_read() in a short read case on reconnects (diff)
downloadlinux-b770ddfa26fcb22ac85fbcdd0f5e88e65a118e01.tar.xz
linux-b770ddfa26fcb22ac85fbcdd0f5e88e65a118e01.zip
CIFS: Optimize readpages in a short read case on reconnects
by marking pages with a data from a partially received response up-to-date. This is suitable for non-signed connections. Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 5d2501df8f6b..12b64e02eee1 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3281,25 +3281,30 @@ int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
static void
cifs_readv_complete(struct work_struct *work)
{
- unsigned int i;
+ unsigned int i, got_bytes;
struct cifs_readdata *rdata = container_of(work,
struct cifs_readdata, work);
+ got_bytes = rdata->got_bytes;
for (i = 0; i < rdata->nr_pages; i++) {
struct page *page = rdata->pages[i];
lru_cache_add_file(page);
- if (rdata->result == 0) {
+ if (rdata->result == 0 ||
+ (rdata->result == -EAGAIN && got_bytes)) {
flush_dcache_page(page);
SetPageUptodate(page);
}
unlock_page(page);
- if (rdata->result == 0)
+ if (rdata->result == 0 ||
+ (rdata->result == -EAGAIN && got_bytes))
cifs_readpage_to_fscache(rdata->mapping->host, page);
+ got_bytes -= min_t(unsigned int, PAGE_CACHE_SIZE, got_bytes);
+
page_cache_release(page);
rdata->pages[i] = NULL;
}