aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2014-07-10 03:31:53 -0400
committerSteve French <smfrench@gmail.com>2014-08-02 02:23:04 -0400
commitb770ddfa26fcb22ac85fbcdd0f5e88e65a118e01 (patch)
tree223519e4720c916958de7d2c9e89fa8b67419fe3
parentd913ed17f0a7d74e2847695bc920d77a33f2490b (diff)
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>
-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)
3281static void 3281static void
3282cifs_readv_complete(struct work_struct *work) 3282cifs_readv_complete(struct work_struct *work)
3283{ 3283{
3284 unsigned int i; 3284 unsigned int i, got_bytes;
3285 struct cifs_readdata *rdata = container_of(work, 3285 struct cifs_readdata *rdata = container_of(work,
3286 struct cifs_readdata, work); 3286 struct cifs_readdata, work);
3287 3287
3288 got_bytes = rdata->got_bytes;
3288 for (i = 0; i < rdata->nr_pages; i++) { 3289 for (i = 0; i < rdata->nr_pages; i++) {
3289 struct page *page = rdata->pages[i]; 3290 struct page *page = rdata->pages[i];
3290 3291
3291 lru_cache_add_file(page); 3292 lru_cache_add_file(page);
3292 3293
3293 if (rdata->result == 0) { 3294 if (rdata->result == 0 ||
3295 (rdata->result == -EAGAIN && got_bytes)) {
3294 flush_dcache_page(page); 3296 flush_dcache_page(page);
3295 SetPageUptodate(page); 3297 SetPageUptodate(page);
3296 } 3298 }
3297 3299
3298 unlock_page(page); 3300 unlock_page(page);
3299 3301
3300 if (rdata->result == 0) 3302 if (rdata->result == 0 ||
3303 (rdata->result == -EAGAIN && got_bytes))
3301 cifs_readpage_to_fscache(rdata->mapping->host, page); 3304 cifs_readpage_to_fscache(rdata->mapping->host, page);
3302 3305
3306 got_bytes -= min_t(unsigned int, PAGE_CACHE_SIZE, got_bytes);
3307
3303 page_cache_release(page); 3308 page_cache_release(page);
3304 rdata->pages[i] = NULL; 3309 rdata->pages[i] = NULL;
3305 } 3310 }