From: Miklos Szeredi <miklos@szeredi.hu>
To: Maxim Patlasov <mpatlasov@parallels.com>
Cc: fuse-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
devel@openvz.org
Subject: Re: [PATCH 4/6] fuse: rework fuse_readpages()
Date: Wed, 12 Sep 2012 18:42:13 +0200 [thread overview]
Message-ID: <87sjanw5ui.fsf@tucsk.pomaz.szeredi.hu> (raw)
In-Reply-To: <20120907174137.1343.93787.stgit@maximpc.sw.ru> (Maxim Patlasov's message of "Fri, 07 Sep 2012 21:41:40 +0400")
Maxim Patlasov <mpatlasov@parallels.com> writes:
> The patch uses 'nr_pages' argument of fuse_readpages() as the heuristics for
> number of page pointers to allocate.
>
> This can be improved further by taking in consideration fc->max_read and gaps
> between page indices, but it's not clear wheteher it's worthy or not.
> ---
> fs/fuse/file.c | 10 ++++++++--
> 1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index c811f3d..9a6dcc6 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -641,6 +641,7 @@ struct fuse_fill_data {
> struct fuse_req *req;
> struct file *file;
> struct inode *inode;
> + unsigned nr_pages;
> };
>
> static int fuse_readpages_fill(void *_data, struct page *page)
> @@ -656,8 +657,10 @@ static int fuse_readpages_fill(void *_data, struct page *page)
> (req->num_pages == FUSE_MAX_PAGES_PER_REQ ||
> (req->num_pages + 1) * PAGE_CACHE_SIZE > fc->max_read ||
> req->pages[req->num_pages - 1]->index + 1 != page->index)) {
> + int nr_alloc = min_t(unsigned, data->nr_pages,
> + FUSE_MAX_PAGES_PER_REQ);
> fuse_send_readpages(req, data->file);
> - data->req = req = fuse_get_req_multipage(fc, FUSE_MAX_PAGES_PER_REQ);
> + data->req = req = fuse_get_req_multipage(fc, nr_alloc);
> if (IS_ERR(req)) {
> unlock_page(page);
> return PTR_ERR(req);
> @@ -666,6 +669,7 @@ static int fuse_readpages_fill(void *_data, struct page *page)
> page_cache_get(page);
Okay, this is where things get hairy and where we should do something like:
if (WARN_ON(req->num_pages >= req->max_pages))
return -EIO;
> req->pages[req->num_pages] = page;
> req->num_pages++;
> + data->nr_pages--;
> return 0;
> }
>
> @@ -676,6 +680,7 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
> struct fuse_conn *fc = get_fuse_conn(inode);
> struct fuse_fill_data data;
> int err;
> + int nr_alloc = min_t(unsigned, nr_pages, FUSE_MAX_PAGES_PER_REQ);
>
> err = -EIO;
> if (is_bad_inode(inode))
> @@ -683,7 +688,8 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
>
> data.file = file;
> data.inode = inode;
> - data.req = fuse_get_req_multipage(fc, FUSE_MAX_PAGES_PER_REQ);
> + data.req = fuse_get_req_multipage(fc, nr_alloc);
> + data.nr_pages = nr_pages;
> err = PTR_ERR(data.req);
> if (IS_ERR(data.req))
> goto out;
next prev parent reply other threads:[~2012-09-12 16:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-07 17:40 [PATCH 0/6] fuse: allocate req->pages[] dynamically Maxim Patlasov
2012-09-07 17:41 ` [PATCH 1/6] fuse: general infrastructure for pages[] of variable size Maxim Patlasov
2012-09-12 16:09 ` Miklos Szeredi
2012-09-07 17:41 ` [PATCH 2/6] fuse: categorize fuse_get_req() Maxim Patlasov
2012-09-12 16:20 ` Miklos Szeredi
2012-09-07 17:41 ` [PATCH 3/6] fuse: rework fuse_retrieve() Maxim Patlasov
2012-09-12 16:24 ` Miklos Szeredi
2012-09-07 17:41 ` [PATCH 4/6] fuse: rework fuse_readpages() Maxim Patlasov
2012-09-12 16:42 ` Miklos Szeredi [this message]
2012-09-07 17:41 ` [PATCH 5/6] fuse: rework fuse_perform_write() Maxim Patlasov
2012-09-12 16:44 ` Miklos Szeredi
2012-09-07 17:41 ` [PATCH 6/6] fuse: rework fuse_do_ioctl() Maxim Patlasov
2012-09-10 10:18 ` [PATCH 0/6] fuse: allocate req->pages[] dynamically Maxim V. Patlasov
2012-09-12 16:07 ` Maxim V. Patlasov
2012-09-12 16:49 ` Miklos Szeredi
2012-09-14 13:18 ` Maxim V. Patlasov
2012-09-14 14:39 ` 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=87sjanw5ui.fsf@tucsk.pomaz.szeredi.hu \
--to=miklos@szeredi.hu \
--cc=devel@openvz.org \
--cc=fuse-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatlasov@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).