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 <snajpa@snajpa.net>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #313
Closes #1275
#include <linux/exportfs.h>
#include <linux/writeback.h>
#include <linux/falloc.h>
+#include <linux/task_io_accounting_ops.h>
/* zpl_inode.c */
extern void zpl_vap_init(vattr_t *vap, struct inode *dir,
uio_seg_t segment, int flags, cred_t *cr)
{
int error;
+ ssize_t read;
struct iovec iov;
uio_t uio;
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
uio_seg_t segment, int flags, cred_t *cr)
{
int error;
+ ssize_t wrote;
struct iovec iov;
uio_t uio;
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