diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2005-09-09 16:10:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 17:03:47 -0400 |
commit | 8254798199332966e2ab647380c990193af7e854 (patch) | |
tree | ad4a9721a872fbdec0be107f35684864a1a94053 /fs/fuse/file.c | |
parent | b36c31ba95f0fe0a03c727300d9c4c54438a5636 (diff) |
[PATCH] FUSE: add fsync operation for directories
This patch adds a new FSYNCDIR request, which is sent when fsync is called
on directories. This operation is available in libfuse 2.3-pre1 or
greater.
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/file.c')
-rw-r--r-- | fs/fuse/file.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 6dcae74ce7fa..e225f8c0b267 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -156,7 +156,8 @@ static int fuse_flush(struct file *file) | |||
156 | return err; | 156 | return err; |
157 | } | 157 | } |
158 | 158 | ||
159 | static int fuse_fsync(struct file *file, struct dentry *de, int datasync) | 159 | int fuse_fsync_common(struct file *file, struct dentry *de, int datasync, |
160 | int isdir) | ||
160 | { | 161 | { |
161 | struct inode *inode = de->d_inode; | 162 | struct inode *inode = de->d_inode; |
162 | struct fuse_conn *fc = get_fuse_conn(inode); | 163 | struct fuse_conn *fc = get_fuse_conn(inode); |
@@ -165,7 +166,7 @@ static int fuse_fsync(struct file *file, struct dentry *de, int datasync) | |||
165 | struct fuse_fsync_in inarg; | 166 | struct fuse_fsync_in inarg; |
166 | int err; | 167 | int err; |
167 | 168 | ||
168 | if (fc->no_fsync) | 169 | if ((!isdir && fc->no_fsync) || (isdir && fc->no_fsyncdir)) |
169 | return 0; | 170 | return 0; |
170 | 171 | ||
171 | req = fuse_get_request(fc); | 172 | req = fuse_get_request(fc); |
@@ -175,7 +176,7 @@ static int fuse_fsync(struct file *file, struct dentry *de, int datasync) | |||
175 | memset(&inarg, 0, sizeof(inarg)); | 176 | memset(&inarg, 0, sizeof(inarg)); |
176 | inarg.fh = ff->fh; | 177 | inarg.fh = ff->fh; |
177 | inarg.fsync_flags = datasync ? 1 : 0; | 178 | inarg.fsync_flags = datasync ? 1 : 0; |
178 | req->in.h.opcode = FUSE_FSYNC; | 179 | req->in.h.opcode = isdir ? FUSE_FSYNCDIR : FUSE_FSYNC; |
179 | req->in.h.nodeid = get_node_id(inode); | 180 | req->in.h.nodeid = get_node_id(inode); |
180 | req->inode = inode; | 181 | req->inode = inode; |
181 | req->file = file; | 182 | req->file = file; |
@@ -186,12 +187,20 @@ static int fuse_fsync(struct file *file, struct dentry *de, int datasync) | |||
186 | err = req->out.h.error; | 187 | err = req->out.h.error; |
187 | fuse_put_request(fc, req); | 188 | fuse_put_request(fc, req); |
188 | if (err == -ENOSYS) { | 189 | if (err == -ENOSYS) { |
189 | fc->no_fsync = 1; | 190 | if (isdir) |
191 | fc->no_fsyncdir = 1; | ||
192 | else | ||
193 | fc->no_fsync = 1; | ||
190 | err = 0; | 194 | err = 0; |
191 | } | 195 | } |
192 | return err; | 196 | return err; |
193 | } | 197 | } |
194 | 198 | ||
199 | static int fuse_fsync(struct file *file, struct dentry *de, int datasync) | ||
200 | { | ||
201 | return fuse_fsync_common(file, de, datasync, 0); | ||
202 | } | ||
203 | |||
195 | size_t fuse_send_read_common(struct fuse_req *req, struct file *file, | 204 | size_t fuse_send_read_common(struct fuse_req *req, struct file *file, |
196 | struct inode *inode, loff_t pos, size_t count, | 205 | struct inode *inode, loff_t pos, size_t count, |
197 | int isdir) | 206 | int isdir) |