NFS: account direct-io into task io accounting
authorKonstantin Khlebnikov <khlebnikov@openvz.org>
Mon, 21 Feb 2011 21:28:34 +0000 (00:28 +0300)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 11 Mar 2011 20:39:27 +0000 (15:39 -0500)
Account NFS direct-io reads and writes into Task I/O Accounting.
Do it before complition to handle aio.

NFS have unusual direct-io implementation,
thus accounting in generic code does not work.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/direct.c

index f493bdd74f78c8c495bec568dc1a2875d32bfc73..8eea25366717848aa11c1caa1b5707a7aefa712e 100644 (file)
@@ -45,6 +45,7 @@
 #include <linux/pagemap.h>
 #include <linux/kref.h>
 #include <linux/slab.h>
+#include <linux/task_io_accounting_ops.h>
 
 #include <linux/nfs_fs.h>
 #include <linux/nfs_page.h>
@@ -937,6 +938,8 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
        if (retval)
                goto out;
 
+       task_io_account_read(count);
+
        retval = nfs_direct_read(iocb, iov, nr_segs, pos);
        if (retval > 0)
                iocb->ki_pos = pos + retval;
@@ -998,6 +1001,8 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
        if (retval)
                goto out;
 
+       task_io_account_write(count);
+
        retval = nfs_direct_write(iocb, iov, nr_segs, pos, count);
 
        if (retval > 0)