diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2005-09-09 16:10:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 17:03:46 -0400 |
commit | db50b96c0f28a21c5a4a19ecaba12d0972aab06a (patch) | |
tree | d7f2cb99de499c116ce08153a369044af0622c16 /fs/fuse/inode.c | |
parent | 06663267b4b1e85ece73236ea720355668d4f736 (diff) |
[PATCH] FUSE - readpages operation
This patch adds readpages support to FUSE.
With the help of the readpages() operation multiple reads are bundled
together and sent as a single request to userspace. This can improve
reading performace.
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/fuse/inode.c')
-rw-r--r-- | fs/fuse/inode.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 458c62ca0fec..0b75c73386e9 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -32,6 +32,7 @@ struct fuse_mount_data { | |||
32 | unsigned rootmode; | 32 | unsigned rootmode; |
33 | unsigned user_id; | 33 | unsigned user_id; |
34 | unsigned flags; | 34 | unsigned flags; |
35 | unsigned max_read; | ||
35 | }; | 36 | }; |
36 | 37 | ||
37 | static struct inode *fuse_alloc_inode(struct super_block *sb) | 38 | static struct inode *fuse_alloc_inode(struct super_block *sb) |
@@ -250,6 +251,7 @@ enum { | |||
250 | OPT_DEFAULT_PERMISSIONS, | 251 | OPT_DEFAULT_PERMISSIONS, |
251 | OPT_ALLOW_OTHER, | 252 | OPT_ALLOW_OTHER, |
252 | OPT_KERNEL_CACHE, | 253 | OPT_KERNEL_CACHE, |
254 | OPT_MAX_READ, | ||
253 | OPT_ERR | 255 | OPT_ERR |
254 | }; | 256 | }; |
255 | 257 | ||
@@ -260,6 +262,7 @@ static match_table_t tokens = { | |||
260 | {OPT_DEFAULT_PERMISSIONS, "default_permissions"}, | 262 | {OPT_DEFAULT_PERMISSIONS, "default_permissions"}, |
261 | {OPT_ALLOW_OTHER, "allow_other"}, | 263 | {OPT_ALLOW_OTHER, "allow_other"}, |
262 | {OPT_KERNEL_CACHE, "kernel_cache"}, | 264 | {OPT_KERNEL_CACHE, "kernel_cache"}, |
265 | {OPT_MAX_READ, "max_read=%u"}, | ||
263 | {OPT_ERR, NULL} | 266 | {OPT_ERR, NULL} |
264 | }; | 267 | }; |
265 | 268 | ||
@@ -268,6 +271,7 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d) | |||
268 | char *p; | 271 | char *p; |
269 | memset(d, 0, sizeof(struct fuse_mount_data)); | 272 | memset(d, 0, sizeof(struct fuse_mount_data)); |
270 | d->fd = -1; | 273 | d->fd = -1; |
274 | d->max_read = ~0; | ||
271 | 275 | ||
272 | while ((p = strsep(&opt, ",")) != NULL) { | 276 | while ((p = strsep(&opt, ",")) != NULL) { |
273 | int token; | 277 | int token; |
@@ -308,6 +312,12 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d) | |||
308 | d->flags |= FUSE_KERNEL_CACHE; | 312 | d->flags |= FUSE_KERNEL_CACHE; |
309 | break; | 313 | break; |
310 | 314 | ||
315 | case OPT_MAX_READ: | ||
316 | if (match_int(&args[0], &value)) | ||
317 | return 0; | ||
318 | d->max_read = value; | ||
319 | break; | ||
320 | |||
311 | default: | 321 | default: |
312 | return 0; | 322 | return 0; |
313 | } | 323 | } |
@@ -329,6 +339,8 @@ static int fuse_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
329 | seq_puts(m, ",allow_other"); | 339 | seq_puts(m, ",allow_other"); |
330 | if (fc->flags & FUSE_KERNEL_CACHE) | 340 | if (fc->flags & FUSE_KERNEL_CACHE) |
331 | seq_puts(m, ",kernel_cache"); | 341 | seq_puts(m, ",kernel_cache"); |
342 | if (fc->max_read != ~0) | ||
343 | seq_printf(m, ",max_read=%u", fc->max_read); | ||
332 | return 0; | 344 | return 0; |
333 | } | 345 | } |
334 | 346 | ||
@@ -453,6 +465,9 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
453 | 465 | ||
454 | fc->flags = d.flags; | 466 | fc->flags = d.flags; |
455 | fc->user_id = d.user_id; | 467 | fc->user_id = d.user_id; |
468 | fc->max_read = d.max_read; | ||
469 | if (fc->max_read / PAGE_CACHE_SIZE < fc->bdi.ra_pages) | ||
470 | fc->bdi.ra_pages = fc->max_read / PAGE_CACHE_SIZE; | ||
456 | 471 | ||
457 | err = -ENOMEM; | 472 | err = -ENOMEM; |
458 | root = get_root_inode(sb, d.rootmode); | 473 | root = get_root_inode(sb, d.rootmode); |