f2fs: remove unneeded INIT_LIST_HEAD at few places
[platform/adaptation/renesas_rcar/renesas_kernel.git] / fs / f2fs / recovery.c
index 7a43df0..502c63d 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * fs/f2fs/recovery.c
  *
  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
@@ -81,7 +81,7 @@ static int recover_inode(struct inode *inode, struct page *node_page)
        struct f2fs_node *raw_node = (struct f2fs_node *)kaddr;
        struct f2fs_inode *raw_inode = &(raw_node->i);
 
-       inode->i_mode = le32_to_cpu(raw_inode->i_mode);
+       inode->i_mode = le16_to_cpu(raw_inode->i_mode);
        i_size_write(inode, le64_to_cpu(raw_inode->i_size));
        inode->i_atime.tv_sec = le64_to_cpu(raw_inode->i_mtime);
        inode->i_ctime.tv_sec = le64_to_cpu(raw_inode->i_ctime);
@@ -144,14 +144,14 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head)
                                goto out;
                        }
 
-                       INIT_LIST_HEAD(&entry->list);
-                       list_add_tail(&entry->list, head);
-
                        entry->inode = f2fs_iget(sbi->sb, ino_of_node(page));
                        if (IS_ERR(entry->inode)) {
                                err = PTR_ERR(entry->inode);
+                               kmem_cache_free(fsync_entry_slab, entry);
                                goto out;
                        }
+
+                       list_add_tail(&entry->list, head);
                        entry->blkaddr = blkaddr;
                }
                if (IS_INODE(page)) {
@@ -228,6 +228,9 @@ static void check_index_in_prev_nodes(struct f2fs_sb_info *sbi,
 
        /* Deallocate previous index in the node page */
        inode = f2fs_iget_nowait(sbi->sb, ino);
+       if (IS_ERR(inode))
+               return;
+
        truncate_hole(inode, bidx, bidx + 1);
        iput(inode);
 }