udf: add extent cache support in case of file reading
[platform/adaptation/renesas_rcar/renesas_kernel.git] / fs / udf / super.c
index d44fb56..da8ce9f 100644 (file)
@@ -134,6 +134,8 @@ static struct inode *udf_alloc_inode(struct super_block *sb)
        ei->i_next_alloc_goal = 0;
        ei->i_strat4096 = 0;
        init_rwsem(&ei->i_data_sem);
+       ei->cached_extent.lstart = -1;
+       spin_lock_init(&ei->i_extent_cache_lock);
 
        return &ei->vfs_inode;
 }
@@ -307,7 +309,8 @@ static void udf_sb_free_partitions(struct super_block *sb)
 {
        struct udf_sb_info *sbi = UDF_SB(sb);
        int i;
-
+       if (sbi->s_partmaps == NULL)
+               return;
        for (i = 0; i < sbi->s_partitions; i++)
                udf_free_partition(&sbi->s_partmaps[i]);
        kfree(sbi->s_partmaps);
@@ -1865,6 +1868,8 @@ static void udf_open_lvid(struct super_block *sb)
        mark_buffer_dirty(bh);
        sbi->s_lvid_dirty = 0;
        mutex_unlock(&sbi->s_alloc_mutex);
+       /* Make opening of filesystem visible on the media immediately */
+       sync_dirty_buffer(bh);
 }
 
 static void udf_close_lvid(struct super_block *sb)
@@ -1905,6 +1910,8 @@ static void udf_close_lvid(struct super_block *sb)
        mark_buffer_dirty(bh);
        sbi->s_lvid_dirty = 0;
        mutex_unlock(&sbi->s_alloc_mutex);
+       /* Make closing of filesystem visible on the media immediately */
+       sync_dirty_buffer(bh);
 }
 
 u64 lvid_get_unique_id(struct super_block *sb)