summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-06-15 11:33:10 +0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-06-29 12:57:19 +0400
commit1df98b8bbccab87f9da27b4661bf528212ffd5a2 (patch)
tree2a62a34b2237961e679f873e122224ea03d5e7c4
parentc52a47ace7ef58cbe06e6b48190fee7073dceccc (diff)
downloadop-kernel-dev-1df98b8bbccab87f9da27b4661bf528212ffd5a2.zip
op-kernel-dev-1df98b8bbccab87f9da27b4661bf528212ffd5a2.tar.gz
proc_fill_cache(): clean up, get rid of pointless find_inode_number() use
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/proc/base.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index ac1f7a8..1485e38 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1686,39 +1686,29 @@ bool proc_fill_cache(struct file *file, struct dir_context *ctx,
instantiate_t instantiate, struct task_struct *task, const void *ptr)
{
struct dentry *child, *dir = file->f_path.dentry;
+ struct qstr qname = QSTR_INIT(name, len);
struct inode *inode;
- struct qstr qname;
- ino_t ino = 0;
- unsigned type = DT_UNKNOWN;
+ unsigned type;
+ ino_t ino;
- qname.name = name;
- qname.len = len;
- qname.hash = full_name_hash(name, len);
-
- child = d_lookup(dir, &qname);
+ child = d_hash_and_lookup(dir, &qname);
if (!child) {
- struct dentry *new;
- new = d_alloc(dir, &qname);
- if (new) {
- child = ERR_PTR(instantiate(dir->d_inode, new, task, ptr));
- if (child)
- dput(new);
- else
- child = new;
+ child = d_alloc(dir, &qname);
+ if (!child)
+ goto end_instantiate;
+ if (instantiate(dir->d_inode, child, task, ptr) < 0) {
+ dput(child);
+ goto end_instantiate;
}
}
- if (!child || IS_ERR(child) || !child->d_inode)
- goto end_instantiate;
inode = child->d_inode;
ino = inode->i_ino;
type = inode->i_mode >> 12;
dput(child);
-end_instantiate:
- if (!ino)
- ino = find_inode_number(dir, &qname);
- if (!ino)
- ino = 1;
return dir_emit(ctx, name, len, ino, type);
+
+end_instantiate:
+ return dir_emit(ctx, name, len, 1, DT_UNKNOWN);
}
#ifdef CONFIG_CHECKPOINT_RESTORE
OpenPOWER on IntegriCloud