From: Chuck Lever Date: Mon, 1 Feb 2010 19:17:23 +0000 (-0500) Subject: NFS: Fix byte accounting for generic NFS reads X-Git-Tag: v2.6.34-rc1~190^2~12 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4184dcf2dbde481b34d370e1704f2b91a8c9f0d1;p=karo-tx-linux.git NFS: Fix byte accounting for generic NFS reads Currently, the NFS I/O counters count the number of bytes requested by applications, rather than the number of bytes actually read by the system calls. The number of bytes requested for reads is actually not that useful, because the value is usually a buffer size for reads. That is, that requested number is usually a maximum, and frequently doesn't reflect the actual number of bytes read. Signed-off-by: Chuck Lever Signed-off-by: Trond Myklebust --- diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 57cf94f129ba..7f4910c98c7c 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -262,9 +262,11 @@ nfs_file_read(struct kiocb *iocb, const struct iovec *iov, (unsigned long) count, (unsigned long) pos); result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping); - nfs_add_stats(inode, NFSIOS_NORMALREADBYTES, count); - if (!result) + if (!result) { result = generic_file_aio_read(iocb, iov, nr_segs, pos); + if (result > 0) + nfs_add_stats(inode, NFSIOS_NORMALREADBYTES, result); + } return result; }