diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2006-01-20 15:15:21 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2006-01-20 15:15:21 +0000 |
commit | 065f222cd58501acbe6dde5520c1c2498e8d3c08 (patch) | |
tree | 6fee89465e3fc21e91591e53ea1c0678ef965367 /kernel | |
parent | e089b718969bc0aaecf180c675b9c2b6d1b8ba9c (diff) | |
download | libfuse-065f222cd58501acbe6dde5520c1c2498e8d3c08.tar.gz |
fix
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/configure.ac | 2 | ||||
-rw-r--r-- | kernel/file.c | 9 | ||||
-rw-r--r-- | kernel/fuse_i.h | 3 | ||||
-rw-r--r-- | kernel/fuse_kernel.h | 16 | ||||
-rw-r--r-- | kernel/inode.c | 21 |
5 files changed, 42 insertions, 9 deletions
diff --git a/kernel/configure.ac b/kernel/configure.ac index 0ef06f8..cdb2669 100644 --- a/kernel/configure.ac +++ b/kernel/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(fuse-kernel, 2.5.0) +AC_INIT(fuse-kernel, 2.7.0-pre0) AC_CONFIG_HEADERS([config.h]) AC_PROG_INSTALL diff --git a/kernel/file.c b/kernel/file.c index e8dae79..be9cc39 100644 --- a/kernel/file.c +++ b/kernel/file.c @@ -350,9 +350,14 @@ static void fuse_send_readpages(struct fuse_req *req, struct file *file, loff_t pos = page_offset(req->pages[0]); size_t count = req->num_pages << PAGE_CACHE_SHIFT; req->out.page_zeroing = 1; - req->end = fuse_readpages_end; fuse_read_fill(req, file, inode, pos, count, FUSE_READ); - request_send_background(fc, req); + if (fc->async_read) { + req->end = fuse_readpages_end; + request_send_background(fc, req); + } else { + request_send(fc, req); + fuse_readpages_end(fc, req); + } } struct fuse_readpages_data { diff --git a/kernel/fuse_i.h b/kernel/fuse_i.h index 4979fac..b37b6aa 100644 --- a/kernel/fuse_i.h +++ b/kernel/fuse_i.h @@ -369,6 +369,9 @@ struct fuse_conn { reply, before any other request, and never cleared */ unsigned conn_error : 1; + /** Do readpages asynchronously? Only set in INIT */ + unsigned async_read : 1; + /* * The following bitfields are only for optimization purposes * and hence races in setting them will not cause malfunction diff --git a/kernel/fuse_kernel.h b/kernel/fuse_kernel.h index 191b97d..54b1933 100644 --- a/kernel/fuse_kernel.h +++ b/kernel/fuse_kernel.h @@ -49,7 +49,7 @@ #define FUSE_KERNEL_VERSION 7 /** Minor version number of this interface */ -#define FUSE_KERNEL_MINOR_VERSION 5 +#define FUSE_KERNEL_MINOR_VERSION 6 /** The node ID of the root inode */ #define FUSE_ROOT_ID 1 @@ -93,6 +93,9 @@ struct fuse_kstatfs { __u32 spare[6]; }; +/** + * Bitmasks for fuse_setattr_in.valid + */ #define FATTR_MODE (1 << 0) #define FATTR_UID (1 << 1) #define FATTR_GID (1 << 2) @@ -110,6 +113,11 @@ struct fuse_kstatfs { #define FOPEN_DIRECT_IO (1 << 0) #define FOPEN_KEEP_CACHE (1 << 1) +/** + * INIT request/reply flags + */ +#define FUSE_ASYNC_READ (1 << 0) + enum fuse_opcode { FUSE_LOOKUP = 1, FUSE_FORGET = 2, /* no reply */ @@ -282,12 +290,16 @@ struct fuse_access_in { struct fuse_init_in { __u32 major; __u32 minor; + __u32 max_readahead; + __u32 flags; }; struct fuse_init_out { __u32 major; __u32 minor; - __u32 unused[3]; + __u32 max_readahead; + __u32 flags; + __u32 unused; __u32 max_write; }; diff --git a/kernel/inode.c b/kernel/inode.c index f10990f..00a13cc 100644 --- a/kernel/inode.c +++ b/kernel/inode.c @@ -646,6 +646,19 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req) if (req->out.h.error || arg->major != FUSE_KERNEL_VERSION) fc->conn_error = 1; else { +#ifdef KERNEL_2_6 + unsigned long ra_pages; + + if (arg->minor >= 6) { + ra_pages = arg->max_readahead / PAGE_CACHE_SIZE; + fc->async_read = arg->flags & FUSE_ASYNC_READ; + } else { + ra_pages = fc->max_read / PAGE_CACHE_SIZE; + fc->async_read = 0; + } + + fc->bdi.ra_pages = min(fc->bdi.ra_pages, ra_pages); +#endif fc->minor = arg->minor; fc->max_write = arg->minor < 5 ? 4096 : arg->max_write; } @@ -669,6 +682,10 @@ static void fuse_send_init(struct fuse_conn *fc) arg->major = FUSE_KERNEL_VERSION; arg->minor = FUSE_KERNEL_MINOR_VERSION; +#ifdef KERNEL_2_6 + arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE; + arg->flags |= FUSE_ASYNC_READ; +#endif req->in.h.opcode = FUSE_INIT; req->in.numargs = 1; req->in.args[0].size = sizeof(*arg); @@ -732,10 +749,6 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) fc->user_id = d.user_id; fc->group_id = d.group_id; fc->max_read = d.max_read; -#ifdef KERNEL_2_6 - if (fc->max_read / PAGE_CACHE_SIZE < fc->bdi.ra_pages) - fc->bdi.ra_pages = fc->max_read / PAGE_CACHE_SIZE; -#endif /* Used by get_root_inode() */ sb->s_fs_info = fc; |