aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/dir.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2009-04-28 10:56:39 -0400
committerMiklos Szeredi <mszeredi@suse.cz>2009-04-28 10:56:39 -0400
commit8b0797a4984de4406de25808e1a424344de543e4 (patch)
tree9d473ecf26171ccfdcee4e0a617e9bc994813397 /fs/fuse/dir.c
parent91fe96b403f8a0a4a8a045a39b1bd549b0da7941 (diff)
fuse: don't use inode in fuse_sync_release()
Make fuse_sync_release() a generic helper function that doesn't need a struct inode pointer. This makes it suitable for use by CUSE. Change return value of fuse_release_common() from int to void. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/fuse/dir.c')
-rw-r--r--fs/fuse/dir.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index faa3b2f86740..b3089a083d30 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -362,19 +362,6 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
362} 362}
363 363
364/* 364/*
365 * Synchronous release for the case when something goes wrong in CREATE_OPEN
366 */
367static void fuse_sync_release(struct fuse_conn *fc, struct fuse_file *ff,
368 int flags)
369{
370 fuse_release_fill(ff, flags, FUSE_RELEASE);
371 ff->reserved_req->force = 1;
372 fuse_request_send(fc, ff->reserved_req);
373 fuse_put_request(fc, ff->reserved_req);
374 kfree(ff);
375}
376
377/*
378 * Atomic create+open operation 365 * Atomic create+open operation
379 * 366 *
380 * If the filesystem doesn't support this, then fall back to separate 367 * If the filesystem doesn't support this, then fall back to separate
@@ -452,7 +439,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
452 &outentry.attr, entry_attr_timeout(&outentry), 0); 439 &outentry.attr, entry_attr_timeout(&outentry), 0);
453 if (!inode) { 440 if (!inode) {
454 flags &= ~(O_CREAT | O_EXCL | O_TRUNC); 441 flags &= ~(O_CREAT | O_EXCL | O_TRUNC);
455 fuse_sync_release(fc, ff, flags); 442 fuse_sync_release(ff, flags);
456 fuse_send_forget(fc, forget_req, outentry.nodeid, 1); 443 fuse_send_forget(fc, forget_req, outentry.nodeid, 1);
457 return -ENOMEM; 444 return -ENOMEM;
458 } 445 }
@@ -462,7 +449,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
462 fuse_invalidate_attr(dir); 449 fuse_invalidate_attr(dir);
463 file = lookup_instantiate_filp(nd, entry, generic_file_open); 450 file = lookup_instantiate_filp(nd, entry, generic_file_open);
464 if (IS_ERR(file)) { 451 if (IS_ERR(file)) {
465 fuse_sync_release(fc, ff, flags); 452 fuse_sync_release(ff, flags);
466 return PTR_ERR(file); 453 return PTR_ERR(file);
467 } 454 }
468 file->private_data = fuse_file_get(ff); 455 file->private_data = fuse_file_get(ff);
@@ -1108,7 +1095,9 @@ static int fuse_dir_open(struct inode *inode, struct file *file)
1108 1095
1109static int fuse_dir_release(struct inode *inode, struct file *file) 1096static int fuse_dir_release(struct inode *inode, struct file *file)
1110{ 1097{
1111 return fuse_release_common(inode, file, 1); 1098 fuse_release_common(file, FUSE_RELEASEDIR);
1099
1100 return 0;
1112} 1101}
1113 1102
1114static int fuse_dir_fsync(struct file *file, struct dentry *de, int datasync) 1103static int fuse_dir_fsync(struct file *file, struct dentry *de, int datasync)