Lines Matching refs:sbi
65 struct f2fs_sb_info *sbi, char *buf);
67 static unsigned char *__struct_ptr(struct f2fs_sb_info *sbi, int struct_type) in __struct_ptr() argument
70 return (unsigned char *)sbi->gc_thread; in __struct_ptr()
72 return (unsigned char *)SM_I(sbi); in __struct_ptr()
74 return (unsigned char *)SM_I(sbi)->dcc_info; in __struct_ptr()
76 return (unsigned char *)NM_I(sbi); in __struct_ptr()
78 return (unsigned char *)sbi; in __struct_ptr()
82 return (unsigned char *)&F2FS_OPTION(sbi).fault_info; in __struct_ptr()
86 return (unsigned char *)F2FS_STAT(sbi); in __struct_ptr()
89 return (unsigned char *)&sbi->cprc_info; in __struct_ptr()
91 return (unsigned char *)&sbi->am; in __struct_ptr()
96 struct f2fs_sb_info *sbi, char *buf) in dirty_segments_show() argument
99 (unsigned long long)(dirty_segments(sbi))); in dirty_segments_show()
103 struct f2fs_sb_info *sbi, char *buf) in free_segments_show() argument
106 (unsigned long long)(free_segments(sbi))); in free_segments_show()
110 struct f2fs_sb_info *sbi, char *buf) in ovp_segments_show() argument
113 (unsigned long long)(overprovision_segments(sbi))); in ovp_segments_show()
117 struct f2fs_sb_info *sbi, char *buf) in lifetime_write_kbytes_show() argument
120 (unsigned long long)(sbi->kbytes_written + in lifetime_write_kbytes_show()
121 ((f2fs_get_sectors_written(sbi) - in lifetime_write_kbytes_show()
122 sbi->sectors_written_start) >> 1))); in lifetime_write_kbytes_show()
126 struct f2fs_sb_info *sbi, char *buf) in sb_status_show() argument
128 return sprintf(buf, "%lx\n", sbi->s_flag); in sb_status_show()
132 struct f2fs_sb_info *sbi, char *buf) in cp_status_show() argument
134 return sprintf(buf, "%x\n", le32_to_cpu(F2FS_CKPT(sbi)->ckpt_flags)); in cp_status_show()
138 struct f2fs_sb_info *sbi, char *buf) in pending_discard_show() argument
140 if (!SM_I(sbi)->dcc_info) in pending_discard_show()
143 &SM_I(sbi)->dcc_info->discard_cmd_cnt)); in pending_discard_show()
147 struct f2fs_sb_info *sbi, char *buf) in features_show() argument
151 if (f2fs_sb_has_encrypt(sbi)) in features_show()
154 if (f2fs_sb_has_blkzoned(sbi)) in features_show()
157 if (f2fs_sb_has_extra_attr(sbi)) in features_show()
160 if (f2fs_sb_has_project_quota(sbi)) in features_show()
163 if (f2fs_sb_has_inode_chksum(sbi)) in features_show()
166 if (f2fs_sb_has_flexible_inline_xattr(sbi)) in features_show()
169 if (f2fs_sb_has_quota_ino(sbi)) in features_show()
172 if (f2fs_sb_has_inode_crtime(sbi)) in features_show()
175 if (f2fs_sb_has_lost_found(sbi)) in features_show()
178 if (f2fs_sb_has_verity(sbi)) in features_show()
181 if (f2fs_sb_has_sb_chksum(sbi)) in features_show()
184 if (f2fs_sb_has_casefold(sbi)) in features_show()
187 if (f2fs_sb_has_readonly(sbi)) in features_show()
190 if (f2fs_sb_has_compression(sbi)) in features_show()
200 struct f2fs_sb_info *sbi, char *buf) in current_reserved_blocks_show() argument
202 return sprintf(buf, "%u\n", sbi->current_reserved_blocks); in current_reserved_blocks_show()
206 struct f2fs_sb_info *sbi, char *buf) in unusable_show() argument
210 if (test_opt(sbi, DISABLE_CHECKPOINT)) in unusable_show()
211 unusable = sbi->unusable_block_count; in unusable_show()
213 unusable = f2fs_get_unusable_blocks(sbi); in unusable_show()
218 struct f2fs_sb_info *sbi, char *buf) in encoding_show() argument
221 struct super_block *sb = sbi->sb; in encoding_show()
223 if (f2fs_sb_has_casefold(sbi)) in encoding_show()
233 struct f2fs_sb_info *sbi, char *buf) in mounted_time_sec_show() argument
235 return sprintf(buf, "%llu", SIT_I(sbi)->mounted_time); in mounted_time_sec_show()
240 struct f2fs_sb_info *sbi, char *buf) in moved_blocks_foreground_show() argument
242 struct f2fs_stat_info *si = F2FS_STAT(sbi); in moved_blocks_foreground_show()
250 struct f2fs_sb_info *sbi, char *buf) in moved_blocks_background_show() argument
252 struct f2fs_stat_info *si = F2FS_STAT(sbi); in moved_blocks_background_show()
259 struct f2fs_sb_info *sbi, char *buf) in avg_vblocks_show() argument
261 struct f2fs_stat_info *si = F2FS_STAT(sbi); in avg_vblocks_show()
263 si->dirty_count = dirty_segments(sbi); in avg_vblocks_show()
264 f2fs_update_sit_info(sbi); in avg_vblocks_show()
270 struct f2fs_sb_info *sbi, char *buf) in main_blkaddr_show() argument
273 (unsigned long long)MAIN_BLKADDR(sbi)); in main_blkaddr_show()
277 struct f2fs_sb_info *sbi, char *buf) in f2fs_sbi_show() argument
282 ptr = __struct_ptr(sbi, a->struct_type); in f2fs_sbi_show()
288 sbi->raw_super->extension_list; in f2fs_sbi_show()
289 int cold_count = le32_to_cpu(sbi->raw_super->extension_count); in f2fs_sbi_show()
290 int hot_count = sbi->raw_super->hot_ext_count; in f2fs_sbi_show()
308 struct ckpt_req_control *cprc = &sbi->cprc_info; in f2fs_sbi_show()
326 return sysfs_emit(buf, "%llu\n", sbi->compr_written_block); in f2fs_sbi_show()
329 return sysfs_emit(buf, "%llu\n", sbi->compr_saved_block); in f2fs_sbi_show()
332 return sysfs_emit(buf, "%u\n", sbi->compr_new_inode); in f2fs_sbi_show()
337 gc_mode_names[sbi->gc_mode]); in f2fs_sbi_show()
341 gc_mode_names[sbi->gc_segment_mode]); in f2fs_sbi_show()
345 sbi->gc_reclaimed_segs[sbi->gc_segment_mode]); in f2fs_sbi_show()
349 s64 current_write = atomic64_read(&sbi->current_atomic_write); in f2fs_sbi_show()
355 return sysfs_emit(buf, "%lld\n", sbi->peak_atomic_write); in f2fs_sbi_show()
358 return sysfs_emit(buf, "%llu\n", sbi->committed_atomic_block); in f2fs_sbi_show()
361 return sysfs_emit(buf, "%llu\n", sbi->revoked_atomic_block); in f2fs_sbi_show()
369 struct f2fs_sb_info *sbi, in __sbi_store() argument
377 ptr = __struct_ptr(sbi, a->struct_type); in __sbi_store()
402 f2fs_down_write(&sbi->sb_lock); in __sbi_store()
404 ret = f2fs_update_extension_list(sbi, name, hot, set); in __sbi_store()
408 ret = f2fs_commit_super(sbi, false); in __sbi_store()
410 f2fs_update_extension_list(sbi, name, hot, !set); in __sbi_store()
412 f2fs_up_write(&sbi->sb_lock); in __sbi_store()
418 struct ckpt_req_control *cprc = &sbi->cprc_info; in __sbi_store()
438 if (test_opt(sbi, MERGE_CHECKPOINT)) { in __sbi_store()
460 spin_lock(&sbi->stat_lock); in __sbi_store()
461 if (t > (unsigned long)(sbi->user_block_count - in __sbi_store()
462 F2FS_OPTION(sbi).root_reserved_blocks - in __sbi_store()
463 sbi->blocks_per_seg * in __sbi_store()
464 SM_I(sbi)->additional_reserved_segments)) { in __sbi_store()
465 spin_unlock(&sbi->stat_lock); in __sbi_store()
469 sbi->current_reserved_blocks = min(sbi->reserved_blocks, in __sbi_store()
470 sbi->user_block_count - valid_user_blocks(sbi)); in __sbi_store()
471 spin_unlock(&sbi->stat_lock); in __sbi_store()
478 if (!f2fs_block_unit_discard(sbi)) in __sbi_store()
487 if (t == 0 || t > sbi->segs_per_sec) in __sbi_store()
496 sbi->gc_mode = GC_NORMAL; in __sbi_store()
498 sbi->gc_mode = GC_URGENT_HIGH; in __sbi_store()
499 if (sbi->gc_thread) { in __sbi_store()
500 sbi->gc_thread->gc_wake = 1; in __sbi_store()
502 &sbi->gc_thread->gc_wait_queue_head); in __sbi_store()
503 wake_up_discard_thread(sbi, true); in __sbi_store()
506 sbi->gc_mode = GC_URGENT_LOW; in __sbi_store()
508 sbi->gc_mode = GC_URGENT_MID; in __sbi_store()
509 if (sbi->gc_thread) { in __sbi_store()
510 sbi->gc_thread->gc_wake = 1; in __sbi_store()
512 &sbi->gc_thread->gc_wait_queue_head); in __sbi_store()
521 sbi->gc_mode = GC_IDLE_CB; in __sbi_store()
523 sbi->gc_mode = GC_IDLE_GREEDY; in __sbi_store()
525 if (!sbi->am.atgc_enabled) in __sbi_store()
527 sbi->gc_mode = GC_IDLE_AT; in __sbi_store()
529 sbi->gc_mode = GC_NORMAL; in __sbi_store()
535 spin_lock(&sbi->gc_urgent_high_lock); in __sbi_store()
536 sbi->gc_urgent_high_remaining = t; in __sbi_store()
537 spin_unlock(&sbi->gc_urgent_high_lock); in __sbi_store()
544 sbi->iostat_enable = !!t; in __sbi_store()
545 if (!sbi->iostat_enable) in __sbi_store()
546 f2fs_reset_iostat(sbi); in __sbi_store()
553 spin_lock(&sbi->iostat_lock); in __sbi_store()
554 sbi->iostat_period_ms = (unsigned int)t; in __sbi_store()
555 spin_unlock(&sbi->iostat_lock); in __sbi_store()
565 sbi->compr_written_block = 0; in __sbi_store()
566 sbi->compr_saved_block = 0; in __sbi_store()
573 sbi->compr_new_inode = 0; in __sbi_store()
581 sbi->am.candidate_ratio = t; in __sbi_store()
588 sbi->am.age_weight = t; in __sbi_store()
594 sbi->gc_segment_mode = t; in __sbi_store()
603 sbi->gc_reclaimed_segs[sbi->gc_segment_mode] = 0; in __sbi_store()
609 sbi->seq_file_ra_mul = t; in __sbi_store()
617 sbi->max_fragment_chunk = t; in __sbi_store()
625 sbi->max_fragment_hole = t; in __sbi_store()
634 sbi->peak_atomic_write = 0; in __sbi_store()
641 sbi->committed_atomic_block = 0; in __sbi_store()
648 sbi->revoked_atomic_block = 0; in __sbi_store()
658 struct f2fs_sb_info *sbi, in f2fs_sbi_store() argument
666 if (!down_read_trylock(&sbi->sb->s_umount)) in f2fs_sbi_store()
669 ret = __sbi_store(a, sbi, buf, count); in f2fs_sbi_store()
671 up_read(&sbi->sb->s_umount); in f2fs_sbi_store()
679 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_attr_show() local
683 return a->show ? a->show(a, sbi, buf) : 0; in f2fs_attr_show()
689 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_attr_store() local
693 return a->store ? a->store(a, sbi, buf, len) : 0; in f2fs_attr_store()
698 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_sb_release() local
700 complete(&sbi->s_kobj_unregister); in f2fs_sb_release()
722 struct f2fs_sb_info *sbi, char *buf) in f2fs_feature_show() argument
734 struct f2fs_sb_info *sbi, char *buf) in f2fs_sb_feature_show() argument
736 if (F2FS_HAS_FEATURE(sbi, a->id)) in f2fs_sb_feature_show()
1111 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_stat_attr_show() local
1115 return a->show ? a->show(a, sbi, buf) : 0; in f2fs_stat_attr_show()
1121 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_stat_attr_store() local
1125 return a->store ? a->store(a, sbi, buf, len) : 0; in f2fs_stat_attr_store()
1130 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_stat_kobj_release() local
1132 complete(&sbi->s_stat_kobj_unregister); in f2fs_stat_kobj_release()
1149 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_sb_feat_attr_show() local
1153 return a->show ? a->show(a, sbi, buf) : 0; in f2fs_sb_feat_attr_show()
1158 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_feature_list_kobj_release() local
1160 complete(&sbi->s_feature_list_kobj_unregister); in f2fs_feature_list_kobj_release()
1177 struct f2fs_sb_info *sbi = F2FS_SB(sb); in segment_info_seq_show() local
1179 le32_to_cpu(sbi->raw_super->segment_count_main); in segment_info_seq_show()
1186 struct seg_entry *se = get_seg_entry(sbi, i); in segment_info_seq_show()
1204 struct f2fs_sb_info *sbi = F2FS_SB(sb); in segment_bits_seq_show() local
1206 le32_to_cpu(sbi->raw_super->segment_count_main); in segment_bits_seq_show()
1213 struct seg_entry *se = get_seg_entry(sbi, i); in segment_bits_seq_show()
1228 struct f2fs_sb_info *sbi = F2FS_SB(sb); in victim_bits_seq_show() local
1229 struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); in victim_bits_seq_show()
1234 for (i = 0; i < MAIN_SECS(sbi); i++) { in victim_bits_seq_show()
1238 if ((i % 10) == 9 || i == (MAIN_SECS(sbi) - 1)) in victim_bits_seq_show()
1275 int f2fs_register_sysfs(struct f2fs_sb_info *sbi) in f2fs_register_sysfs() argument
1277 struct super_block *sb = sbi->sb; in f2fs_register_sysfs()
1280 sbi->s_kobj.kset = &f2fs_kset; in f2fs_register_sysfs()
1281 init_completion(&sbi->s_kobj_unregister); in f2fs_register_sysfs()
1282 err = kobject_init_and_add(&sbi->s_kobj, &f2fs_sb_ktype, NULL, in f2fs_register_sysfs()
1287 sbi->s_stat_kobj.kset = &f2fs_kset; in f2fs_register_sysfs()
1288 init_completion(&sbi->s_stat_kobj_unregister); in f2fs_register_sysfs()
1289 err = kobject_init_and_add(&sbi->s_stat_kobj, &f2fs_stat_ktype, in f2fs_register_sysfs()
1290 &sbi->s_kobj, "stat"); in f2fs_register_sysfs()
1294 sbi->s_feature_list_kobj.kset = &f2fs_kset; in f2fs_register_sysfs()
1295 init_completion(&sbi->s_feature_list_kobj_unregister); in f2fs_register_sysfs()
1296 err = kobject_init_and_add(&sbi->s_feature_list_kobj, in f2fs_register_sysfs()
1298 &sbi->s_kobj, "feature_list"); in f2fs_register_sysfs()
1303 sbi->s_proc = proc_mkdir(sb->s_id, f2fs_proc_root); in f2fs_register_sysfs()
1305 if (sbi->s_proc) { in f2fs_register_sysfs()
1306 proc_create_single_data("segment_info", 0444, sbi->s_proc, in f2fs_register_sysfs()
1308 proc_create_single_data("segment_bits", 0444, sbi->s_proc, in f2fs_register_sysfs()
1311 proc_create_single_data("iostat_info", 0444, sbi->s_proc, in f2fs_register_sysfs()
1314 proc_create_single_data("victim_bits", 0444, sbi->s_proc, in f2fs_register_sysfs()
1319 kobject_put(&sbi->s_feature_list_kobj); in f2fs_register_sysfs()
1320 wait_for_completion(&sbi->s_feature_list_kobj_unregister); in f2fs_register_sysfs()
1322 kobject_put(&sbi->s_stat_kobj); in f2fs_register_sysfs()
1323 wait_for_completion(&sbi->s_stat_kobj_unregister); in f2fs_register_sysfs()
1325 kobject_put(&sbi->s_kobj); in f2fs_register_sysfs()
1326 wait_for_completion(&sbi->s_kobj_unregister); in f2fs_register_sysfs()
1330 void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi) in f2fs_unregister_sysfs() argument
1332 if (sbi->s_proc) { in f2fs_unregister_sysfs()
1334 remove_proc_entry("iostat_info", sbi->s_proc); in f2fs_unregister_sysfs()
1336 remove_proc_entry("segment_info", sbi->s_proc); in f2fs_unregister_sysfs()
1337 remove_proc_entry("segment_bits", sbi->s_proc); in f2fs_unregister_sysfs()
1338 remove_proc_entry("victim_bits", sbi->s_proc); in f2fs_unregister_sysfs()
1339 remove_proc_entry(sbi->sb->s_id, f2fs_proc_root); in f2fs_unregister_sysfs()
1342 kobject_del(&sbi->s_stat_kobj); in f2fs_unregister_sysfs()
1343 kobject_put(&sbi->s_stat_kobj); in f2fs_unregister_sysfs()
1344 wait_for_completion(&sbi->s_stat_kobj_unregister); in f2fs_unregister_sysfs()
1345 kobject_del(&sbi->s_feature_list_kobj); in f2fs_unregister_sysfs()
1346 kobject_put(&sbi->s_feature_list_kobj); in f2fs_unregister_sysfs()
1347 wait_for_completion(&sbi->s_feature_list_kobj_unregister); in f2fs_unregister_sysfs()
1349 kobject_del(&sbi->s_kobj); in f2fs_unregister_sysfs()
1350 kobject_put(&sbi->s_kobj); in f2fs_unregister_sysfs()
1351 wait_for_completion(&sbi->s_kobj_unregister); in f2fs_unregister_sysfs()