From: Miklos Szeredi <miklos@szeredi.hu>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [patch 1/5] fuse: fix max i/o size calculation
Date: Fri, 25 Apr 2008 19:55:21 +0200 [thread overview]
Message-ID: <20080425175653.953206207@szeredi.hu> (raw)
In-Reply-To: 20080425175520.735386844@szeredi.hu
[-- Attachment #1: fuse_max_write_fix.patch --]
[-- Type: text/plain, Size: 2109 bytes --]
From: Miklos Szeredi <mszeredi@suse.cz>
Fix a bug that Werner Baumann reported: fuse can send a bigger write
request than the maximum specified. This only affected direct_io
operation.
In addition set a sane minimum for the max_read and max_write
tunables, so I/O always makes some progress.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
fs/fuse/file.c | 7 ++++---
fs/fuse/inode.c | 3 ++-
2 files changed, 6 insertions(+), 4 deletions(-)
Index: linux/fs/fuse/file.c
===================================================================
--- linux.orig/fs/fuse/file.c 2008-04-25 18:48:08.000000000 +0200
+++ linux/fs/fuse/file.c 2008-04-25 19:38:05.000000000 +0200
@@ -960,14 +960,15 @@ static ssize_t fuse_direct_io(struct fil
while (count) {
size_t nres;
- size_t nbytes = min(count, nmax);
- int err = fuse_get_user_pages(req, buf, nbytes, !write);
+ size_t nbytes_limit = min(count, nmax);
+ size_t nbytes;
+ int err = fuse_get_user_pages(req, buf, nbytes_limit, !write);
if (err) {
res = err;
break;
}
nbytes = (req->num_pages << PAGE_SHIFT) - req->page_offset;
- nbytes = min(count, nbytes);
+ nbytes = min(nbytes_limit, nbytes);
if (write)
nres = fuse_send_write(req, file, inode, pos, nbytes,
current->files);
Index: linux/fs/fuse/inode.c
===================================================================
--- linux.orig/fs/fuse/inode.c 2008-04-25 19:07:27.000000000 +0200
+++ linux/fs/fuse/inode.c 2008-04-25 19:38:05.000000000 +0200
@@ -585,6 +585,7 @@ static void process_init_reply(struct fu
fc->bdi.ra_pages = min(fc->bdi.ra_pages, ra_pages);
fc->minor = arg->minor;
fc->max_write = arg->minor < 5 ? 4096 : arg->max_write;
+ fc->max_write = min_t(unsigned, 4096, fc->max_write);
fc->conn_init = 1;
}
fuse_put_request(fc, req);
@@ -659,7 +660,7 @@ static int fuse_fill_super(struct super_
fc->flags = d.flags;
fc->user_id = d.user_id;
fc->group_id = d.group_id;
- fc->max_read = d.max_read;
+ fc->max_read = min_t(unsigned, 4096, d.max_read);
/* Used by get_root_inode() */
sb->s_fs_info = fc;
--
next prev parent reply other threads:[~2008-04-25 17:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-25 17:55 [patch 0/5] fuse updates Miklos Szeredi
2008-04-25 17:55 ` Miklos Szeredi [this message]
2008-04-25 17:55 ` [patch 2/5] fuse: fix node ID type Miklos Szeredi
2008-04-25 17:55 ` [patch 3/5] fuse: fix race in llseek Miklos Szeredi
2008-04-28 2:26 ` Andrew Morton
2008-04-28 7:51 ` Miklos Szeredi
2008-04-28 8:34 ` Jan Blunck
2008-04-28 15:12 ` Miklos Szeredi
2008-04-25 17:55 ` [patch 4/5] fuse: fix truncation on short read Miklos Szeredi
2008-04-25 17:55 ` [patch 5/5] fuse: fix sparse warnings Miklos Szeredi
2008-04-28 2:20 ` [patch 0/5] fuse updates Andrew Morton
2008-04-28 7:46 ` 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=20080425175653.953206207@szeredi.hu \
--to=miklos@szeredi.hu \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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