Commit 0319003d authored by Al Viro's avatar Al Viro

nilfs really shouldn't slap struct dentry on stack...

... especially when it only needs (and initializes) .d_name of it
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 89031bc7
...@@ -349,11 +349,11 @@ static int nilfs_readdir(struct file *filp, void *dirent, filldir_t filldir) ...@@ -349,11 +349,11 @@ static int nilfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
* Entry is guaranteed to be valid. * Entry is guaranteed to be valid.
*/ */
struct nilfs_dir_entry * struct nilfs_dir_entry *
nilfs_find_entry(struct inode *dir, struct dentry *dentry, nilfs_find_entry(struct inode *dir, const struct qstr *qstr,
struct page **res_page) struct page **res_page)
{ {
const char *name = dentry->d_name.name; const unsigned char *name = qstr->name;
int namelen = dentry->d_name.len; int namelen = qstr->len;
unsigned reclen = NILFS_DIR_REC_LEN(namelen); unsigned reclen = NILFS_DIR_REC_LEN(namelen);
unsigned long start, n; unsigned long start, n;
unsigned long npages = dir_pages(dir); unsigned long npages = dir_pages(dir);
...@@ -424,13 +424,13 @@ struct nilfs_dir_entry *nilfs_dotdot(struct inode *dir, struct page **p) ...@@ -424,13 +424,13 @@ struct nilfs_dir_entry *nilfs_dotdot(struct inode *dir, struct page **p)
return de; return de;
} }
ino_t nilfs_inode_by_name(struct inode *dir, struct dentry *dentry) ino_t nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr)
{ {
ino_t res = 0; ino_t res = 0;
struct nilfs_dir_entry *de; struct nilfs_dir_entry *de;
struct page *page; struct page *page;
de = nilfs_find_entry(dir, dentry, &page); de = nilfs_find_entry(dir, qstr, &page);
if (de) { if (de) {
res = le64_to_cpu(de->inode); res = le64_to_cpu(de->inode);
kunmap(page); kunmap(page);
......
...@@ -67,7 +67,7 @@ nilfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) ...@@ -67,7 +67,7 @@ nilfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
if (dentry->d_name.len > NILFS_NAME_LEN) if (dentry->d_name.len > NILFS_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG); return ERR_PTR(-ENAMETOOLONG);
ino = nilfs_inode_by_name(dir, dentry); ino = nilfs_inode_by_name(dir, &dentry->d_name);
inode = NULL; inode = NULL;
if (ino) { if (ino) {
inode = nilfs_iget(dir->i_sb, ino); inode = nilfs_iget(dir->i_sb, ino);
...@@ -81,10 +81,7 @@ struct dentry *nilfs_get_parent(struct dentry *child) ...@@ -81,10 +81,7 @@ struct dentry *nilfs_get_parent(struct dentry *child)
{ {
unsigned long ino; unsigned long ino;
struct inode *inode; struct inode *inode;
struct dentry dotdot; struct qstr dotdot = {.name = "..", .len = 2};
dotdot.d_name.name = "..";
dotdot.d_name.len = 2;
ino = nilfs_inode_by_name(child->d_inode, &dotdot); ino = nilfs_inode_by_name(child->d_inode, &dotdot);
if (!ino) if (!ino)
...@@ -296,7 +293,7 @@ static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry) ...@@ -296,7 +293,7 @@ static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry)
int err; int err;
err = -ENOENT; err = -ENOENT;
de = nilfs_find_entry(dir, dentry, &page); de = nilfs_find_entry(dir, &dentry->d_name, &page);
if (!de) if (!de)
goto out; goto out;
...@@ -389,7 +386,7 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -389,7 +386,7 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
return err; return err;
err = -ENOENT; err = -ENOENT;
old_de = nilfs_find_entry(old_dir, old_dentry, &old_page); old_de = nilfs_find_entry(old_dir, &old_dentry->d_name, &old_page);
if (!old_de) if (!old_de)
goto out; goto out;
...@@ -409,7 +406,7 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -409,7 +406,7 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
goto out_dir; goto out_dir;
err = -ENOENT; err = -ENOENT;
new_de = nilfs_find_entry(new_dir, new_dentry, &new_page); new_de = nilfs_find_entry(new_dir, &new_dentry->d_name, &new_page);
if (!new_de) if (!new_de)
goto out_dir; goto out_dir;
inc_nlink(old_inode); inc_nlink(old_inode);
......
...@@ -217,10 +217,10 @@ static inline int nilfs_init_acl(struct inode *inode, struct inode *dir) ...@@ -217,10 +217,10 @@ static inline int nilfs_init_acl(struct inode *inode, struct inode *dir)
/* dir.c */ /* dir.c */
extern int nilfs_add_link(struct dentry *, struct inode *); extern int nilfs_add_link(struct dentry *, struct inode *);
extern ino_t nilfs_inode_by_name(struct inode *, struct dentry *); extern ino_t nilfs_inode_by_name(struct inode *, const struct qstr *);
extern int nilfs_make_empty(struct inode *, struct inode *); extern int nilfs_make_empty(struct inode *, struct inode *);
extern struct nilfs_dir_entry * extern struct nilfs_dir_entry *
nilfs_find_entry(struct inode *, struct dentry *, struct page **); nilfs_find_entry(struct inode *, const struct qstr *, struct page **);
extern int nilfs_delete_entry(struct nilfs_dir_entry *, struct page *); extern int nilfs_delete_entry(struct nilfs_dir_entry *, struct page *);
extern int nilfs_empty_dir(struct inode *); extern int nilfs_empty_dir(struct inode *);
extern struct nilfs_dir_entry *nilfs_dotdot(struct inode *, struct page **); extern struct nilfs_dir_entry *nilfs_dotdot(struct inode *, struct page **);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment