Lines Matching refs:sbi
55 struct f2fs_sb_info *sbi, char *buf);
57 static unsigned char *__struct_ptr(struct f2fs_sb_info *sbi, int struct_type) in __struct_ptr() argument
60 return (unsigned char *)sbi->gc_thread; in __struct_ptr()
62 return (unsigned char *)SM_I(sbi); in __struct_ptr()
64 return (unsigned char *)SM_I(sbi)->dcc_info; in __struct_ptr()
66 return (unsigned char *)NM_I(sbi); in __struct_ptr()
68 return (unsigned char *)sbi; in __struct_ptr()
72 return (unsigned char *)&F2FS_OPTION(sbi).fault_info; in __struct_ptr()
76 return (unsigned char *)F2FS_STAT(sbi); in __struct_ptr()
79 return (unsigned char *)&sbi->cprc_info; in __struct_ptr()
81 return (unsigned char *)&sbi->am; in __struct_ptr()
86 struct f2fs_sb_info *sbi, char *buf) in dirty_segments_show() argument
89 (unsigned long long)(dirty_segments(sbi))); in dirty_segments_show()
93 struct f2fs_sb_info *sbi, char *buf) in free_segments_show() argument
96 (unsigned long long)(free_segments(sbi))); in free_segments_show()
100 struct f2fs_sb_info *sbi, char *buf) in ovp_segments_show() argument
103 (unsigned long long)(overprovision_segments(sbi))); in ovp_segments_show()
107 struct f2fs_sb_info *sbi, char *buf) in lifetime_write_kbytes_show() argument
110 (unsigned long long)(sbi->kbytes_written + in lifetime_write_kbytes_show()
111 ((f2fs_get_sectors_written(sbi) - in lifetime_write_kbytes_show()
112 sbi->sectors_written_start) >> 1))); in lifetime_write_kbytes_show()
116 struct f2fs_sb_info *sbi, char *buf) in sb_status_show() argument
118 return sprintf(buf, "%lx\n", sbi->s_flag); in sb_status_show()
122 struct f2fs_sb_info *sbi, char *buf) in features_show() argument
126 if (f2fs_sb_has_encrypt(sbi)) in features_show()
129 if (f2fs_sb_has_blkzoned(sbi)) in features_show()
132 if (f2fs_sb_has_extra_attr(sbi)) in features_show()
135 if (f2fs_sb_has_project_quota(sbi)) in features_show()
138 if (f2fs_sb_has_inode_chksum(sbi)) in features_show()
141 if (f2fs_sb_has_flexible_inline_xattr(sbi)) in features_show()
144 if (f2fs_sb_has_quota_ino(sbi)) in features_show()
147 if (f2fs_sb_has_inode_crtime(sbi)) in features_show()
150 if (f2fs_sb_has_lost_found(sbi)) in features_show()
153 if (f2fs_sb_has_verity(sbi)) in features_show()
156 if (f2fs_sb_has_sb_chksum(sbi)) in features_show()
159 if (f2fs_sb_has_casefold(sbi)) in features_show()
162 if (f2fs_sb_has_readonly(sbi)) in features_show()
165 if (f2fs_sb_has_compression(sbi)) in features_show()
175 struct f2fs_sb_info *sbi, char *buf) in current_reserved_blocks_show() argument
177 return sprintf(buf, "%u\n", sbi->current_reserved_blocks); in current_reserved_blocks_show()
181 struct f2fs_sb_info *sbi, char *buf) in unusable_show() argument
185 if (test_opt(sbi, DISABLE_CHECKPOINT)) in unusable_show()
186 unusable = sbi->unusable_block_count; in unusable_show()
188 unusable = f2fs_get_unusable_blocks(sbi); in unusable_show()
193 struct f2fs_sb_info *sbi, char *buf) in encoding_show() argument
196 struct super_block *sb = sbi->sb; in encoding_show()
198 if (f2fs_sb_has_casefold(sbi)) in encoding_show()
209 struct f2fs_sb_info *sbi, char *buf) in mounted_time_sec_show() argument
211 return sprintf(buf, "%llu", SIT_I(sbi)->mounted_time); in mounted_time_sec_show()
216 struct f2fs_sb_info *sbi, char *buf) in moved_blocks_foreground_show() argument
218 struct f2fs_stat_info *si = F2FS_STAT(sbi); in moved_blocks_foreground_show()
226 struct f2fs_sb_info *sbi, char *buf) in moved_blocks_background_show() argument
228 struct f2fs_stat_info *si = F2FS_STAT(sbi); in moved_blocks_background_show()
235 struct f2fs_sb_info *sbi, char *buf) in avg_vblocks_show() argument
237 struct f2fs_stat_info *si = F2FS_STAT(sbi); in avg_vblocks_show()
239 si->dirty_count = dirty_segments(sbi); in avg_vblocks_show()
240 f2fs_update_sit_info(sbi); in avg_vblocks_show()
246 struct f2fs_sb_info *sbi, char *buf) in main_blkaddr_show() argument
249 (unsigned long long)MAIN_BLKADDR(sbi)); in main_blkaddr_show()
253 struct f2fs_sb_info *sbi, char *buf) in f2fs_sbi_show() argument
258 ptr = __struct_ptr(sbi, a->struct_type); in f2fs_sbi_show()
264 sbi->raw_super->extension_list; in f2fs_sbi_show()
265 int cold_count = le32_to_cpu(sbi->raw_super->extension_count); in f2fs_sbi_show()
266 int hot_count = sbi->raw_super->hot_ext_count; in f2fs_sbi_show()
284 struct ckpt_req_control *cprc = &sbi->cprc_info; in f2fs_sbi_show()
302 return sysfs_emit(buf, "%llu\n", sbi->compr_written_block); in f2fs_sbi_show()
305 return sysfs_emit(buf, "%llu\n", sbi->compr_saved_block); in f2fs_sbi_show()
308 return sysfs_emit(buf, "%u\n", sbi->compr_new_inode); in f2fs_sbi_show()
312 return sysfs_emit(buf, "%u\n", sbi->gc_segment_mode); in f2fs_sbi_show()
316 sbi->gc_reclaimed_segs[sbi->gc_segment_mode]); in f2fs_sbi_show()
325 struct f2fs_sb_info *sbi, in __sbi_store() argument
333 ptr = __struct_ptr(sbi, a->struct_type); in __sbi_store()
358 down_write(&sbi->sb_lock); in __sbi_store()
360 ret = f2fs_update_extension_list(sbi, name, hot, set); in __sbi_store()
364 ret = f2fs_commit_super(sbi, false); in __sbi_store()
366 f2fs_update_extension_list(sbi, name, hot, !set); in __sbi_store()
368 up_write(&sbi->sb_lock); in __sbi_store()
374 struct ckpt_req_control *cprc = &sbi->cprc_info; in __sbi_store()
394 if (test_opt(sbi, MERGE_CHECKPOINT)) { in __sbi_store()
416 spin_lock(&sbi->stat_lock); in __sbi_store()
417 if (t > (unsigned long)(sbi->user_block_count - in __sbi_store()
418 F2FS_OPTION(sbi).root_reserved_blocks)) { in __sbi_store()
419 spin_unlock(&sbi->stat_lock); in __sbi_store()
423 sbi->current_reserved_blocks = min(sbi->reserved_blocks, in __sbi_store()
424 sbi->user_block_count - valid_user_blocks(sbi)); in __sbi_store()
425 spin_unlock(&sbi->stat_lock); in __sbi_store()
432 if (!f2fs_block_unit_discard(sbi)) in __sbi_store()
441 if (t == 0 || t > sbi->segs_per_sec) in __sbi_store()
450 sbi->gc_mode = GC_NORMAL; in __sbi_store()
452 sbi->gc_mode = GC_URGENT_HIGH; in __sbi_store()
453 if (sbi->gc_thread) { in __sbi_store()
454 sbi->gc_thread->gc_wake = 1; in __sbi_store()
456 &sbi->gc_thread->gc_wait_queue_head); in __sbi_store()
457 wake_up_discard_thread(sbi, true); in __sbi_store()
460 sbi->gc_mode = GC_URGENT_LOW; in __sbi_store()
468 sbi->gc_mode = GC_IDLE_CB; in __sbi_store()
470 sbi->gc_mode = GC_IDLE_GREEDY; in __sbi_store()
472 if (!sbi->am.atgc_enabled) in __sbi_store()
474 sbi->gc_mode = GC_AT; in __sbi_store()
476 sbi->gc_mode = GC_NORMAL; in __sbi_store()
483 sbi->iostat_enable = !!t; in __sbi_store()
484 if (!sbi->iostat_enable) in __sbi_store()
485 f2fs_reset_iostat(sbi); in __sbi_store()
492 spin_lock(&sbi->iostat_lock); in __sbi_store()
493 sbi->iostat_period_ms = (unsigned int)t; in __sbi_store()
494 spin_unlock(&sbi->iostat_lock); in __sbi_store()
504 sbi->compr_written_block = 0; in __sbi_store()
505 sbi->compr_saved_block = 0; in __sbi_store()
512 sbi->compr_new_inode = 0; in __sbi_store()
520 sbi->am.candidate_ratio = t; in __sbi_store()
527 sbi->am.age_weight = t; in __sbi_store()
533 sbi->gc_segment_mode = t; in __sbi_store()
542 sbi->gc_reclaimed_segs[sbi->gc_segment_mode] = 0; in __sbi_store()
548 sbi->seq_file_ra_mul = t; in __sbi_store()
556 sbi->max_fragment_chunk = t; in __sbi_store()
564 sbi->max_fragment_hole = t; in __sbi_store()
576 struct f2fs_sb_info *sbi, in f2fs_sbi_store() argument
584 if (!down_read_trylock(&sbi->sb->s_umount)) in f2fs_sbi_store()
587 ret = __sbi_store(a, sbi, buf, count); in f2fs_sbi_store()
589 up_read(&sbi->sb->s_umount); in f2fs_sbi_store()
597 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_attr_show() local
601 return a->show ? a->show(a, sbi, buf) : 0; in f2fs_attr_show()
607 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_attr_store() local
611 return a->store ? a->store(a, sbi, buf, len) : 0; in f2fs_attr_store()
616 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_sb_release() local
618 complete(&sbi->s_kobj_unregister); in f2fs_sb_release()
640 struct f2fs_sb_info *sbi, char *buf) in f2fs_feature_show() argument
652 struct f2fs_sb_info *sbi, char *buf) in f2fs_sb_feature_show() argument
654 if (F2FS_HAS_FEATURE(sbi, a->id)) in f2fs_sb_feature_show()
993 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_stat_attr_show() local
997 return a->show ? a->show(a, sbi, buf) : 0; in f2fs_stat_attr_show()
1003 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_stat_attr_store() local
1007 return a->store ? a->store(a, sbi, buf, len) : 0; in f2fs_stat_attr_store()
1012 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_stat_kobj_release() local
1014 complete(&sbi->s_stat_kobj_unregister); in f2fs_stat_kobj_release()
1031 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_sb_feat_attr_show() local
1035 return a->show ? a->show(a, sbi, buf) : 0; in f2fs_sb_feat_attr_show()
1040 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_feature_list_kobj_release() local
1042 complete(&sbi->s_feature_list_kobj_unregister); in f2fs_feature_list_kobj_release()
1059 struct f2fs_sb_info *sbi = F2FS_SB(sb); in segment_info_seq_show() local
1061 le32_to_cpu(sbi->raw_super->segment_count_main); in segment_info_seq_show()
1068 struct seg_entry *se = get_seg_entry(sbi, i); in segment_info_seq_show()
1086 struct f2fs_sb_info *sbi = F2FS_SB(sb); in segment_bits_seq_show() local
1088 le32_to_cpu(sbi->raw_super->segment_count_main); in segment_bits_seq_show()
1095 struct seg_entry *se = get_seg_entry(sbi, i); in segment_bits_seq_show()
1110 struct f2fs_sb_info *sbi = F2FS_SB(sb); in victim_bits_seq_show() local
1111 struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); in victim_bits_seq_show()
1116 for (i = 0; i < MAIN_SECS(sbi); i++) { in victim_bits_seq_show()
1120 if ((i % 10) == 9 || i == (MAIN_SECS(sbi) - 1)) in victim_bits_seq_show()
1157 int f2fs_register_sysfs(struct f2fs_sb_info *sbi) in f2fs_register_sysfs() argument
1159 struct super_block *sb = sbi->sb; in f2fs_register_sysfs()
1162 sbi->s_kobj.kset = &f2fs_kset; in f2fs_register_sysfs()
1163 init_completion(&sbi->s_kobj_unregister); in f2fs_register_sysfs()
1164 err = kobject_init_and_add(&sbi->s_kobj, &f2fs_sb_ktype, NULL, in f2fs_register_sysfs()
1169 sbi->s_stat_kobj.kset = &f2fs_kset; in f2fs_register_sysfs()
1170 init_completion(&sbi->s_stat_kobj_unregister); in f2fs_register_sysfs()
1171 err = kobject_init_and_add(&sbi->s_stat_kobj, &f2fs_stat_ktype, in f2fs_register_sysfs()
1172 &sbi->s_kobj, "stat"); in f2fs_register_sysfs()
1176 sbi->s_feature_list_kobj.kset = &f2fs_kset; in f2fs_register_sysfs()
1177 init_completion(&sbi->s_feature_list_kobj_unregister); in f2fs_register_sysfs()
1178 err = kobject_init_and_add(&sbi->s_feature_list_kobj, in f2fs_register_sysfs()
1180 &sbi->s_kobj, "feature_list"); in f2fs_register_sysfs()
1185 sbi->s_proc = proc_mkdir(sb->s_id, f2fs_proc_root); in f2fs_register_sysfs()
1187 if (sbi->s_proc) { in f2fs_register_sysfs()
1188 proc_create_single_data("segment_info", 0444, sbi->s_proc, in f2fs_register_sysfs()
1190 proc_create_single_data("segment_bits", 0444, sbi->s_proc, in f2fs_register_sysfs()
1193 proc_create_single_data("iostat_info", 0444, sbi->s_proc, in f2fs_register_sysfs()
1196 proc_create_single_data("victim_bits", 0444, sbi->s_proc, in f2fs_register_sysfs()
1201 kobject_put(&sbi->s_feature_list_kobj); in f2fs_register_sysfs()
1202 wait_for_completion(&sbi->s_feature_list_kobj_unregister); in f2fs_register_sysfs()
1204 kobject_put(&sbi->s_stat_kobj); in f2fs_register_sysfs()
1205 wait_for_completion(&sbi->s_stat_kobj_unregister); in f2fs_register_sysfs()
1207 kobject_put(&sbi->s_kobj); in f2fs_register_sysfs()
1208 wait_for_completion(&sbi->s_kobj_unregister); in f2fs_register_sysfs()
1212 void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi) in f2fs_unregister_sysfs() argument
1214 if (sbi->s_proc) { in f2fs_unregister_sysfs()
1216 remove_proc_entry("iostat_info", sbi->s_proc); in f2fs_unregister_sysfs()
1218 remove_proc_entry("segment_info", sbi->s_proc); in f2fs_unregister_sysfs()
1219 remove_proc_entry("segment_bits", sbi->s_proc); in f2fs_unregister_sysfs()
1220 remove_proc_entry("victim_bits", sbi->s_proc); in f2fs_unregister_sysfs()
1221 remove_proc_entry(sbi->sb->s_id, f2fs_proc_root); in f2fs_unregister_sysfs()
1224 kobject_del(&sbi->s_stat_kobj); in f2fs_unregister_sysfs()
1225 kobject_put(&sbi->s_stat_kobj); in f2fs_unregister_sysfs()
1226 wait_for_completion(&sbi->s_stat_kobj_unregister); in f2fs_unregister_sysfs()
1227 kobject_del(&sbi->s_feature_list_kobj); in f2fs_unregister_sysfs()
1228 kobject_put(&sbi->s_feature_list_kobj); in f2fs_unregister_sysfs()
1229 wait_for_completion(&sbi->s_feature_list_kobj_unregister); in f2fs_unregister_sysfs()
1231 kobject_del(&sbi->s_kobj); in f2fs_unregister_sysfs()
1232 kobject_put(&sbi->s_kobj); in f2fs_unregister_sysfs()
1233 wait_for_completion(&sbi->s_kobj_unregister); in f2fs_unregister_sysfs()