21
21
#include "gc.h"
22
22
23
23
static LIST_HEAD (f2fs_stat_list );
24
- static DEFINE_MUTEX ( f2fs_stat_mutex );
24
+ static DEFINE_RAW_SPINLOCK ( f2fs_stat_lock );
25
25
#ifdef CONFIG_DEBUG_FS
26
26
static struct dentry * f2fs_debugfs_root ;
27
27
#endif
@@ -345,8 +345,9 @@ static int stat_show(struct seq_file *s, void *v)
345
345
{
346
346
struct f2fs_stat_info * si ;
347
347
int i = 0 , j = 0 ;
348
+ unsigned long flags ;
348
349
349
- mutex_lock ( & f2fs_stat_mutex );
350
+ raw_spin_lock_irqsave ( & f2fs_stat_lock , flags );
350
351
list_for_each_entry (si , & f2fs_stat_list , stat_list ) {
351
352
update_general_status (si -> sbi );
352
353
@@ -577,7 +578,7 @@ static int stat_show(struct seq_file *s, void *v)
577
578
seq_printf (s , " - paged : %llu KB\n" ,
578
579
si -> page_mem >> 10 );
579
580
}
580
- mutex_unlock ( & f2fs_stat_mutex );
581
+ raw_spin_unlock_irqrestore ( & f2fs_stat_lock , flags );
581
582
return 0 ;
582
583
}
583
584
@@ -588,6 +589,7 @@ int f2fs_build_stats(struct f2fs_sb_info *sbi)
588
589
{
589
590
struct f2fs_super_block * raw_super = F2FS_RAW_SUPER (sbi );
590
591
struct f2fs_stat_info * si ;
592
+ unsigned long flags ;
591
593
int i ;
592
594
593
595
si = f2fs_kzalloc (sbi , sizeof (struct f2fs_stat_info ), GFP_KERNEL );
@@ -623,20 +625,21 @@ int f2fs_build_stats(struct f2fs_sb_info *sbi)
623
625
atomic_set (& sbi -> max_aw_cnt , 0 );
624
626
atomic_set (& sbi -> max_vw_cnt , 0 );
625
627
626
- mutex_lock ( & f2fs_stat_mutex );
628
+ raw_spin_lock_irqsave ( & f2fs_stat_lock , flags );
627
629
list_add_tail (& si -> stat_list , & f2fs_stat_list );
628
- mutex_unlock ( & f2fs_stat_mutex );
630
+ raw_spin_unlock_irqrestore ( & f2fs_stat_lock , flags );
629
631
630
632
return 0 ;
631
633
}
632
634
633
635
void f2fs_destroy_stats (struct f2fs_sb_info * sbi )
634
636
{
635
637
struct f2fs_stat_info * si = F2FS_STAT (sbi );
638
+ unsigned long flags ;
636
639
637
- mutex_lock ( & f2fs_stat_mutex );
640
+ raw_spin_lock_irqsave ( & f2fs_stat_lock , flags );
638
641
list_del (& si -> stat_list );
639
- mutex_unlock ( & f2fs_stat_mutex );
642
+ raw_spin_unlock_irqrestore ( & f2fs_stat_lock , flags );
640
643
641
644
kfree (si );
642
645
}
0 commit comments