diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nilfs2/dir.c | 10 | ||||
-rw-r--r-- | fs/nilfs2/namei.c | 13 | ||||
-rw-r--r-- | fs/nilfs2/nilfs.h | 4 |
3 files changed, 12 insertions, 15 deletions
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c index 76d803e060a9..26402b9b305e 100644 --- a/fs/nilfs2/dir.c +++ b/fs/nilfs2/dir.c | |||
@@ -349,11 +349,11 @@ done: | |||
349 | * Entry is guaranteed to be valid. | 349 | * Entry is guaranteed to be valid. |
350 | */ | 350 | */ |
351 | struct nilfs_dir_entry * | 351 | struct nilfs_dir_entry * |
352 | nilfs_find_entry(struct inode *dir, struct dentry *dentry, | 352 | nilfs_find_entry(struct inode *dir, const struct qstr *qstr, |
353 | struct page **res_page) | 353 | struct page **res_page) |
354 | { | 354 | { |
355 | const char *name = dentry->d_name.name; | 355 | const unsigned char *name = qstr->name; |
356 | int namelen = dentry->d_name.len; | 356 | int namelen = qstr->len; |
357 | unsigned reclen = NILFS_DIR_REC_LEN(namelen); | 357 | unsigned reclen = NILFS_DIR_REC_LEN(namelen); |
358 | unsigned long start, n; | 358 | unsigned long start, n; |
359 | unsigned long npages = dir_pages(dir); | 359 | unsigned long npages = dir_pages(dir); |
@@ -424,13 +424,13 @@ struct nilfs_dir_entry *nilfs_dotdot(struct inode *dir, struct page **p) | |||
424 | return de; | 424 | return de; |
425 | } | 425 | } |
426 | 426 | ||
427 | ino_t nilfs_inode_by_name(struct inode *dir, struct dentry *dentry) | 427 | ino_t nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr) |
428 | { | 428 | { |
429 | ino_t res = 0; | 429 | ino_t res = 0; |
430 | struct nilfs_dir_entry *de; | 430 | struct nilfs_dir_entry *de; |
431 | struct page *page; | 431 | struct page *page; |
432 | 432 | ||
433 | de = nilfs_find_entry(dir, dentry, &page); | 433 | de = nilfs_find_entry(dir, qstr, &page); |
434 | if (de) { | 434 | if (de) { |
435 | res = le64_to_cpu(de->inode); | 435 | res = le64_to_cpu(de->inode); |
436 | kunmap(page); | 436 | kunmap(page); |
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c index 07ba838ef089..ad6ed2cf19b4 100644 --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c | |||
@@ -67,7 +67,7 @@ nilfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
67 | if (dentry->d_name.len > NILFS_NAME_LEN) | 67 | if (dentry->d_name.len > NILFS_NAME_LEN) |
68 | return ERR_PTR(-ENAMETOOLONG); | 68 | return ERR_PTR(-ENAMETOOLONG); |
69 | 69 | ||
70 | ino = nilfs_inode_by_name(dir, dentry); | 70 | ino = nilfs_inode_by_name(dir, &dentry->d_name); |
71 | inode = NULL; | 71 | inode = NULL; |
72 | if (ino) { | 72 | if (ino) { |
73 | inode = nilfs_iget(dir->i_sb, ino); | 73 | inode = nilfs_iget(dir->i_sb, ino); |
@@ -81,10 +81,7 @@ struct dentry *nilfs_get_parent(struct dentry *child) | |||
81 | { | 81 | { |
82 | unsigned long ino; | 82 | unsigned long ino; |
83 | struct inode *inode; | 83 | struct inode *inode; |
84 | struct dentry dotdot; | 84 | struct qstr dotdot = {.name = "..", .len = 2}; |
85 | |||
86 | dotdot.d_name.name = ".."; | ||
87 | dotdot.d_name.len = 2; | ||
88 | 85 | ||
89 | ino = nilfs_inode_by_name(child->d_inode, &dotdot); | 86 | ino = nilfs_inode_by_name(child->d_inode, &dotdot); |
90 | if (!ino) | 87 | if (!ino) |
@@ -296,7 +293,7 @@ static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry) | |||
296 | int err; | 293 | int err; |
297 | 294 | ||
298 | err = -ENOENT; | 295 | err = -ENOENT; |
299 | de = nilfs_find_entry(dir, dentry, &page); | 296 | de = nilfs_find_entry(dir, &dentry->d_name, &page); |
300 | if (!de) | 297 | if (!de) |
301 | goto out; | 298 | goto out; |
302 | 299 | ||
@@ -389,7 +386,7 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
389 | return err; | 386 | return err; |
390 | 387 | ||
391 | err = -ENOENT; | 388 | err = -ENOENT; |
392 | old_de = nilfs_find_entry(old_dir, old_dentry, &old_page); | 389 | old_de = nilfs_find_entry(old_dir, &old_dentry->d_name, &old_page); |
393 | if (!old_de) | 390 | if (!old_de) |
394 | goto out; | 391 | goto out; |
395 | 392 | ||
@@ -409,7 +406,7 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
409 | goto out_dir; | 406 | goto out_dir; |
410 | 407 | ||
411 | err = -ENOENT; | 408 | err = -ENOENT; |
412 | new_de = nilfs_find_entry(new_dir, new_dentry, &new_page); | 409 | new_de = nilfs_find_entry(new_dir, &new_dentry->d_name, &new_page); |
413 | if (!new_de) | 410 | if (!new_de) |
414 | goto out_dir; | 411 | goto out_dir; |
415 | inc_nlink(old_inode); | 412 | inc_nlink(old_inode); |
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h index 4da6f67e9a91..8723e5bfd071 100644 --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h | |||
@@ -217,10 +217,10 @@ static inline int nilfs_init_acl(struct inode *inode, struct inode *dir) | |||
217 | 217 | ||
218 | /* dir.c */ | 218 | /* dir.c */ |
219 | extern int nilfs_add_link(struct dentry *, struct inode *); | 219 | extern int nilfs_add_link(struct dentry *, struct inode *); |
220 | extern ino_t nilfs_inode_by_name(struct inode *, struct dentry *); | 220 | extern ino_t nilfs_inode_by_name(struct inode *, const struct qstr *); |
221 | extern int nilfs_make_empty(struct inode *, struct inode *); | 221 | extern int nilfs_make_empty(struct inode *, struct inode *); |
222 | extern struct nilfs_dir_entry * | 222 | extern struct nilfs_dir_entry * |
223 | nilfs_find_entry(struct inode *, struct dentry *, struct page **); | 223 | nilfs_find_entry(struct inode *, const struct qstr *, struct page **); |
224 | extern int nilfs_delete_entry(struct nilfs_dir_entry *, struct page *); | 224 | extern int nilfs_delete_entry(struct nilfs_dir_entry *, struct page *); |
225 | extern int nilfs_empty_dir(struct inode *); | 225 | extern int nilfs_empty_dir(struct inode *); |
226 | extern struct nilfs_dir_entry *nilfs_dotdot(struct inode *, struct page **); | 226 | extern struct nilfs_dir_entry *nilfs_dotdot(struct inode *, struct page **); |