All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxim Patlasov <mpatlasov@parallels.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: <dev@parallels.com>, <xemul@parallels.com>,
	<fuse-devel@lists.sourceforge.net>, <bfoster@redhat.com>,
	<linux-kernel@vger.kernel.org>, <jbottomley@parallels.com>,
	<linux-fsdevel@vger.kernel.org>, <akpm@linux-foundation.org>,
	<fengguang.wu@intel.com>, <devel@openvz.org>
Subject: Re: [PATCH 07/11] fuse: restructure fuse_readpage()
Date: Fri, 20 Dec 2013 18:54:40 +0400	[thread overview]
Message-ID: <52B45A30.10808@parallels.com> (raw)
In-Reply-To: <20131112171707.GB10813@tucsk.piliscsaba.szeredi.hu>

Hi Miklos,

Sorry for delay, see please inline comments below.

On 11/12/2013 09:17 PM, Miklos Szeredi wrote:
> On Thu, Oct 10, 2013 at 05:11:25PM +0400, Maxim Patlasov wrote:
>> Move the code filling and sending read request to a separate function. Future
>> patches will use it for .write_begin -- partial modification of a page
>> requires reading the page from the storage very similarly to what fuse_readpage
>> does.
>>
>> Signed-off-by: Maxim Patlasov <MPatlasov@parallels.com>
>> ---
>>   fs/fuse/file.c |   55 +++++++++++++++++++++++++++++++++++++------------------
>>   1 file changed, 37 insertions(+), 18 deletions(-)
>>
>> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
>> index b4d4189..77eb849 100644
>> --- a/fs/fuse/file.c
>> +++ b/fs/fuse/file.c
>> @@ -700,21 +700,14 @@ static void fuse_short_read(struct fuse_req *req, struct inode *inode,
>>   	}
>>   }
>>   
>> -static int fuse_readpage(struct file *file, struct page *page)
>> +static int __fuse_readpage(struct file *file, struct page *page, size_t count,
>> +			   int *err, struct fuse_req **req_pp, u64 *attr_ver_p)
> Signature of this helper looks really ugly.  A quick look tells me that neither
> caller actually needs 'req'.

fuse_readpage() passes 'req' to fuse_short_read(). And the latter uses 
req->pages[] to nullify a part of request.

> And fuse_get_attr_version() can be moved to the
> one caller that needs it.

Yes, it's doable. But this would make attr_version mechanism less 
efficient (under some loads): suppose the file on server was truncated 
externally, then fuse_readpage() acquires fc->attr_version, then some 
innocent write bumps fc->attr_version while we're waiting for fuse 
writeback, then fuse_read_update_size() would noop. In the other words, 
it's beneficial to keep the time interval between acquiring 
fc->attr_version and subsequent comparison as short as possible.

> And negative err can be returned.

Yes, but this will require some precautions for positive 
req->out.h.error. Like "err = (req->out.h.error <= 0) ? req->out.h.error 
: -EIO;". But this must be OK - filtering out positive req->out.h.error 
is a good idea, imho.


> And then all those
> ugly pointer args are gone and the whole thing is much simpler.

If you agree with my comments above, only 1 of 3 ugly pointers can be 
avoided. Another way would be to revert the code back to the initial 
implementation where fuse_readpage() and fuse_prepare_write() sent read 
requests independently.

Thanks,
Maxim

  reply	other threads:[~2013-12-20 14:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-10 13:09 [PATCH v6 00/11] fuse: An attempt to implement a write-back cache policy Maxim Patlasov
2013-10-10 13:10 ` [PATCH 01/11] fuse: Linking file to inode helper Maxim Patlasov
2013-10-10 13:10 ` [PATCH 02/11] fuse: Prepare to handle short reads Maxim Patlasov
2013-10-10 13:10 ` [PATCH 03/11] fuse: Connection bit for enabling writeback Maxim Patlasov
2013-10-10 13:10 ` [PATCH 04/11] fuse: Trust kernel i_size only - v4 Maxim Patlasov
     [not found] ` <20131010130718.10089.6736.stgit-opBMJL+S1+lZ2WjqXT1pg9yJl3JzOD/t@public.gmane.org>
2013-10-10 13:10   ` [PATCH 05/11] fuse: Trust kernel i_mtime only -v2 Maxim Patlasov
2013-10-10 13:10     ` Maxim Patlasov
2013-11-12 16:52     ` Miklos Szeredi
2013-12-26 15:41       ` Maxim Patlasov
2014-01-06 16:22         ` Miklos Szeredi
2014-01-20 11:33           ` Maxim Patlasov
2013-12-26 15:51       ` [PATCH 05/11] fuse: Trust kernel i_mtime only -v3 Maxim Patlasov
2013-10-10 13:11 ` [PATCH 06/11] fuse: Flush files on wb close -v2 Maxim Patlasov
     [not found]   ` <20131010131102.10089.51081.stgit-opBMJL+S1+lZ2WjqXT1pg9yJl3JzOD/t@public.gmane.org>
2013-10-10 13:19     ` [PATCH] " Maxim Patlasov
2013-10-10 13:19       ` Maxim Patlasov
2013-10-10 13:11 ` [PATCH 07/11] fuse: restructure fuse_readpage() Maxim Patlasov
2013-11-12 17:17   ` Miklos Szeredi
2013-12-20 14:54     ` Maxim Patlasov [this message]
2014-01-06 16:43       ` Miklos Szeredi
2014-01-20 11:46         ` Maxim Patlasov
2013-10-10 13:11 ` [PATCH 08/11] fuse: Implement write_begin/write_end callbacks -v2 Maxim Patlasov
2013-10-10 13:11 ` [PATCH 09/11] fuse: fuse_flush() should wait on writeback Maxim Patlasov
2013-10-10 13:12 ` [PATCH 10/11] fuse: Fix O_DIRECT operations vs cached writeback misorder - v2 Maxim Patlasov
2013-10-10 13:12 ` [PATCH 11/11] fuse: Turn writeback cache on Maxim Patlasov
     [not found] ` <87li13pido.fsf@vostro.rath.org>
     [not found]   ` <CAJfpegvFFXPuEoXXXJCBLEQi+T3mx95g4X+MjxAbyg0rhjbfDA@mail.gmail.com>
     [not found]     ` <528321C3.20307@parallels.com>
     [not found]       ` <CAJfpegu_ScgdgHDVM_5GMQC86OFnpXLDsuArKbWP_cX-D8m8Jw@mail.gmail.com>
     [not found]         ` <52FA4ECD.2030608@parallels.com>
     [not found]           ` <52FC2DE5.9010008@rath.org>
     [not found]             ` <52FCB029.9040608@parallels.com>
     [not found]               ` <87wqgwdvi1.fsf@vostro.rath.org>
2014-02-27 15:33                 ` fuse write performance Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52B45A30.10808@parallels.com \
    --to=mpatlasov@parallels.com \
    --cc=akpm@linux-foundation.org \
    --cc=bfoster@redhat.com \
    --cc=dev@parallels.com \
    --cc=devel@openvz.org \
    --cc=fengguang.wu@intel.com \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=jbottomley@parallels.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=xemul@parallels.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.