diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-08-24 07:28:39 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-10-23 05:13:09 -0400 |
commit | a9885444f7ff6e9156adb1adf5558ded9a39ad0a (patch) | |
tree | 0f52bb872aface2a022f7cdb7aea5cd33ab10509 /fs/ext2/namei.c | |
parent | 734711abac46c8fee4d70cc9876ebc6d9edb4971 (diff) |
[PATCH] get rid of on-stack dentry in ext2_get_parent()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ext2/namei.c')
-rw-r--r-- | fs/ext2/namei.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index a1b328ab1e55..2a747252ec12 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c | |||
@@ -60,7 +60,7 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, str | |||
60 | if (dentry->d_name.len > EXT2_NAME_LEN) | 60 | if (dentry->d_name.len > EXT2_NAME_LEN) |
61 | return ERR_PTR(-ENAMETOOLONG); | 61 | return ERR_PTR(-ENAMETOOLONG); |
62 | 62 | ||
63 | ino = ext2_inode_by_name(dir, dentry); | 63 | ino = ext2_inode_by_name(dir, &dentry->d_name); |
64 | inode = NULL; | 64 | inode = NULL; |
65 | if (ino) { | 65 | if (ino) { |
66 | inode = ext2_iget(dir->i_sb, ino); | 66 | inode = ext2_iget(dir->i_sb, ino); |
@@ -72,13 +72,8 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, str | |||
72 | 72 | ||
73 | struct dentry *ext2_get_parent(struct dentry *child) | 73 | struct dentry *ext2_get_parent(struct dentry *child) |
74 | { | 74 | { |
75 | unsigned long ino; | 75 | struct qstr dotdot = {.name = "..", .len = 2}; |
76 | struct dentry dotdot; | 76 | unsigned long ino = ext2_inode_by_name(child->d_inode, &dotdot); |
77 | |||
78 | dotdot.d_name.name = ".."; | ||
79 | dotdot.d_name.len = 2; | ||
80 | |||
81 | ino = ext2_inode_by_name(child->d_inode, &dotdot); | ||
82 | if (!ino) | 77 | if (!ino) |
83 | return ERR_PTR(-ENOENT); | 78 | return ERR_PTR(-ENOENT); |
84 | return d_obtain_alias(ext2_iget(child->d_inode->i_sb, ino)); | 79 | return d_obtain_alias(ext2_iget(child->d_inode->i_sb, ino)); |
@@ -246,7 +241,7 @@ static int ext2_unlink(struct inode * dir, struct dentry *dentry) | |||
246 | struct page * page; | 241 | struct page * page; |
247 | int err = -ENOENT; | 242 | int err = -ENOENT; |
248 | 243 | ||
249 | de = ext2_find_entry (dir, dentry, &page); | 244 | de = ext2_find_entry (dir, &dentry->d_name, &page); |
250 | if (!de) | 245 | if (!de) |
251 | goto out; | 246 | goto out; |
252 | 247 | ||
@@ -288,7 +283,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, | |||
288 | struct ext2_dir_entry_2 * old_de; | 283 | struct ext2_dir_entry_2 * old_de; |
289 | int err = -ENOENT; | 284 | int err = -ENOENT; |
290 | 285 | ||
291 | old_de = ext2_find_entry (old_dir, old_dentry, &old_page); | 286 | old_de = ext2_find_entry (old_dir, &old_dentry->d_name, &old_page); |
292 | if (!old_de) | 287 | if (!old_de) |
293 | goto out; | 288 | goto out; |
294 | 289 | ||
@@ -308,7 +303,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, | |||
308 | goto out_dir; | 303 | goto out_dir; |
309 | 304 | ||
310 | err = -ENOENT; | 305 | err = -ENOENT; |
311 | new_de = ext2_find_entry (new_dir, new_dentry, &new_page); | 306 | new_de = ext2_find_entry (new_dir, &new_dentry->d_name, &new_page); |
312 | if (!new_de) | 307 | if (!new_de) |
313 | goto out_dir; | 308 | goto out_dir; |
314 | inode_inc_link_count(old_inode); | 309 | inode_inc_link_count(old_inode); |