From: Miklos Szeredi <miklos@szeredi.hu>
To: "Maxim V. Patlasov" <MPatlasov@parallels.com>
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 04/14] fuse: Prepare to handle multiple pages in writeback
Date: Thu, 25 Apr 2013 12:22:08 +0200 [thread overview]
Message-ID: <CAJfpegvgbQg9YTbpE6mtsXFQDZRMPgtmKV9O5L8h0cHP_QdWrQ@mail.gmail.com> (raw)
In-Reply-To: <20130401104111.19027.1794.stgit@maximpc.sw.ru>
On Mon, Apr 1, 2013 at 12:41 PM, Maxim V. Patlasov
<MPatlasov@parallels.com> wrote:
>
> The .writepages callback will issue writeback requests with more than one
> page aboard. Make existing end/check code be aware of this.
>
> Original patch by: Pavel Emelyanov <xemul@openvz.org>
If this patch was written by Pavel and then modified by you then
please add a "From:" header at the top of the patch instead. See
Documentation/SubmittingPatches.
> Signed-off-by: Maxim Patlasov <MPatlasov@parallels.com>
> ---
> fs/fuse/file.c | 22 +++++++++++++++-------
> 1 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index 648de34..ee44b24 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -345,7 +345,8 @@ static bool fuse_page_is_writeback(struct inode *inode, pgoff_t index)
>
> BUG_ON(req->inode != inode);
> curr_index = req->misc.write.in.offset >> PAGE_CACHE_SHIFT;
> - if (curr_index == index) {
> + if (curr_index <= index &&
> + index < curr_index + req->num_pages) {
> found = true;
> break;
> }
> @@ -1295,7 +1296,10 @@ static ssize_t fuse_direct_write(struct file *file, const char __user *buf,
>
> static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req)
> {
> - __free_page(req->pages[0]);
> + int i;
> +
> + for (i = 0; i < req->num_pages; i++)
> + __free_page(req->pages[i]);
> fuse_file_put(req->ff, false);
> }
>
> @@ -1304,10 +1308,13 @@ static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req)
> struct inode *inode = req->inode;
> struct fuse_inode *fi = get_fuse_inode(inode);
> struct backing_dev_info *bdi = inode->i_mapping->backing_dev_info;
> + int i;
>
> list_del(&req->writepages_entry);
> - dec_bdi_stat(bdi, BDI_WRITEBACK);
> - dec_zone_page_state(req->pages[0], NR_WRITEBACK_TEMP);
> + for (i = 0; i < req->num_pages; i++) {
> + dec_bdi_stat(bdi, BDI_WRITEBACK);
> + dec_zone_page_state(req->pages[i], NR_WRITEBACK_TEMP);
> + }
> bdi_writeout_inc(bdi);
> wake_up(&fi->page_waitq);
> }
> @@ -1320,14 +1327,15 @@ __acquires(fc->lock)
> struct fuse_inode *fi = get_fuse_inode(req->inode);
> loff_t size = i_size_read(req->inode);
> struct fuse_write_in *inarg = &req->misc.write.in;
> + __u64 data_size = req->num_pages * PAGE_CACHE_SIZE;
>
> if (!fc->connected)
> goto out_free;
>
> - if (inarg->offset + PAGE_CACHE_SIZE <= size) {
> - inarg->size = PAGE_CACHE_SIZE;
> + if (inarg->offset + data_size <= size) {
> + inarg->size = data_size;
> } else if (inarg->offset < size) {
> - inarg->size = size & (PAGE_CACHE_SIZE - 1);
> + inarg->size = size - inarg->offset;
> } else {
> /* Got truncated off completely */
> goto out_free;
>
next prev parent reply other threads:[~2013-04-25 10:22 UTC|newest]
Thread overview: 30+ 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
[not found] ` <20130401103749.19027.89833.stgit-vWG5eQQidJHciZdyczg/7Q@public.gmane.org>
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 [this message]
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: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
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-01 10:41 ` [PATCH 08/14] fuse: Flush files on wb close Maxim V. Patlasov
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
-- strict thread matches above, loose matches on Subject: below --
2013-01-25 18:20 [PATCH v3 " Maxim V. Patlasov
[not found] ` <20130125181700.10037.29163.stgit-vWG5eQQidJHciZdyczg/7Q@public.gmane.org>
2013-01-25 18:21 ` [PATCH 04/14] fuse: Prepare to handle multiple pages in writeback Maxim V. Patlasov
2012-11-16 17:04 [PATCH v2 00/14] fuse: An attempt to implement a write-back cache policy Maxim Patlasov
[not found] ` <20121116170123.3196.93431.stgit-vWG5eQQidJHciZdyczg/7Q@public.gmane.org>
2012-11-16 17:07 ` [PATCH 04/14] fuse: Prepare to handle multiple pages in writeback Maxim Patlasov
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=CAJfpegvgbQg9YTbpE6mtsXFQDZRMPgtmKV9O5L8h0cHP_QdWrQ@mail.gmail.com \
--to=miklos@szeredi.hu \
--cc=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=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;
as well as URLs for NNTP newsgroup(s).