CIFS: Use separate var for the number of bytes got in async read
authorPavel Shilovsky <pshilovsky@samba.org>
Thu, 10 Jul 2014 06:03:29 +0000 (10:03 +0400)
committerSteve French <smfrench@gmail.com>
Sat, 2 Aug 2014 06:23:04 +0000 (01:23 -0500)
and don't mix it with the number of bytes that was requested.

Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/cifsglob.h
fs/cifs/cifssmb.c
fs/cifs/file.c
fs/cifs/smb2pdu.c

index f33ff4c7b8a8279ca89f9bb30955b8691bf456a0..0012e1e291d427cbb4a6696792cb85743231ec1e 100644 (file)
@@ -1059,6 +1059,7 @@ struct cifs_readdata {
        struct address_space            *mapping;
        __u64                           offset;
        unsigned int                    bytes;
+       unsigned int                    got_bytes;
        pid_t                           pid;
        int                             result;
        struct work_struct              work;
index 1b3f0aef01e3d44da9166b186d43871ac7737840..1781a03aed5ed5b18245356443c1c545befbcf33 100644 (file)
@@ -1513,7 +1513,7 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid)
                return length;
 
        server->total_read += length;
-       rdata->bytes = length;
+       rdata->got_bytes = length;
 
        cifs_dbg(FYI, "total_read=%u buflen=%u remaining=%u\n",
                 server->total_read, buflen, data_len);
@@ -1556,8 +1556,8 @@ cifs_readv_callback(struct mid_q_entry *mid)
                                         rc);
                }
                /* FIXME: should this be counted toward the initiating task? */
-               task_io_account_read(rdata->bytes);
-               cifs_stats_bytes_read(tcon, rdata->bytes);
+               task_io_account_read(rdata->got_bytes);
+               cifs_stats_bytes_read(tcon, rdata->got_bytes);
                break;
        case MID_REQUEST_SUBMITTED:
        case MID_RETRY_NEEDED:
index 9582ded2332e763d52c86e7d268b1fbd726a6ce1..3d5d488385197c74e88fdbd4c2e94d297743998d 100644 (file)
@@ -2840,7 +2840,7 @@ cifs_uncached_readdata_release(struct kref *refcount)
 static int
 cifs_readdata_to_iov(struct cifs_readdata *rdata, struct iov_iter *iter)
 {
-       size_t remaining = rdata->bytes;
+       size_t remaining = rdata->got_bytes;
        unsigned int i;
 
        for (i = 0; i < rdata->nr_pages; i++) {
index c31e5a060338d01e1dda9a89854343a0e77950d0..c66ae4183bd31f07a9af323afd53f6dd48f5ce55 100644 (file)
@@ -1723,8 +1723,8 @@ smb2_readv_callback(struct mid_q_entry *mid)
                                         rc);
                }
                /* FIXME: should this be counted toward the initiating task? */
-               task_io_account_read(rdata->bytes);
-               cifs_stats_bytes_read(tcon, rdata->bytes);
+               task_io_account_read(rdata->got_bytes);
+               cifs_stats_bytes_read(tcon, rdata->got_bytes);
                break;
        case MID_REQUEST_SUBMITTED:
        case MID_RETRY_NEEDED: