Skip to content

Commit

Permalink
NFS: account direct-io into task io accounting
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Konstantin Khlebnikov authored and Trond Myklebust committed Mar 11, 2011
1 parent f862822 commit 7ec10f2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7ec10f2

Please sign in to comment.