diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2005-03-21 12:09:04 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2005-03-21 12:09:04 +0000 |
commit | 4283ee7760e3fd5146750fc6f039c7db1504e742 (patch) | |
tree | 352062213a2e7213c0084753b122214526672770 /kernel | |
parent | d17da46055903a517274b7823d41fdd866f48d8d (diff) | |
download | libfuse-4283ee7760e3fd5146750fc6f039c7db1504e742.tar.gz |
fix
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/dir.c | 6 | ||||
-rw-r--r-- | kernel/file.c | 17 | ||||
-rw-r--r-- | kernel/fuse_i.h | 9 | ||||
-rw-r--r-- | kernel/fuse_kernel.h | 3 |
4 files changed, 30 insertions, 5 deletions
diff --git a/kernel/dir.c b/kernel/dir.c index be51309..a7507fe 100644 --- a/kernel/dir.c +++ b/kernel/dir.c @@ -645,6 +645,11 @@ static int fuse_dir_release(struct inode *inode, struct file *file) return fuse_release_common(inode, file, 1); } +static int fuse_dir_fsync(struct file *file, struct dentry *de, int datasync) +{ + return fuse_fsync_common(file, de, datasync, 1); +} + static unsigned iattr_to_fattr(struct iattr *iattr, struct fuse_attr *fattr) { unsigned ivalid = iattr->ia_valid; @@ -1021,6 +1026,7 @@ static struct file_operations fuse_dir_operations = { .readdir = fuse_readdir, .open = fuse_dir_open, .release = fuse_dir_release, + .fsync = fuse_dir_fsync, }; static struct inode_operations fuse_common_inode_operations = { diff --git a/kernel/file.c b/kernel/file.c index 74921d6..0865ab0 100644 --- a/kernel/file.c +++ b/kernel/file.c @@ -151,7 +151,8 @@ static int fuse_flush(struct file *file) return err; } -static int fuse_fsync(struct file *file, struct dentry *de, int datasync) +int fuse_fsync_common(struct file *file, struct dentry *de, int datasync, + int isdir) { struct inode *inode = de->d_inode; struct fuse_conn *fc = get_fuse_conn(inode); @@ -160,7 +161,7 @@ static int fuse_fsync(struct file *file, struct dentry *de, int datasync) struct fuse_fsync_in inarg; int err; - if (fc->no_fsync) + if ((!isdir && fc->no_fsync) || (isdir && fc->no_fsyncdir)) return 0; req = fuse_get_request(fc); @@ -170,7 +171,7 @@ static int fuse_fsync(struct file *file, struct dentry *de, int datasync) memset(&inarg, 0, sizeof(inarg)); inarg.fh = ff->fh; inarg.fsync_flags = datasync ? 1 : 0; - req->in.h.opcode = FUSE_FSYNC; + req->in.h.opcode = isdir ? FUSE_FSYNCDIR : FUSE_FSYNC; req->in.h.nodeid = get_node_id(inode); req->inode = inode; req->file = file; @@ -181,12 +182,20 @@ static int fuse_fsync(struct file *file, struct dentry *de, int datasync) err = req->out.h.error; fuse_put_request(fc, req); if (err == -ENOSYS) { - fc->no_fsync = 1; + if (isdir) + fc->no_fsyncdir = 1; + else + fc->no_fsync = 1; err = 0; } return err; } +static int fuse_fsync(struct file *file, struct dentry *de, int datasync) +{ + return fuse_fsync_common(file, de, datasync, 0); +} + size_t fuse_send_read_common(struct fuse_req *req, struct file *file, struct inode *inode, loff_t pos, size_t count, int isdir) diff --git a/kernel/fuse_i.h b/kernel/fuse_i.h index d877071..fb94ebb 100644 --- a/kernel/fuse_i.h +++ b/kernel/fuse_i.h @@ -310,6 +310,9 @@ struct fuse_conn { /** Is fsync not implemented by fs? */ unsigned no_fsync : 1; + /** Is fsyncdir not implemented by fs? */ + unsigned no_fsyncdir : 1; + /** Is flush not implemented by fs? */ unsigned no_flush : 1; @@ -407,6 +410,12 @@ int fuse_open_common(struct inode *inode, struct file *file, int isdir); */ int fuse_release_common(struct inode *inode, struct file *file, int isdir); +/** + * Send FSYNC or FSYNCDIR request + */ +int fuse_fsync_common(struct file *file, struct dentry *de, int datasync, + int isdir); + /** * Initialise file operations on a regular file */ diff --git a/kernel/fuse_kernel.h b/kernel/fuse_kernel.h index 870ce59..2f313eb 100644 --- a/kernel/fuse_kernel.h +++ b/kernel/fuse_kernel.h @@ -87,7 +87,8 @@ enum fuse_opcode { FUSE_INIT = 26, FUSE_OPENDIR = 27, FUSE_READDIR = 28, - FUSE_RELEASEDIR = 29 + FUSE_RELEASEDIR = 29, + FUSE_FSYNCDIR = 30 }; /* Conservative buffer size for the client */ |