diff -rupN fuse-2.7.2/kernel/dir.c fuse-2.7.2-glfs7/kernel/dir.c --- fuse-2.7.2/kernel/dir.c 2007-12-12 21:00:11.000000000 +0200 +++ fuse-2.7.2-glfs7/kernel/dir.c 2007-12-26 01:08:13.000000000 +0200 @@ -380,6 +380,10 @@ static int fuse_create_open(struct inode d_instantiate(entry, inode); fuse_invalidate_attr(dir); fuse_change_timeout(entry, &outentry); + if (flags & O_DIRECT) { + outopen.open_flags |= FOPEN_DIRECT_IO; + nd->intent.open.flags &= ~O_DIRECT; + } file = lookup_instantiate_filp(nd, entry, generic_file_open); if (IS_ERR(file)) { ff->fh = outopen.fh; @@ -1135,11 +1139,12 @@ static int fuse_getattr(struct vfsmount { struct inode *inode = entry->d_inode; int err = fuse_revalidate(entry); - if (!err) + if (!err) { /* FIXME: may want specialized function because of st_blksize on block devices on 2.6.19+ */ generic_fillattr(inode, stat); - + stat->blksize = 1048576; + } return err; } diff -rupN fuse-2.7.2/kernel/file.c fuse-2.7.2-glfs7/kernel/file.c --- fuse-2.7.2/kernel/file.c 2007-10-16 19:35:22.000000000 +0300 +++ fuse-2.7.2-glfs7/kernel/file.c 2007-12-26 01:14:04.000000000 +0200 @@ -91,10 +91,6 @@ int fuse_open_common(struct inode *inode struct fuse_file *ff; int err; - /* VFS checks this, but only _after_ ->open() */ - if (file->f_flags & O_DIRECT) - return -EINVAL; - err = generic_file_open(inode, file); if (err) return err; @@ -115,6 +111,19 @@ int fuse_open_common(struct inode *inode if (err) fuse_file_free(ff); else { + if (file->f_flags & O_DIRECT) { + /* set fuse_direct_io_file_operations as fops + in fuse_finish_open as though the FS + enforced direct_io + */ + outarg.open_flags |= FOPEN_DIRECT_IO; + /* make VFS think this is a regular open + to make it not check for aops->direct_IO. + the same effect is acheived by setting fops + to fuse_direct_io_file_operations + */ + file->f_flags &= ~O_DIRECT; + } if (isdir) outarg.open_flags &= ~FOPEN_DIRECT_IO; fuse_finish_open(inode, file, ff, &outarg); @@ -578,6 +587,8 @@ static ssize_t fuse_direct_io(struct fil } nbytes = (req->num_pages << PAGE_SHIFT) - req->page_offset; nbytes = min(count, nbytes); + nbytes = min(nmax, nbytes); + if (write) nres = fuse_send_write(req, file, inode, pos, nbytes); else @@ -865,6 +876,7 @@ static struct file_operations fuse_file_ .release = fuse_release, .fsync = fuse_fsync, .lock = fuse_file_lock, + .flock = fuse_file_lock, #ifdef KERNEL_2_6_23_PLUS .splice_read = generic_file_splice_read, #else @@ -881,6 +893,7 @@ static struct file_operations fuse_direc .release = fuse_release, .fsync = fuse_fsync, .lock = fuse_file_lock, + .flock = fuse_file_lock, /* no mmap and sendfile */ }; diff -rupN fuse-2.7.2/kernel/fuse_i.h fuse-2.7.2-glfs7/kernel/fuse_i.h --- fuse-2.7.2/kernel/fuse_i.h 2007-12-12 21:00:11.000000000 +0200 +++ fuse-2.7.2-glfs7/kernel/fuse_i.h 2007-12-26 01:00:07.000000000 +0200 @@ -102,7 +102,7 @@ #endif /** Max number of pages that can be used in a single read request */ -#define FUSE_MAX_PAGES_PER_REQ 32 +#define FUSE_MAX_PAGES_PER_REQ 257 /** Maximum number of outstanding background requests */ #define FUSE_MAX_BACKGROUND 10 diff -rupN fuse-2.7.2/kernel/inode.c fuse-2.7.2-glfs7/kernel/inode.c --- fuse-2.7.2/kernel/inode.c 2007-12-12 21:01:04.000000000 +0200 +++ fuse-2.7.2-glfs7/kernel/inode.c 2007-12-26 01:17:03.000000000 +0200 @@ -140,7 +140,7 @@ void fuse_change_attributes(struct inode i_size_write(inode, attr->size); spin_unlock(&fc->lock); #ifdef HAVE_I_BLKSIZE - inode->i_blksize = PAGE_CACHE_SIZE; + inode->i_blksize = 1048576; #endif inode->i_blocks = attr->blocks; inode->i_atime.tv_sec = attr->atime; @@ -350,7 +350,7 @@ static int parse_fuse_opt(char *opt, str char *p; memset(d, 0, sizeof(struct fuse_mount_data)); d->max_read = ~0; - d->blksize = 512; + d->blksize = 1048576; /* * For unprivileged mounts use current uid/gid. Still allow @@ -481,7 +481,7 @@ static struct fuse_conn *new_conn(void) INIT_LIST_HEAD(&fc->io); INIT_LIST_HEAD(&fc->interrupts); atomic_set(&fc->num_waiting, 0); - fc->bdi.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; + fc->bdi.ra_pages = 256; fc->bdi.unplug_io_fn = default_unplug_io_fn; fc->reqctr = 0; fc->blocked = 1; @@ -776,8 +776,8 @@ static int fuse_fill_super(struct super_ return -EINVAL; #endif } else { - sb->s_blocksize = PAGE_CACHE_SIZE; - sb->s_blocksize_bits = PAGE_CACHE_SHIFT; + sb->s_blocksize = 1048576; + sb->s_blocksize_bits = 20; } sb->s_magic = FUSE_SUPER_MAGIC; sb->s_op = &fuse_super_operations; diff -rupN fuse-2.7.2/lib/fuse_kern_chan.c fuse-2.7.2-glfs7/lib/fuse_kern_chan.c --- fuse-2.7.2/lib/fuse_kern_chan.c 2007-12-12 16:33:35.000000000 +0200 +++ fuse-2.7.2-glfs7/lib/fuse_kern_chan.c 2007-12-26 01:18:16.000000000 +0200 @@ -80,7 +80,7 @@ static void fuse_kern_chan_destroy(struc close(fuse_chan_fd(ch)); } -#define MIN_BUFSIZE 0x21000 +#define MIN_BUFSIZE (1048576 + 0x1000) struct fuse_chan *fuse_kern_chan_new(int fd) {