aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-06-22 04:39:14 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-14 08:33:35 -0400
commitd95852777bc8ba6b3ad3397d495c5f9dd8ca8383 (patch)
tree96e9d8b1d33c4f6f7b5ba5be0fa4fd8f77c7a67f /fs/ceph
parent3d8a00d2099ebc6d5a6e95fadaf861709d9919a8 (diff)
make ->atomic_open() return int
Change of calling conventions: old new NULL 1 file 0 ERR_PTR(-ve) -ve Caller *knows* that struct file *; no need to return it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/dir.c19
-rw-r--r--fs/ceph/file.c12
-rw-r--r--fs/ceph/super.h6
3 files changed, 18 insertions, 19 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 81e5e908df9d..d8bfabeeaa25 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -634,21 +634,20 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
634 return dentry; 634 return dentry;
635} 635}
636 636
637struct file *ceph_atomic_open(struct inode *dir, struct dentry *dentry, 637int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
638 struct opendata *od, unsigned flags, umode_t mode, 638 struct opendata *od, unsigned flags, umode_t mode,
639 int *opened) 639 int *opened)
640{ 640{
641 int err; 641 int err;
642 struct dentry *res = NULL; 642 struct dentry *res = NULL;
643 struct file *filp;
644 643
645 if (!(flags & O_CREAT)) { 644 if (!(flags & O_CREAT)) {
646 if (dentry->d_name.len > NAME_MAX) 645 if (dentry->d_name.len > NAME_MAX)
647 return ERR_PTR(-ENAMETOOLONG); 646 return -ENAMETOOLONG;
648 647
649 err = ceph_init_dentry(dentry); 648 err = ceph_init_dentry(dentry);
650 if (err < 0) 649 if (err < 0)
651 return ERR_PTR(err); 650 return err;
652 651
653 return ceph_lookup_open(dir, dentry, od, flags, mode, opened); 652 return ceph_lookup_open(dir, dentry, od, flags, mode, opened);
654 } 653 }
@@ -656,7 +655,7 @@ struct file *ceph_atomic_open(struct inode *dir, struct dentry *dentry,
656 if (d_unhashed(dentry)) { 655 if (d_unhashed(dentry)) {
657 res = ceph_lookup(dir, dentry, NULL); 656 res = ceph_lookup(dir, dentry, NULL);
658 if (IS_ERR(res)) 657 if (IS_ERR(res))
659 return ERR_CAST(res); 658 return PTR_ERR(res);
660 659
661 if (res) 660 if (res)
662 dentry = res; 661 dentry = res;
@@ -665,14 +664,14 @@ struct file *ceph_atomic_open(struct inode *dir, struct dentry *dentry,
665 /* We don't deal with positive dentries here */ 664 /* We don't deal with positive dentries here */
666 if (dentry->d_inode) { 665 if (dentry->d_inode) {
667 finish_no_open(od, res); 666 finish_no_open(od, res);
668 return NULL; 667 return 1;
669 } 668 }
670 669
671 *opened |= FILE_CREATED; 670 *opened |= FILE_CREATED;
672 filp = ceph_lookup_open(dir, dentry, od, flags, mode, opened); 671 err = ceph_lookup_open(dir, dentry, od, flags, mode, opened);
673 dput(res); 672 dput(res);
674 673
675 return filp; 674 return err;
676} 675}
677 676
678/* 677/*
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 4c304a90d046..b8cc3ee5401e 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -213,9 +213,9 @@ out:
213 * may_open() fails, the struct *file gets cleaned up (i.e. 213 * may_open() fails, the struct *file gets cleaned up (i.e.
214 * ceph_release gets called). So fear not! 214 * ceph_release gets called). So fear not!
215 */ 215 */
216struct file *ceph_lookup_open(struct inode *dir, struct dentry *dentry, 216int ceph_lookup_open(struct inode *dir, struct dentry *dentry,
217 struct opendata *od, unsigned flags, umode_t mode, 217 struct opendata *od, unsigned flags, umode_t mode,
218 int *opened) 218 int *opened)
219{ 219{
220 struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); 220 struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
221 struct ceph_mds_client *mdsc = fsc->mdsc; 221 struct ceph_mds_client *mdsc = fsc->mdsc;
@@ -230,7 +230,7 @@ struct file *ceph_lookup_open(struct inode *dir, struct dentry *dentry,
230 /* do the open */ 230 /* do the open */
231 req = prepare_open_request(dir->i_sb, flags, mode); 231 req = prepare_open_request(dir->i_sb, flags, mode);
232 if (IS_ERR(req)) 232 if (IS_ERR(req))
233 return ERR_CAST(req); 233 return PTR_ERR(req);
234 req->r_dentry = dget(dentry); 234 req->r_dentry = dget(dentry);
235 req->r_num_caps = 2; 235 req->r_num_caps = 2;
236 if (flags & O_CREAT) { 236 if (flags & O_CREAT) {
@@ -257,10 +257,10 @@ out:
257 dout("ceph_lookup_open result=%p\n", ret); 257 dout("ceph_lookup_open result=%p\n", ret);
258 258
259 if (IS_ERR(ret)) 259 if (IS_ERR(ret))
260 return ERR_CAST(ret); 260 return PTR_ERR(ret);
261 261
262 dput(ret); 262 dput(ret);
263 return err ? ERR_PTR(err) : file; 263 return err;
264} 264}
265 265
266int ceph_release(struct inode *inode, struct file *file) 266int ceph_release(struct inode *inode, struct file *file)
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index f9a325108b49..f7e8e82ec47f 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -806,9 +806,9 @@ extern int ceph_copy_from_page_vector(struct page **pages,
806 loff_t off, size_t len); 806 loff_t off, size_t len);
807extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags); 807extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags);
808extern int ceph_open(struct inode *inode, struct file *file); 808extern int ceph_open(struct inode *inode, struct file *file);
809extern struct file *ceph_lookup_open(struct inode *dir, struct dentry *dentry, 809extern int ceph_lookup_open(struct inode *dir, struct dentry *dentry,
810 struct opendata *od, unsigned flags, 810 struct opendata *od, unsigned flags,
811 umode_t mode, int *opened); 811 umode_t mode, int *opened);
812extern int ceph_release(struct inode *inode, struct file *filp); 812extern int ceph_release(struct inode *inode, struct file *filp);
813 813
814/* dir.c */ 814/* dir.c */