diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-15 03:33:10 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-29 04:57:19 -0400 |
commit | 1df98b8bbccab87f9da27b4661bf528212ffd5a2 (patch) | |
tree | 2a62a34b2237961e679f873e122224ea03d5e7c4 /fs | |
parent | c52a47ace7ef58cbe06e6b48190fee7073dceccc (diff) |
proc_fill_cache(): clean up, get rid of pointless find_inode_number() use
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/base.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index ac1f7a823204..1485e38daaa3 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, | |||
1686 | instantiate_t instantiate, struct task_struct *task, const void *ptr) | 1686 | instantiate_t instantiate, struct task_struct *task, const void *ptr) |
1687 | { | 1687 | { |
1688 | struct dentry *child, *dir = file->f_path.dentry; | 1688 | struct dentry *child, *dir = file->f_path.dentry; |
1689 | struct qstr qname = QSTR_INIT(name, len); | ||
1689 | struct inode *inode; | 1690 | struct inode *inode; |
1690 | struct qstr qname; | 1691 | unsigned type; |
1691 | ino_t ino = 0; | 1692 | ino_t ino; |
1692 | unsigned type = DT_UNKNOWN; | ||
1693 | 1693 | ||
1694 | qname.name = name; | 1694 | child = d_hash_and_lookup(dir, &qname); |
1695 | qname.len = len; | ||
1696 | qname.hash = full_name_hash(name, len); | ||
1697 | |||
1698 | child = d_lookup(dir, &qname); | ||
1699 | if (!child) { | 1695 | if (!child) { |
1700 | struct dentry *new; | 1696 | child = d_alloc(dir, &qname); |
1701 | new = d_alloc(dir, &qname); | 1697 | if (!child) |
1702 | if (new) { | 1698 | goto end_instantiate; |
1703 | child = ERR_PTR(instantiate(dir->d_inode, new, task, ptr)); | 1699 | if (instantiate(dir->d_inode, child, task, ptr) < 0) { |
1704 | if (child) | 1700 | dput(child); |
1705 | dput(new); | 1701 | goto end_instantiate; |
1706 | else | ||
1707 | child = new; | ||
1708 | } | 1702 | } |
1709 | } | 1703 | } |
1710 | if (!child || IS_ERR(child) || !child->d_inode) | ||
1711 | goto end_instantiate; | ||
1712 | inode = child->d_inode; | 1704 | inode = child->d_inode; |
1713 | ino = inode->i_ino; | 1705 | ino = inode->i_ino; |
1714 | type = inode->i_mode >> 12; | 1706 | type = inode->i_mode >> 12; |
1715 | dput(child); | 1707 | dput(child); |
1716 | end_instantiate: | ||
1717 | if (!ino) | ||
1718 | ino = find_inode_number(dir, &qname); | ||
1719 | if (!ino) | ||
1720 | ino = 1; | ||
1721 | return dir_emit(ctx, name, len, ino, type); | 1708 | return dir_emit(ctx, name, len, ino, type); |
1709 | |||
1710 | end_instantiate: | ||
1711 | return dir_emit(ctx, name, len, 1, DT_UNKNOWN); | ||
1722 | } | 1712 | } |
1723 | 1713 | ||
1724 | #ifdef CONFIG_CHECKPOINT_RESTORE | 1714 | #ifdef CONFIG_CHECKPOINT_RESTORE |