From: Maxim Patlasov <mpatlasov@parallels.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Kirill Korotaev <dev@parallels.com>,
Pavel Emelianov <xemul@parallels.com>,
fuse-devel <fuse-devel@lists.sourceforge.net>,
Kernel Mailing List <linux-kernel@vger.kernel.org>,
James Bottomley <jbottomley@parallels.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Linux-Fsdevel <linux-fsdevel@vger.kernel.org>, <devel@openvz.org>
Subject: Re: [PATCH 09/14] fuse: Implement writepages and write_begin/write_end callbacks - v3
Date: Fri, 14 Jun 2013 18:03:01 +0400 [thread overview]
Message-ID: <51BB2295.1020105@parallels.com> (raw)
In-Reply-To: <CAJfpegskt2zmKyx5sB49em86HqEJH3mZFH5hnuDXPuD_EtYzyw@mail.gmail.com>
Hi Miklos,
04/25/2013 02:35 PM, Miklos Szeredi пишет:
> On Mon, Apr 1, 2013 at 12:42 PM, Maxim V. Patlasov
> <MPatlasov@parallels.com> wrote:
>> The .writepages one is required to make each writeback request carry more than
>> one page on it.
> I'd split this into two parts:
>
> 1) implement ->writepages() and enable it unconditionally for mmaped
> writeback (why is it not enabled by this patch?)
>
> 2) implement ->write_begin() and ->write_end() and conditionally
> enable cached writeback
>
> More comments inline.
Thanks a lot for careful review. I agree with most of your comments and
will address them in the next version of patchset. The only point I
disagree is the following:
>> +
>> + spin_lock(&fc->lock);
>> + list_add(&req->writepages_entry, &fi->writepages);
>> + spin_unlock(&fc->lock);
>> +
>> + for (i = 0; i < req->num_pages; i++) {
>> + struct page *page = req->pages[i];
>> + struct page *tmp_page;
>> +
>> + tmp_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM);
>> + if (tmp_page) {
>> + copy_highpage(tmp_page, page);
>> + inc_bdi_stat(bdi, BDI_WRITEBACK);
>> + inc_zone_page_state(tmp_page, NR_WRITEBACK_TEMP);
> Is there a reason why we do the page allocation/copying here instead
> of at fill time? I'd guess it would be simpler and more logical
> there.
There is a problem to have in mind: we can't call
end_page_writeback(page) before update of fuse writeback state
(fi->writepages). Otherwise a nasty race would be possible when an
activity for that particular page offset intervenes in the middle of
writeback leading to multiple in-flight fuse requests for given page offset.
What you suggested is doable but would require additional space to stash
pointers to original pages because we cannot release them immediately
after copying (due to the problem described above). The size of the
space is not known in advance because we don't know how many pages
write_cache_pages() will process. The size is currently limited by
sizeof(struct page *) * FUSE_MAX_PAGES_PER_REQ, but may become variable
in future (a lot of people complain about 128K limit of fuse request).
Adding dynamically growing array of pages would make the code neither
simpler nor logical.
The approach I implemented utilizes the fact that
fuse_page_is_writeback() and friends require only
req->misc.write.in.offset and req->num_pages to be set correctly. Actual
pointers in req->pages[] doesn't matter. Thus, as soon as the two
parameters are known, I add the request to fi->writepages (blocking
other operations on given page offset) and perform "in place"
allocation/copying avoiding need for extra space to stash page pointers.
Thanks,
Maxim
next prev parent reply other threads:[~2013-06-14 14:03 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-01 10:40 [PATCH v4 00/14] fuse: An attempt to implement a write-back cache policy Maxim V. Patlasov
2013-04-01 10:40 ` [PATCH 01/14] fuse: Linking file to inode helper Maxim V. Patlasov
2013-04-01 10:40 ` [PATCH 02/14] fuse: Getting file for writeback helper Maxim V. Patlasov
2013-04-01 10:41 ` [PATCH 03/14] fuse: Prepare to handle short reads Maxim V. Patlasov
2013-04-01 10:41 ` [PATCH 04/14] fuse: Prepare to handle multiple pages in writeback Maxim V. Patlasov
2013-04-25 10:22 ` Miklos Szeredi
2013-04-01 10:41 ` [PATCH 05/14] fuse: Connection bit for enabling writeback Maxim V. Patlasov
2013-04-01 10:41 ` [PATCH 06/14] fuse: Trust kernel i_size only - v3 Maxim V. Patlasov
2013-04-01 10:41 ` [PATCH 07/14] fuse: Trust kernel i_mtime only Maxim V. Patlasov
2013-04-01 10:41 ` [PATCH 08/14] fuse: Flush files on wb close Maxim V. Patlasov
2013-04-01 10:42 ` [PATCH 09/14] fuse: Implement writepages and write_begin/write_end callbacks - v3 Maxim V. Patlasov
2013-04-25 10:35 ` Miklos Szeredi
2013-06-14 14:03 ` Maxim Patlasov [this message]
2013-04-01 10:42 ` [PATCH 10/14] fuse: fuse_writepage_locked() should wait on writeback Maxim V. Patlasov
2013-04-01 10:42 ` [PATCH 11/14] fuse: fuse_flush() " Maxim V. Patlasov
2013-04-01 10:42 ` [PATCH 12/14] fuse: Fix O_DIRECT operations vs cached writeback misorder - v2 Maxim V. Patlasov
2013-04-01 10:42 ` [PATCH 13/14] fuse: Turn writeback cache on Maxim V. Patlasov
2013-04-01 10:42 ` [PATCH 14/14] mm: Account for WRITEBACK_TEMP in balance_dirty_pages Maxim V. Patlasov
2013-04-25 14:29 ` [fuse-devel] " Maxim V. Patlasov
2013-04-25 15:49 ` Miklos Szeredi
2013-04-25 16:16 ` Maxim V. Patlasov
2013-04-25 20:43 ` Miklos Szeredi
2013-04-26 8:32 ` Maxim V. Patlasov
2013-04-26 14:02 ` Miklos Szeredi
2013-04-26 17:44 ` Maxim V. Patlasov
2013-05-07 11:39 ` Miklos Szeredi
2013-04-11 11:18 ` [fuse-devel] [PATCH v4 00/14] fuse: An attempt to implement a write-back cache policy Maxim V. Patlasov
2013-04-11 14:36 ` 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=51BB2295.1020105@parallels.com \
--to=mpatlasov@parallels.com \
--cc=dev@parallels.com \
--cc=devel@openvz.org \
--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=viro@zeniv.linux.org.uk \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox