diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-01-25 16:15:43 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-08 02:55:04 -0500 |
commit | b7f7a5e0be94d13875a1c6c9aa65eeb11a46fc1b (patch) | |
tree | 69145a46a70aae7ba6bf0e03b46617bbb74f1a1b /fs/f2fs/dir.c | |
parent | 69f24eac55725859a89c440ee2d19f36fa09e8fc (diff) |
f2fs: get rid of fake on-stack dentries
those should never be used for a lot of reasons...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/f2fs/dir.c')
-rw-r--r-- | fs/f2fs/dir.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 208a804180d6..47df9252ad6a 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -370,7 +370,7 @@ next: goto next; } -int f2fs_add_link(struct dentry *dentry, struct inode *inode) +int __f2fs_add_link(struct inode *dir, const struct qstr *name, struct inode *inode) { unsigned int bit_pos; unsigned int level; @@ -379,17 +379,15 @@ int f2fs_add_link(struct dentry *dentry, struct inode *inode) f2fs_hash_t dentry_hash; struct f2fs_dir_entry *de; unsigned int nbucket, nblock; - struct inode *dir = dentry->d_parent->d_inode; struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); - const char *name = dentry->d_name.name; - size_t namelen = dentry->d_name.len; + size_t namelen = name->len; struct page *dentry_page = NULL; struct f2fs_dentry_block *dentry_blk = NULL; int slots = GET_DENTRY_SLOTS(namelen); int err = 0; int i; - dentry_hash = f2fs_dentry_hash(name, dentry->d_name.len); + dentry_hash = f2fs_dentry_hash(name->name, name->len); level = 0; current_depth = F2FS_I(dir)->i_current_depth; if (F2FS_I(dir)->chash == dentry_hash) { @@ -432,7 +430,7 @@ start: ++level; goto start; add_dentry: - err = init_inode_metadata(inode, dir, &dentry->d_name); + err = init_inode_metadata(inode, dir, name); if (err) goto fail; @@ -441,7 +439,7 @@ add_dentry: de = &dentry_blk->dentry[bit_pos]; de->hash_code = dentry_hash; de->name_len = cpu_to_le16(namelen); - memcpy(dentry_blk->filename[bit_pos], name, namelen); + memcpy(dentry_blk->filename[bit_pos], name->name, name->len); de->ino = cpu_to_le32(inode->i_ino); set_de_type(de, inode); for (i = 0; i < slots; i++) |