aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/checkpoint.c')
-rw-r--r--fs/f2fs/checkpoint.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 9b0628e0d8bc..e5d2ffa80b56 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -348,13 +348,13 @@ static int f2fs_write_meta_pages(struct address_space *mapping,
348 goto skip_write; 348 goto skip_write;
349 349
350 /* if locked failed, cp will flush dirty pages instead */ 350 /* if locked failed, cp will flush dirty pages instead */
351 if (!mutex_trylock(&sbi->cp_mutex)) 351 if (!down_write_trylock(&sbi->cp_global_sem))
352 goto skip_write; 352 goto skip_write;
353 353
354 trace_f2fs_writepages(mapping->host, wbc, META); 354 trace_f2fs_writepages(mapping->host, wbc, META);
355 diff = nr_pages_to_write(sbi, META, wbc); 355 diff = nr_pages_to_write(sbi, META, wbc);
356 written = f2fs_sync_meta_pages(sbi, META, wbc->nr_to_write, FS_META_IO); 356 written = f2fs_sync_meta_pages(sbi, META, wbc->nr_to_write, FS_META_IO);
357 mutex_unlock(&sbi->cp_mutex); 357 up_write(&sbi->cp_global_sem);
358 wbc->nr_to_write = max((long)0, wbc->nr_to_write - written - diff); 358 wbc->nr_to_write = max((long)0, wbc->nr_to_write - written - diff);
359 return 0; 359 return 0;
360 360
@@ -1572,7 +1572,7 @@ int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
1572 f2fs_warn(sbi, "Start checkpoint disabled!"); 1572 f2fs_warn(sbi, "Start checkpoint disabled!");
1573 } 1573 }
1574 if (cpc->reason != CP_RESIZE) 1574 if (cpc->reason != CP_RESIZE)
1575 mutex_lock(&sbi->cp_mutex); 1575 down_write(&sbi->cp_global_sem);
1576 1576
1577 if (!is_sbi_flag_set(sbi, SBI_IS_DIRTY) && 1577 if (!is_sbi_flag_set(sbi, SBI_IS_DIRTY) &&
1578 ((cpc->reason & CP_FASTBOOT) || (cpc->reason & CP_SYNC) || 1578 ((cpc->reason & CP_FASTBOOT) || (cpc->reason & CP_SYNC) ||
@@ -1647,7 +1647,7 @@ stop:
1647 trace_f2fs_write_checkpoint(sbi->sb, cpc->reason, "finish checkpoint"); 1647 trace_f2fs_write_checkpoint(sbi->sb, cpc->reason, "finish checkpoint");
1648out: 1648out:
1649 if (cpc->reason != CP_RESIZE) 1649 if (cpc->reason != CP_RESIZE)
1650 mutex_unlock(&sbi->cp_mutex); 1650 up_write(&sbi->cp_global_sem);
1651 return err; 1651 return err;
1652} 1652}
1653 1653