Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 19317
b: refs/heads/master
c: 9cd6845
h: refs/heads/master
i:
  19315: 6706fa8
v: v3
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed Feb 1, 2006
1 parent 2235137 commit 3d81fab
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: caf736085f2f0d22a992a855d9caae14973f7ea4
refs/heads/master: 9cd684551124e71630ab96d238747051463f5b56
9 changes: 7 additions & 2 deletions trunk/fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,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 {
Expand Down
3 changes: 3 additions & 0 deletions trunk/fs/fuse/fuse_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,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
Expand Down
14 changes: 12 additions & 2 deletions trunk/fs/fuse/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,16 @@ 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 {
unsigned long ra_pages;

if (arg->minor >= 6) {
ra_pages = arg->max_readahead / PAGE_CACHE_SIZE;
if (arg->flags & FUSE_ASYNC_READ)
fc->async_read = 1;
} else
ra_pages = fc->max_read / PAGE_CACHE_SIZE;

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;
}
Expand All @@ -496,6 +506,8 @@ static void fuse_send_init(struct fuse_conn *fc)

arg->major = FUSE_KERNEL_VERSION;
arg->minor = FUSE_KERNEL_MINOR_VERSION;
arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE;
arg->flags |= FUSE_ASYNC_READ;
req->in.h.opcode = FUSE_INIT;
req->in.numargs = 1;
req->in.args[0].size = sizeof(*arg);
Expand Down Expand Up @@ -552,8 +564,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;
if (fc->max_read / PAGE_CACHE_SIZE < fc->bdi.ra_pages)
fc->bdi.ra_pages = fc->max_read / PAGE_CACHE_SIZE;

/* Used by get_root_inode() */
sb->s_fs_info = fc;
Expand Down
16 changes: 14 additions & 2 deletions trunk/include/linux/fuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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
Expand Down Expand Up @@ -58,6 +58,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)
Expand All @@ -75,6 +78,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 */
Expand Down Expand Up @@ -247,12 +255,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;
};

Expand Down

0 comments on commit 3d81fab

Please sign in to comment.