From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752153Ab1BUVev (ORCPT ); Mon, 21 Feb 2011 16:34:51 -0500 Received: from relay.parallels.com ([195.214.232.42]:40300 "EHLO relay.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751738Ab1BUVet (ORCPT ); Mon, 21 Feb 2011 16:34:49 -0500 X-Greylist: delayed 434 seconds by postgrey-1.27 at vger.kernel.org; Mon, 21 Feb 2011 16:34:49 EST Message-ID: <4D62D8C4.3030004@parallels.com> Date: Tue, 22 Feb 2011 00:27:32 +0300 From: Konstantin Khlebnikov User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101214 SeaMonkey/2.0.11 MIME-Version: 1.0 To: Chuck Lever CC: "linux-nfs@vger.kernel.org" , Trond Myklebust , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] NFS: account direct-io into task io accounting References: <20110221191546.5920.96947.stgit@localhost6> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: 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 >> --- >> 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 >> #include >> #include >> +#include >> >> #include >> #include >> @@ -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 > > >