summaryrefslogtreecommitdiff
path: root/fs/f2fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-01-25 16:15:43 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-08 02:55:04 -0500
commitb7f7a5e0be94d13875a1c6c9aa65eeb11a46fc1b (patch)
tree69145a46a70aae7ba6bf0e03b46617bbb74f1a1b /fs/f2fs
parent69f24eac55725859a89c440ee2d19f36fa09e8fc (diff)
downloadlinux-3.10-b7f7a5e0be94d13875a1c6c9aa65eeb11a46fc1b.tar.gz
linux-3.10-b7f7a5e0be94d13875a1c6c9aa65eeb11a46fc1b.tar.bz2
linux-3.10-b7f7a5e0be94d13875a1c6c9aa65eeb11a46fc1b.zip
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')
-rw-r--r--fs/f2fs/dir.c12
-rw-r--r--fs/f2fs/f2fs.h8
-rw-r--r--fs/f2fs/recovery.c12
3 files changed, 17 insertions, 15 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 208a804180d..47df9252ad6 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++)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index bfdc10741ff..6895ecc351e 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -868,11 +868,17 @@ ino_t f2fs_inode_by_name(struct inode *, struct qstr *);
void f2fs_set_link(struct inode *, struct f2fs_dir_entry *,
struct page *, struct inode *);
void init_dent_inode(const struct qstr *, struct page *);
-int f2fs_add_link(struct dentry *, struct inode *);
+int __f2fs_add_link(struct inode *, const struct qstr *, struct inode *);
void f2fs_delete_entry(struct f2fs_dir_entry *, struct page *, struct inode *);
int f2fs_make_empty(struct inode *, struct inode *);
bool f2fs_empty_dir(struct inode *);
+static inline int f2fs_add_link(struct dentry *dentry, struct inode *inode)
+{
+ return __f2fs_add_link(dentry->d_parent->d_inode, &dentry->d_name,
+ inode);
+}
+
/*
* super.c
*/
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index b571fee677d..62000422879 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -42,7 +42,7 @@ static int recover_dentry(struct page *ipage, struct inode *inode)
{
struct f2fs_node *raw_node = (struct f2fs_node *)kmap(ipage);
struct f2fs_inode *raw_inode = &(raw_node->i);
- struct dentry dent, parent;
+ struct qstr name;
struct f2fs_dir_entry *de;
struct page *page;
struct inode *dir;
@@ -57,17 +57,15 @@ static int recover_dentry(struct page *ipage, struct inode *inode)
goto out;
}
- parent.d_inode = dir;
- dent.d_parent = &parent;
- dent.d_name.len = le32_to_cpu(raw_inode->i_namelen);
- dent.d_name.name = raw_inode->i_name;
+ name.len = le32_to_cpu(raw_inode->i_namelen);
+ name.name = raw_inode->i_name;
- de = f2fs_find_entry(dir, &dent.d_name, &page);
+ de = f2fs_find_entry(dir, &name, &page);
if (de) {
kunmap(page);
f2fs_put_page(page, 0);
} else {
- f2fs_add_link(&dent, inode);
+ __f2fs_add_link(dir, &name, inode);
}
iput(dir);
out: