diff options
author | Brian Behlendorf <[email protected]> | 2013-11-15 09:59:09 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-11-21 08:56:24 -0800 |
commit | e3dc14b86182a82d99faaa5979846750d937160e (patch) | |
tree | 5359330224fc5ce789a6cff3eefbab352dd3c3f0 /module/zfs/zpl_file.c | |
parent | 29714574fa17291d8427f9a45b109292166d5551 (diff) |
Add I/O Read/Write Accounting
Because ZFS bypasses the page cache we don't inherit per-task I/O
accounting for free. However, the Linux kernel does provide helper
functions allow us to perform our own accounting. These are most
commonly used for direct IO which also bypasses the page cache, but
they can be used for the common read/write call paths as well.
Signed-off-by: Pavel Snajdr <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #313
Closes #1275
Diffstat (limited to 'module/zfs/zpl_file.c')
-rw-r--r-- | module/zfs/zpl_file.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c index 6598c1779..8054645c1 100644 --- a/module/zfs/zpl_file.c +++ b/module/zfs/zpl_file.c @@ -170,6 +170,7 @@ zpl_read_common(struct inode *ip, const char *buf, size_t len, loff_t pos, uio_seg_t segment, int flags, cred_t *cr) { int error; + ssize_t read; struct iovec iov; uio_t uio; @@ -187,7 +188,10 @@ zpl_read_common(struct inode *ip, const char *buf, size_t len, loff_t pos, if (error < 0) return (error); - return (len - uio.uio_resid); + read = len - uio.uio_resid; + task_io_account_read(read); + + return (read); } static ssize_t @@ -213,6 +217,7 @@ zpl_write_common(struct inode *ip, const char *buf, size_t len, loff_t pos, uio_seg_t segment, int flags, cred_t *cr) { int error; + ssize_t wrote; struct iovec iov; uio_t uio; @@ -230,7 +235,10 @@ zpl_write_common(struct inode *ip, const char *buf, size_t len, loff_t pos, if (error < 0) return (error); - return (len - uio.uio_resid); + wrote = len - uio.uio_resid; + task_io_account_write(wrote); + + return (wrote); } static ssize_t |