* [PATCH] NFS: account direct-io into task io accounting
@ 2011-02-21 19:15 Konstantin Khlebnikov
2011-02-21 20:17 ` Chuck Lever
2011-02-21 21:28 ` [PATCH v2] " Konstantin Khlebnikov
0 siblings, 2 replies; 4+ messages in thread
From: Konstantin Khlebnikov @ 2011-02-21 19:15 UTC (permalink / raw)
To: linux-nfs; +Cc: Trond Myklebust, linux-kernel
Account complete NFS direct-io reads and writes into Task I/O Accounting.
NFS have unusual direct-io implementation,
thus accounting in generic code does not work.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
---
fs/nfs/direct.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 9943a75..bab4185 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -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>
@@ -939,8 +940,10 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
goto out;
retval = nfs_direct_read(iocb, iov, nr_segs, pos);
- if (retval > 0)
+ if (retval > 0) {
iocb->ki_pos = pos + retval;
+ task_io_account_read(retval);
+ }
out:
return retval;
@@ -1001,8 +1004,10 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
retval = nfs_direct_write(iocb, iov, nr_segs, pos, count);
- if (retval > 0)
+ if (retval > 0) {
iocb->ki_pos = pos + retval;
+ task_io_account_write(retval);
+ }
out:
return retval;
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] NFS: account direct-io into task io accounting
2011-02-21 19:15 [PATCH] NFS: account direct-io into task io accounting Konstantin Khlebnikov
@ 2011-02-21 20:17 ` Chuck Lever
2011-02-21 21:27 ` Konstantin Khlebnikov
2011-02-21 21:28 ` [PATCH v2] " Konstantin Khlebnikov
1 sibling, 1 reply; 4+ messages in thread
From: Chuck Lever @ 2011-02-21 20:17 UTC (permalink / raw)
To: Konstantin Khlebnikov; +Cc: linux-nfs, Trond Myklebust, linux-kernel
On Feb 21, 2011, at 11:15 AM, Konstantin Khlebnikov wrote:
> Account complete NFS direct-io reads and writes into Task I/O Accounting.
>
> NFS have unusual direct-io implementation,
> thus accounting in generic code does not work.
>
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
> ---
> fs/nfs/direct.c | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
> index 9943a75..bab4185 100644
> --- a/fs/nfs/direct.c
> +++ b/fs/nfs/direct.c
> @@ -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>
> @@ -939,8 +940,10 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
> goto out;
>
> retval = nfs_direct_read(iocb, iov, nr_segs, pos);
> - if (retval > 0)
> + if (retval > 0) {
> iocb->ki_pos = pos + retval;
> + task_io_account_read(retval);
> + }
>
> out:
> return retval;
> @@ -1001,8 +1004,10 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
>
> retval = nfs_direct_write(iocb, iov, nr_segs, pos, count);
>
> - if (retval > 0)
> + if (retval > 0) {
> iocb->ki_pos = pos + retval;
> + task_io_account_write(retval);
> + }
The async path always returns -EIOCBQUEUED. How are those bytes accounted for?
>
> out:
> return retval;
--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] NFS: account direct-io into task io accounting
2011-02-21 20:17 ` Chuck Lever
@ 2011-02-21 21:27 ` Konstantin Khlebnikov
0 siblings, 0 replies; 4+ messages in thread
From: Konstantin Khlebnikov @ 2011-02-21 21:27 UTC (permalink / raw)
To: Chuck Lever
Cc: linux-nfs@vger.kernel.org, Trond Myklebust,
linux-kernel@vger.kernel.org
Chuck Lever wrote:
>
> On Feb 21, 2011, at 11:15 AM, Konstantin Khlebnikov wrote:
>
>> Account complete NFS direct-io reads and writes into Task I/O Accounting.
>>
>> NFS have unusual direct-io implementation,
>> thus accounting in generic code does not work.
>>
>> Signed-off-by: Konstantin Khlebnikov<khlebnikov@openvz.org>
>> ---
>> fs/nfs/direct.c | 9 +++++++--
>> 1 files changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
>> index 9943a75..bab4185 100644
>> --- a/fs/nfs/direct.c
>> +++ b/fs/nfs/direct.c
>> @@ -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>
>> @@ -939,8 +940,10 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
>> goto out;
>>
>> retval = nfs_direct_read(iocb, iov, nr_segs, pos);
>> - if (retval> 0)
>> + if (retval> 0) {
>> iocb->ki_pos = pos + retval;
>> + task_io_account_read(retval);
>> + }
>>
>> out:
>> return retval;
>> @@ -1001,8 +1004,10 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
>>
>> retval = nfs_direct_write(iocb, iov, nr_segs, pos, count);
>>
>> - if (retval> 0)
>> + if (retval> 0) {
>> iocb->ki_pos = pos + retval;
>> + task_io_account_write(retval);
>> + }
>
> The async path always returns -EIOCBQUEUED. How are those bytes accounted for?
>
Oh, thanks. I forget about aio.
So, there only one option -- always account whole requiest before completion.
>>
>> out:
>> return retval;
>
> --
> Chuck Lever
> chuck[dot]lever[at]oracle[dot]com
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] NFS: account direct-io into task io accounting
2011-02-21 19:15 [PATCH] NFS: account direct-io into task io accounting Konstantin Khlebnikov
2011-02-21 20:17 ` Chuck Lever
@ 2011-02-21 21:28 ` Konstantin Khlebnikov
1 sibling, 0 replies; 4+ messages in thread
From: Konstantin Khlebnikov @ 2011-02-21 21:28 UTC (permalink / raw)
To: linux-nfs; +Cc: Chuck Lever, Trond Myklebust, linux-kernel
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>
---
fs/nfs/direct.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 9943a75..bd2cb5d 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -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>
@@ -938,6 +939,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;
@@ -999,6 +1002,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)
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-21 21:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-21 19:15 [PATCH] NFS: account direct-io into task io accounting Konstantin Khlebnikov
2011-02-21 20:17 ` Chuck Lever
2011-02-21 21:27 ` Konstantin Khlebnikov
2011-02-21 21:28 ` [PATCH v2] " Konstantin Khlebnikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).