···178178 LOCK_NAME_CP_RWSEM,179179 LOCK_NAME_NODE_CHANGE,180180 LOCK_NAME_NODE_WRITE,181181+ LOCK_NAME_GC_LOCK,181182};182183183184/*···14091408 unsigned long long age_threshold; /* age threshold */14101409};1411141014121412-struct f2fs_gc_control {14131413- unsigned int victim_segno; /* target victim segment number */14141414- int init_gc_type; /* FG_GC or BG_GC */14151415- bool no_bg_gc; /* check the space and stop bg_gc */14161416- bool should_migrate_blocks; /* should migrate blocks */14171417- bool err_gc_skipped; /* return EAGAIN if GC skipped */14181418- bool one_time; /* require one time GC in one migration unit */14191419- unsigned int nr_free_secs; /* # of free sections to do GC */14201420-};14211421-14221411struct f2fs_time_stat {14231412 unsigned long long total_time; /* total wall clock time */14241413#ifdef CONFIG_64BIT···14251434struct f2fs_lock_context {14261435 struct f2fs_time_stat ts;14271436 bool lock_trace;14371437+};14381438+14391439+struct f2fs_gc_control {14401440+ unsigned int victim_segno; /* target victim segment number */14411441+ int init_gc_type; /* FG_GC or BG_GC */14421442+ bool no_bg_gc; /* check the space and stop bg_gc */14431443+ bool should_migrate_blocks; /* should migrate blocks */14441444+ bool err_gc_skipped; /* return EAGAIN if GC skipped */14451445+ bool one_time; /* require one time GC in one migration unit */14461446+ unsigned int nr_free_secs; /* # of free sections to do GC */14471447+ struct f2fs_lock_context lc; /* lock context for gc_lock */14281448};1429144914301450/*
+7-6
fs/f2fs/file.c
···1928192819291929 if (has_not_enough_free_secs(sbi, 0,19301930 sbi->reserved_pin_section)) {19311931- f2fs_down_write(&sbi->gc_lock);19311931+ f2fs_down_write_trace(&sbi->gc_lock, &gc_control.lc);19321932 stat_inc_gc_call_count(sbi, FOREGROUND);19331933 err = f2fs_gc(sbi, &gc_control);19341934 if (err && err != -ENODATA) {···27792779 return ret;2780278027812781 if (!sync) {27822782- if (!f2fs_down_write_trylock(&sbi->gc_lock)) {27822782+ if (!f2fs_down_write_trylock_trace(&sbi->gc_lock,27832783+ &gc_control.lc)) {27832784 ret = -EBUSY;27842785 goto out;27852786 }27862787 } else {27872787- f2fs_down_write(&sbi->gc_lock);27882788+ f2fs_down_write_trace(&sbi->gc_lock, &gc_control.lc);27882789 }2789279027902791 gc_control.init_gc_type = sync ? FG_GC : BG_GC;···2825282428262825do_more:28272826 if (!range->sync) {28282828- if (!f2fs_down_write_trylock(&sbi->gc_lock)) {28272827+ if (!f2fs_down_write_trylock_trace(&sbi->gc_lock, &gc_control.lc)) {28292828 ret = -EBUSY;28302829 goto out;28312830 }28322831 } else {28332833- f2fs_down_write(&sbi->gc_lock);28322832+ f2fs_down_write_trace(&sbi->gc_lock, &gc_control.lc);28342833 }2835283428362835 gc_control.victim_segno = GET_SEGNO(sbi, range->start);···33213320 end_segno = min(start_segno + range.segments, dev_end_segno);3322332133233322 while (start_segno < end_segno) {33243324- if (!f2fs_down_write_trylock(&sbi->gc_lock)) {33233323+ if (!f2fs_down_write_trylock_trace(&sbi->gc_lock, &gc_control.lc)) {33253324 ret = -EBUSY;33263325 goto out;33273326 }