aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2014-07-10 03:31:48 -0400
committerSteve French <smfrench@gmail.com>2014-08-02 02:23:04 -0400
commitd913ed17f0a7d74e2847695bc920d77a33f2490b (patch)
tree2c511ecc0304b341b370834fc989d4b9d3c42d60 /fs/cifs/file.c
parentfb8a3e52559ad52829c6838d304f5b75c140b97a (diff)
CIFS: Optimize cifs_user_read() in a short read case on reconnects
by filling the output buffer with a data got from a partially received response and requesting the remaining data from the server. 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.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e17012817d9d..5d2501df8f6b 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3030,13 +3030,30 @@ again:
3030 else if (rdata->result == -EAGAIN) { 3030 else if (rdata->result == -EAGAIN) {
3031 /* resend call if it's a retryable error */ 3031 /* resend call if it's a retryable error */
3032 struct list_head tmp_list; 3032 struct list_head tmp_list;
3033 unsigned int got_bytes = rdata->got_bytes;
3033 3034
3034 list_del_init(&rdata->list); 3035 list_del_init(&rdata->list);
3035 INIT_LIST_HEAD(&tmp_list); 3036 INIT_LIST_HEAD(&tmp_list);
3036 3037
3037 rc = cifs_send_async_read(rdata->offset, 3038 /*
3038 rdata->bytes, rdata->cfile, 3039 * Got a part of data and then reconnect has
3039 cifs_sb, &tmp_list); 3040 * happened -- fill the buffer and continue
3041 * reading.
3042 */
3043 if (got_bytes && got_bytes < rdata->bytes) {
3044 rc = cifs_readdata_to_iov(rdata, to);
3045 if (rc) {
3046 kref_put(&rdata->refcount,
3047 cifs_uncached_readdata_release);
3048 continue;
3049 }
3050 }
3051
3052 rc = cifs_send_async_read(
3053 rdata->offset + got_bytes,
3054 rdata->bytes - got_bytes,
3055 rdata->cfile, cifs_sb,
3056 &tmp_list);
3040 3057
3041 list_splice(&tmp_list, &rdata_list); 3058 list_splice(&tmp_list, &rdata_list);
3042 3059