Skip to content

Commit 0df035c

Browse files
author
Jaegeuk Kim
committed
f2fs: avoid down_write on nat_tree_lock during checkpoint
Let's cache nat entry if there's no lock contention only. Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 7377e85 commit 0df035c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/f2fs/node.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,10 @@ static void cache_nat_entry(struct f2fs_sb_info *sbi, nid_t nid,
430430
struct f2fs_nm_info *nm_i = NM_I(sbi);
431431
struct nat_entry *new, *e;
432432

433+
/* Let's mitigate lock contention of nat_tree_lock during checkpoint */
434+
if (rwsem_is_locked(&sbi->cp_global_sem))
435+
return;
436+
433437
new = __alloc_nat_entry(sbi, nid, false);
434438
if (!new)
435439
return;

0 commit comments

Comments
 (0)