diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-10 11:11:49 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-10 11:13:16 -0500 |
commit | f4947fbce208990266920d51837e4e7ba9779db1 (patch) | |
tree | a541edc5de897ce03f54d83c1a1c8147ce22b605 /fs/coda/dir.c | |
parent | 0b2c4e39c014219ef73f05ab580c284bf8e6af0a (diff) |
coda: switch coda_cnode_make() to sane API as well, clean coda_lookup()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/coda/dir.c')
-rw-r--r-- | fs/coda/dir.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index df0f9c1b01d3..177515829062 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
@@ -96,12 +96,11 @@ const struct file_operations coda_dir_operations = { | |||
96 | /* access routines: lookup, readlink, permission */ | 96 | /* access routines: lookup, readlink, permission */ |
97 | static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struct nameidata *nd) | 97 | static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struct nameidata *nd) |
98 | { | 98 | { |
99 | struct inode *inode = NULL; | 99 | struct super_block *sb = dir->i_sb; |
100 | struct CodaFid resfid = { { 0, } }; | ||
101 | int type = 0; | ||
102 | int error = 0; | ||
103 | const char *name = entry->d_name.name; | 100 | const char *name = entry->d_name.name; |
104 | size_t length = entry->d_name.len; | 101 | size_t length = entry->d_name.len; |
102 | struct inode *inode; | ||
103 | int type = 0; | ||
105 | 104 | ||
106 | if (length > CODA_MAXNAMLEN) { | 105 | if (length > CODA_MAXNAMLEN) { |
107 | printk(KERN_ERR "name too long: lookup, %s (%*s)\n", | 106 | printk(KERN_ERR "name too long: lookup, %s (%*s)\n", |
@@ -111,23 +110,21 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struc | |||
111 | 110 | ||
112 | /* control object, create inode on the fly */ | 111 | /* control object, create inode on the fly */ |
113 | if (coda_isroot(dir) && coda_iscontrol(name, length)) { | 112 | if (coda_isroot(dir) && coda_iscontrol(name, length)) { |
114 | inode = coda_cnode_makectl(dir->i_sb); | 113 | inode = coda_cnode_makectl(sb); |
115 | type = CODA_NOCACHE; | 114 | type = CODA_NOCACHE; |
116 | goto exit; | 115 | } else { |
116 | struct CodaFid fid = { { 0, } }; | ||
117 | int error = venus_lookup(sb, coda_i2f(dir), name, length, | ||
118 | &type, &fid); | ||
119 | inode = !error ? coda_cnode_make(&fid, sb) : ERR_PTR(error); | ||
117 | } | 120 | } |
118 | 121 | ||
119 | error = venus_lookup(dir->i_sb, coda_i2f(dir), name, length, | 122 | if (!IS_ERR(inode) && (type & CODA_NOCACHE)) |
120 | &type, &resfid); | ||
121 | if (!error) | ||
122 | error = coda_cnode_make(&inode, &resfid, dir->i_sb); | ||
123 | |||
124 | if (error && error != -ENOENT) | ||
125 | return ERR_PTR(error); | ||
126 | |||
127 | exit: | ||
128 | if (inode && !IS_ERR(inode) && (type & CODA_NOCACHE)) | ||
129 | coda_flag_inode(inode, C_VATTR | C_PURGE); | 123 | coda_flag_inode(inode, C_VATTR | C_PURGE); |
130 | 124 | ||
125 | if (inode == ERR_PTR(-ENOENT)) | ||
126 | inode = NULL; | ||
127 | |||
131 | return d_splice_alias(inode, entry); | 128 | return d_splice_alias(inode, entry); |
132 | } | 129 | } |
133 | 130 | ||