f2fs: change to use rwsem for cp_mutex

Use rwsem to ensure serialization of the callers and to avoid
starvation of high priority tasks, when the system is under
heavy IO workload.

Change-Id: Ifac519c3de127f79d8613ee742a68f7fc0377e36
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
This commit is contained in:
Sahitya Tummala
2020-11-19 14:56:12 +05:30
committed by Sayali Lokhande
parent 713f0247f0
commit a2e201948f
5 changed files with 11 additions and 10 deletions

View File

@@ -798,7 +798,7 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)
INIT_LIST_HEAD(&dir_list);
/* prevent checkpoint */
mutex_lock(&sbi->cp_mutex);
down_write(&sbi->cp_global_sem);
/* step #1: find fsynced inode numbers */
err = find_fsync_dnodes(sbi, &inode_list, check_only);
@@ -834,7 +834,8 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)
} else {
clear_sbi_flag(sbi, SBI_POR_DOING);
}
mutex_unlock(&sbi->cp_mutex);
up_write(&sbi->cp_global_sem);
/* let's drop all the directory inodes for clean checkpoint */
destroy_fsync_dnodes(&dir_list, err);