f2fs: clean up opened code with f2fs_update_dentry
authorChao Yu <chao@kernel.org>
Wed, 9 Mar 2016 14:07:28 +0000 (22:07 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 18 Mar 2016 04:19:45 +0000 (21:19 -0700)
Just clean up opened code with existing function, no logic change.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/dir.c

index 479467e442ea44127fd9b84dd70347df01c9f049..80641ad827459af98d39dce0e2f649a30f489c8b 100644 (file)
@@ -341,24 +341,14 @@ int update_dent_inode(struct inode *inode, struct inode *to,
 void do_make_empty_dir(struct inode *inode, struct inode *parent,
                                        struct f2fs_dentry_ptr *d)
 {
-       struct f2fs_dir_entry *de;
-
-       de = &d->dentry[0];
-       de->name_len = cpu_to_le16(1);
-       de->hash_code = 0;
-       de->ino = cpu_to_le32(inode->i_ino);
-       memcpy(d->filename[0], ".", 1);
-       set_de_type(de, inode->i_mode);
+       struct qstr dot = QSTR_INIT(".", 1);
+       struct qstr dotdot = QSTR_INIT("..", 2);
 
-       de = &d->dentry[1];
-       de->hash_code = 0;
-       de->name_len = cpu_to_le16(2);
-       de->ino = cpu_to_le32(parent->i_ino);
-       memcpy(d->filename[1], "..", 2);
-       set_de_type(de, parent->i_mode);
+       /* update dirent of "." */
+       f2fs_update_dentry(inode->i_ino, inode->i_mode, d, &dot, 0, 0);
 
-       test_and_set_bit_le(0, (void *)d->bitmap);
-       test_and_set_bit_le(1, (void *)d->bitmap);
+       /* update dirent of ".." */
+       f2fs_update_dentry(parent->i_ino, parent->i_mode, d, &dotdot, 0, 1);
 }
 
 static int make_empty_dir(struct inode *inode,
This page took 0.025509 seconds and 5 git commands to generate.