@@ -102,21 +102,22 @@ static int gc_thread_func(void *data)
102102 if (sbi -> gc_mode == GC_URGENT_HIGH ||
103103 sbi -> gc_mode == GC_URGENT_MID ) {
104104 wait_ms = gc_th -> urgent_sleep_time ;
105- f2fs_down_write (& sbi -> gc_lock );
105+ f2fs_down_write_trace (& sbi -> gc_lock , & gc_control . lc );
106106 goto do_gc ;
107107 }
108108
109109 if (foreground ) {
110- f2fs_down_write (& sbi -> gc_lock );
110+ f2fs_down_write_trace (& sbi -> gc_lock , & gc_control . lc );
111111 goto do_gc ;
112- } else if (!f2fs_down_write_trylock (& sbi -> gc_lock )) {
112+ } else if (!f2fs_down_write_trylock_trace (& sbi -> gc_lock ,
113+ & gc_control .lc )) {
113114 stat_other_skip_bggc_count (sbi );
114115 goto next ;
115116 }
116117
117118 if (!is_idle (sbi , GC_TIME )) {
118119 increase_sleep_time (gc_th , & wait_ms );
119- f2fs_up_write (& sbi -> gc_lock );
120+ f2fs_up_write_trace (& sbi -> gc_lock , & gc_control . lc );
120121 stat_io_skip_bggc_count (sbi );
121122 goto next ;
122123 }
@@ -125,7 +126,8 @@ static int gc_thread_func(void *data)
125126 if (has_enough_free_blocks (sbi ,
126127 gc_th -> no_zoned_gc_percent )) {
127128 wait_ms = gc_th -> no_gc_sleep_time ;
128- f2fs_up_write (& sbi -> gc_lock );
129+ f2fs_up_write_trace (& sbi -> gc_lock ,
130+ & gc_control .lc );
129131 goto next ;
130132 }
131133 if (wait_ms == gc_th -> no_gc_sleep_time )
@@ -2046,7 +2048,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control)
20462048 reserved_segments (sbi ),
20472049 prefree_segments (sbi ));
20482050
2049- f2fs_up_write (& sbi -> gc_lock );
2051+ f2fs_up_write_trace (& sbi -> gc_lock , & gc_control -> lc );
20502052
20512053 put_gc_inode (& gc_list );
20522054
@@ -2264,6 +2266,7 @@ int f2fs_resize_fs(struct file *filp, __u64 block_count)
22642266 __u64 old_block_count , shrunk_blocks ;
22652267 struct cp_control cpc = { CP_RESIZE , 0 , 0 , 0 };
22662268 struct f2fs_lock_context lc ;
2269+ struct f2fs_lock_context glc ;
22672270 unsigned int secs ;
22682271 int err = 0 ;
22692272 __u32 rem ;
@@ -2307,7 +2310,7 @@ int f2fs_resize_fs(struct file *filp, __u64 block_count)
23072310 secs = div_u64 (shrunk_blocks , BLKS_PER_SEC (sbi ));
23082311
23092312 /* stop other GC */
2310- if (!f2fs_down_write_trylock (& sbi -> gc_lock )) {
2313+ if (!f2fs_down_write_trylock_trace (& sbi -> gc_lock , & glc )) {
23112314 err = - EAGAIN ;
23122315 goto out_drop_write ;
23132316 }
@@ -2329,7 +2332,7 @@ int f2fs_resize_fs(struct file *filp, __u64 block_count)
23292332
23302333out_unlock :
23312334 f2fs_unlock_op (sbi , & lc );
2332- f2fs_up_write (& sbi -> gc_lock );
2335+ f2fs_up_write_trace (& sbi -> gc_lock , & glc );
23332336out_drop_write :
23342337 mnt_drop_write_file (filp );
23352338 if (err )
@@ -2346,7 +2349,7 @@ int f2fs_resize_fs(struct file *filp, __u64 block_count)
23462349 return - EROFS ;
23472350 }
23482351
2349- f2fs_down_write (& sbi -> gc_lock );
2352+ f2fs_down_write_trace (& sbi -> gc_lock , & glc );
23502353 f2fs_down_write (& sbi -> cp_global_sem );
23512354
23522355 spin_lock (& sbi -> stat_lock );
@@ -2396,7 +2399,7 @@ int f2fs_resize_fs(struct file *filp, __u64 block_count)
23962399 }
23972400out_err :
23982401 f2fs_up_write (& sbi -> cp_global_sem );
2399- f2fs_up_write (& sbi -> gc_lock );
2402+ f2fs_up_write_trace (& sbi -> gc_lock , & glc );
24002403 thaw_super (sbi -> sb , FREEZE_HOLDER_KERNEL , NULL );
24012404 return err ;
24022405}
0 commit comments