diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2005-09-09 16:10:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 17:03:46 -0400 |
commit | 413ef8cb302511d8e995e2b0e5517ee1a65b9c77 (patch) | |
tree | 59acb15a73fa0dc4393a086fb83f016105d84b2a /fs/fuse/inode.c | |
parent | 5a53368277efa2d80dd2206dddc1f4b19ef0c32a (diff) |
[PATCH] FUSE - direct I/O
This patch adds support for the "direct_io" mount option of FUSE.
When this mount option is specified, the page cache is bypassed for
read and write operations. This is useful for example, if the
filesystem doesn't know the size of files before reading them, or when
any kind of caching is harmful.
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 | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 298c1d4c1534..652c9d5df973 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -258,6 +258,7 @@ enum { | |||
258 | OPT_DEFAULT_PERMISSIONS, | 258 | OPT_DEFAULT_PERMISSIONS, |
259 | OPT_ALLOW_OTHER, | 259 | OPT_ALLOW_OTHER, |
260 | OPT_KERNEL_CACHE, | 260 | OPT_KERNEL_CACHE, |
261 | OPT_DIRECT_IO, | ||
261 | OPT_MAX_READ, | 262 | OPT_MAX_READ, |
262 | OPT_ERR | 263 | OPT_ERR |
263 | }; | 264 | }; |
@@ -270,6 +271,7 @@ static match_table_t tokens = { | |||
270 | {OPT_DEFAULT_PERMISSIONS, "default_permissions"}, | 271 | {OPT_DEFAULT_PERMISSIONS, "default_permissions"}, |
271 | {OPT_ALLOW_OTHER, "allow_other"}, | 272 | {OPT_ALLOW_OTHER, "allow_other"}, |
272 | {OPT_KERNEL_CACHE, "kernel_cache"}, | 273 | {OPT_KERNEL_CACHE, "kernel_cache"}, |
274 | {OPT_DIRECT_IO, "direct_io"}, | ||
273 | {OPT_MAX_READ, "max_read=%u"}, | 275 | {OPT_MAX_READ, "max_read=%u"}, |
274 | {OPT_ERR, NULL} | 276 | {OPT_ERR, NULL} |
275 | }; | 277 | }; |
@@ -329,6 +331,10 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d) | |||
329 | d->flags |= FUSE_KERNEL_CACHE; | 331 | d->flags |= FUSE_KERNEL_CACHE; |
330 | break; | 332 | break; |
331 | 333 | ||
334 | case OPT_DIRECT_IO: | ||
335 | d->flags |= FUSE_DIRECT_IO; | ||
336 | break; | ||
337 | |||
332 | case OPT_MAX_READ: | 338 | case OPT_MAX_READ: |
333 | if (match_int(&args[0], &value)) | 339 | if (match_int(&args[0], &value)) |
334 | return 0; | 340 | return 0; |
@@ -359,6 +365,8 @@ static int fuse_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
359 | seq_puts(m, ",allow_other"); | 365 | seq_puts(m, ",allow_other"); |
360 | if (fc->flags & FUSE_KERNEL_CACHE) | 366 | if (fc->flags & FUSE_KERNEL_CACHE) |
361 | seq_puts(m, ",kernel_cache"); | 367 | seq_puts(m, ",kernel_cache"); |
368 | if (fc->flags & FUSE_DIRECT_IO) | ||
369 | seq_puts(m, ",direct_io"); | ||
362 | if (fc->max_read != ~0) | 370 | if (fc->max_read != ~0) |
363 | seq_printf(m, ",max_read=%u", fc->max_read); | 371 | seq_printf(m, ",max_read=%u", fc->max_read); |
364 | return 0; | 372 | return 0; |
@@ -489,6 +497,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
489 | fc->max_read = d.max_read; | 497 | fc->max_read = d.max_read; |
490 | if (fc->max_read / PAGE_CACHE_SIZE < fc->bdi.ra_pages) | 498 | if (fc->max_read / PAGE_CACHE_SIZE < fc->bdi.ra_pages) |
491 | fc->bdi.ra_pages = fc->max_read / PAGE_CACHE_SIZE; | 499 | fc->bdi.ra_pages = fc->max_read / PAGE_CACHE_SIZE; |
500 | fc->max_write = FUSE_MAX_IN / 2; | ||
492 | 501 | ||
493 | err = -ENOMEM; | 502 | err = -ENOMEM; |
494 | root = get_root_inode(sb, d.rootmode); | 503 | root = get_root_inode(sb, d.rootmode); |