Skip to content

Commit

Permalink
f2fs: avoid down_write on nat_tree_lock during checkpoint
Browse files Browse the repository at this point in the history
Let's cache nat entry if there's no lock contention only.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Jaegeuk Kim committed Dec 14, 2021
1 parent 7377e85 commit cbcb33f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/f2fs/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,10 @@ static void cache_nat_entry(struct f2fs_sb_info *sbi, nid_t nid,
struct f2fs_nm_info *nm_i = NM_I(sbi);
struct nat_entry *new, *e;

/* Let's mitigate lock contention of nat_tree_lock during checkpoint */
if (rwsem_is_locked(&sbi->cp_global_sem))
return;

new = __alloc_nat_entry(sbi, nid, false);
if (!new)
return;
Expand Down

0 comments on commit cbcb33f

Please sign in to comment.