Commit b3160aeb authored by Pavel Shilovsky's avatar Pavel Shilovsky Committed by Steve French

CIFS: Count got bytes in read_into_pages()

that let us know how many bytes we have already got before reconnect.
Signed-off-by: default avatarPavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: default avatarSteve French <smfrench@gmail.com>
parent 34a54d61
...@@ -1513,7 +1513,6 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) ...@@ -1513,7 +1513,6 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid)
return length; return length;
server->total_read += length; server->total_read += length;
rdata->got_bytes = length;
cifs_dbg(FYI, "total_read=%u buflen=%u remaining=%u\n", cifs_dbg(FYI, "total_read=%u buflen=%u remaining=%u\n",
server->total_read, buflen, data_len); server->total_read, buflen, data_len);
......
...@@ -2868,11 +2868,12 @@ static int ...@@ -2868,11 +2868,12 @@ static int
cifs_uncached_read_into_pages(struct TCP_Server_Info *server, cifs_uncached_read_into_pages(struct TCP_Server_Info *server,
struct cifs_readdata *rdata, unsigned int len) struct cifs_readdata *rdata, unsigned int len)
{ {
int total_read = 0, result = 0; int result = 0;
unsigned int i; unsigned int i;
unsigned int nr_pages = rdata->nr_pages; unsigned int nr_pages = rdata->nr_pages;
struct kvec iov; struct kvec iov;
rdata->got_bytes = 0;
rdata->tailsz = PAGE_SIZE; rdata->tailsz = PAGE_SIZE;
for (i = 0; i < nr_pages; i++) { for (i = 0; i < nr_pages; i++) {
struct page *page = rdata->pages[i]; struct page *page = rdata->pages[i];
...@@ -2906,10 +2907,11 @@ cifs_uncached_read_into_pages(struct TCP_Server_Info *server, ...@@ -2906,10 +2907,11 @@ cifs_uncached_read_into_pages(struct TCP_Server_Info *server,
if (result < 0) if (result < 0)
break; break;
total_read += result; rdata->got_bytes += result;
} }
return total_read > 0 && result != -ECONNABORTED ? total_read : result; return rdata->got_bytes > 0 && result != -ECONNABORTED ?
rdata->got_bytes : result;
} }
static int static int
...@@ -3290,7 +3292,7 @@ static int ...@@ -3290,7 +3292,7 @@ static int
cifs_readpages_read_into_pages(struct TCP_Server_Info *server, cifs_readpages_read_into_pages(struct TCP_Server_Info *server,
struct cifs_readdata *rdata, unsigned int len) struct cifs_readdata *rdata, unsigned int len)
{ {
int total_read = 0, result = 0; int result = 0;
unsigned int i; unsigned int i;
u64 eof; u64 eof;
pgoff_t eof_index; pgoff_t eof_index;
...@@ -3302,6 +3304,7 @@ cifs_readpages_read_into_pages(struct TCP_Server_Info *server, ...@@ -3302,6 +3304,7 @@ cifs_readpages_read_into_pages(struct TCP_Server_Info *server,
eof_index = eof ? (eof - 1) >> PAGE_CACHE_SHIFT : 0; eof_index = eof ? (eof - 1) >> PAGE_CACHE_SHIFT : 0;
cifs_dbg(FYI, "eof=%llu eof_index=%lu\n", eof, eof_index); cifs_dbg(FYI, "eof=%llu eof_index=%lu\n", eof, eof_index);
rdata->got_bytes = 0;
rdata->tailsz = PAGE_CACHE_SIZE; rdata->tailsz = PAGE_CACHE_SIZE;
for (i = 0; i < nr_pages; i++) { for (i = 0; i < nr_pages; i++) {
struct page *page = rdata->pages[i]; struct page *page = rdata->pages[i];
...@@ -3356,10 +3359,11 @@ cifs_readpages_read_into_pages(struct TCP_Server_Info *server, ...@@ -3356,10 +3359,11 @@ cifs_readpages_read_into_pages(struct TCP_Server_Info *server,
if (result < 0) if (result < 0)
break; break;
total_read += result; rdata->got_bytes += result;
} }
return total_read > 0 && result != -ECONNABORTED ? total_read : result; return rdata->got_bytes > 0 && result != -ECONNABORTED ?
rdata->got_bytes : result;
} }
static int static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment