Lines Matching full:sbi

56 	ssize_t (*show)(struct f2fs_attr *a, struct f2fs_sb_info *sbi, char *buf);
57 ssize_t (*store)(struct f2fs_attr *a, struct f2fs_sb_info *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 sysfs_emit(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 sysfs_emit(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 gc_mode_show() argument
149 return sysfs_emit(buf, "%s\n", gc_mode_names[sbi->gc_mode]); in gc_mode_show()
153 struct f2fs_sb_info *sbi, char *buf) in features_show() argument
157 if (f2fs_sb_has_encrypt(sbi)) in features_show()
160 if (f2fs_sb_has_blkzoned(sbi)) in features_show()
163 if (f2fs_sb_has_extra_attr(sbi)) in features_show()
166 if (f2fs_sb_has_project_quota(sbi)) in features_show()
169 if (f2fs_sb_has_inode_chksum(sbi)) in features_show()
172 if (f2fs_sb_has_flexible_inline_xattr(sbi)) in features_show()
175 if (f2fs_sb_has_quota_ino(sbi)) in features_show()
178 if (f2fs_sb_has_inode_crtime(sbi)) in features_show()
181 if (f2fs_sb_has_lost_found(sbi)) in features_show()
184 if (f2fs_sb_has_verity(sbi)) in features_show()
187 if (f2fs_sb_has_sb_chksum(sbi)) in features_show()
190 if (f2fs_sb_has_casefold(sbi)) in features_show()
193 if (f2fs_sb_has_readonly(sbi)) in features_show()
196 if (f2fs_sb_has_compression(sbi)) in features_show()
206 struct f2fs_sb_info *sbi, char *buf) in current_reserved_blocks_show() argument
208 return sysfs_emit(buf, "%u\n", sbi->current_reserved_blocks); in current_reserved_blocks_show()
212 struct f2fs_sb_info *sbi, char *buf) in unusable_show() argument
216 if (test_opt(sbi, DISABLE_CHECKPOINT)) in unusable_show()
217 unusable = sbi->unusable_block_count; in unusable_show()
219 unusable = f2fs_get_unusable_blocks(sbi); in unusable_show()
224 struct f2fs_sb_info *sbi, char *buf) in encoding_show() argument
227 struct super_block *sb = sbi->sb; in encoding_show()
229 if (f2fs_sb_has_casefold(sbi)) in encoding_show()
239 struct f2fs_sb_info *sbi, char *buf) in mounted_time_sec_show() argument
241 return sysfs_emit(buf, "%llu\n", SIT_I(sbi)->mounted_time); in mounted_time_sec_show()
246 struct f2fs_sb_info *sbi, char *buf) in moved_blocks_foreground_show() argument
248 struct f2fs_stat_info *si = F2FS_STAT(sbi); in moved_blocks_foreground_show()
256 struct f2fs_sb_info *sbi, char *buf) in moved_blocks_background_show() argument
258 struct f2fs_stat_info *si = F2FS_STAT(sbi); in moved_blocks_background_show()
265 struct f2fs_sb_info *sbi, char *buf) in avg_vblocks_show() argument
267 struct f2fs_stat_info *si = F2FS_STAT(sbi); in avg_vblocks_show()
269 si->dirty_count = dirty_segments(sbi); in avg_vblocks_show()
270 f2fs_update_sit_info(sbi); in avg_vblocks_show()
276 struct f2fs_sb_info *sbi, char *buf) in main_blkaddr_show() argument
279 (unsigned long long)MAIN_BLKADDR(sbi)); in main_blkaddr_show()
283 struct f2fs_sb_info *sbi, char *buf) in f2fs_sbi_show() argument
288 ptr = __struct_ptr(sbi, a->struct_type); in f2fs_sbi_show()
294 sbi->raw_super->extension_list; in f2fs_sbi_show()
295 int cold_count = le32_to_cpu(sbi->raw_super->extension_count); in f2fs_sbi_show()
296 int hot_count = sbi->raw_super->hot_ext_count; in f2fs_sbi_show()
314 struct ckpt_req_control *cprc = &sbi->cprc_info; in f2fs_sbi_show()
327 return sysfs_emit(buf, "%llu\n", sbi->compr_written_block); in f2fs_sbi_show()
330 return sysfs_emit(buf, "%llu\n", sbi->compr_saved_block); in f2fs_sbi_show()
333 return sysfs_emit(buf, "%u\n", sbi->compr_new_inode); in f2fs_sbi_show()
337 return sysfs_emit(buf, "%u\n", sbi->gc_segment_mode); in f2fs_sbi_show()
341 sbi->gc_reclaimed_segs[sbi->gc_segment_mode]); in f2fs_sbi_show()
345 s64 current_write = atomic64_read(&sbi->current_atomic_write); in f2fs_sbi_show()
351 return sysfs_emit(buf, "%lld\n", sbi->peak_atomic_write); in f2fs_sbi_show()
354 return sysfs_emit(buf, "%llu\n", sbi->committed_atomic_block); in f2fs_sbi_show()
357 return sysfs_emit(buf, "%llu\n", sbi->revoked_atomic_block); in f2fs_sbi_show()
362 atomic_read(&sbi->cp_call_count[TOTAL_CALL]) - in f2fs_sbi_show()
363 atomic_read(&sbi->cp_call_count[BACKGROUND])); in f2fs_sbi_show()
366 atomic_read(&sbi->cp_call_count[BACKGROUND])); in f2fs_sbi_show()
375 struct f2fs_sb_info *sbi, in __sbi_store() argument
383 ptr = __struct_ptr(sbi, a->struct_type); in __sbi_store()
408 f2fs_down_write(&sbi->sb_lock); in __sbi_store()
410 ret = f2fs_update_extension_list(sbi, name, hot, set); in __sbi_store()
414 ret = f2fs_commit_super(sbi, false); in __sbi_store()
416 f2fs_update_extension_list(sbi, name, hot, !set); in __sbi_store()
418 f2fs_up_write(&sbi->sb_lock); in __sbi_store()
424 struct ckpt_req_control *cprc = &sbi->cprc_info; in __sbi_store()
444 if (test_opt(sbi, MERGE_CHECKPOINT)) { in __sbi_store()
461 if (f2fs_build_fault_attr(sbi, 0, t)) in __sbi_store()
466 if (f2fs_build_fault_attr(sbi, t, 0)) in __sbi_store()
472 spin_lock(&sbi->stat_lock); in __sbi_store()
473 if (t > (unsigned long)(sbi->user_block_count - in __sbi_store()
474 F2FS_OPTION(sbi).root_reserved_blocks - in __sbi_store()
475 (SM_I(sbi)->additional_reserved_segments << in __sbi_store()
476 sbi->log_blocks_per_seg))) { in __sbi_store()
477 spin_unlock(&sbi->stat_lock); in __sbi_store()
481 sbi->current_reserved_blocks = min(sbi->reserved_blocks, in __sbi_store()
482 sbi->user_block_count - valid_user_blocks(sbi)); in __sbi_store()
483 spin_unlock(&sbi->stat_lock); in __sbi_store()
490 if (!f2fs_block_unit_discard(sbi)) in __sbi_store()
501 if (!f2fs_block_unit_discard(sbi)) in __sbi_store()
512 if (!f2fs_block_unit_discard(sbi)) in __sbi_store()
526 if (t == 0 || t > SEGS_PER_SEC(sbi)) in __sbi_store()
532 sbi->gc_mode = GC_NORMAL; in __sbi_store()
534 sbi->gc_mode = GC_URGENT_HIGH; in __sbi_store()
535 if (sbi->gc_thread) { in __sbi_store()
536 sbi->gc_thread->gc_wake = true; in __sbi_store()
538 &sbi->gc_thread->gc_wait_queue_head); in __sbi_store()
539 wake_up_discard_thread(sbi, true); in __sbi_store()
542 sbi->gc_mode = GC_URGENT_LOW; in __sbi_store()
544 sbi->gc_mode = GC_URGENT_MID; in __sbi_store()
545 if (sbi->gc_thread) { in __sbi_store()
546 sbi->gc_thread->gc_wake = true; in __sbi_store()
548 &sbi->gc_thread->gc_wait_queue_head); in __sbi_store()
557 sbi->gc_mode = GC_IDLE_CB; in __sbi_store()
559 sbi->gc_mode = GC_IDLE_GREEDY; in __sbi_store()
561 if (!sbi->am.atgc_enabled) in __sbi_store()
563 sbi->gc_mode = GC_IDLE_AT; in __sbi_store()
565 sbi->gc_mode = GC_NORMAL; in __sbi_store()
571 spin_lock(&sbi->gc_remaining_trials_lock); in __sbi_store()
572 sbi->gc_remaining_trials = t; in __sbi_store()
573 spin_unlock(&sbi->gc_remaining_trials_lock); in __sbi_store()
580 sbi->iostat_enable = !!t; in __sbi_store()
581 if (!sbi->iostat_enable) in __sbi_store()
582 f2fs_reset_iostat(sbi); in __sbi_store()
589 spin_lock_irq(&sbi->iostat_lock); in __sbi_store()
590 sbi->iostat_period_ms = (unsigned int)t; in __sbi_store()
591 spin_unlock_irq(&sbi->iostat_lock); in __sbi_store()
601 sbi->compr_written_block = 0; in __sbi_store()
602 sbi->compr_saved_block = 0; in __sbi_store()
609 sbi->compr_new_inode = 0; in __sbi_store()
631 sbi->am.candidate_ratio = t; in __sbi_store()
638 sbi->am.age_weight = t; in __sbi_store()
644 sbi->gc_segment_mode = t; in __sbi_store()
653 sbi->gc_reclaimed_segs[sbi->gc_segment_mode] = 0; in __sbi_store()
659 sbi->seq_file_ra_mul = t; in __sbi_store()
667 sbi->max_fragment_chunk = t; in __sbi_store()
675 sbi->max_fragment_hole = t; in __sbi_store()
684 sbi->peak_atomic_write = 0; in __sbi_store()
691 sbi->committed_atomic_block = 0; in __sbi_store()
698 sbi->revoked_atomic_block = 0; in __sbi_store()
703 sbi->readdir_ra = !!t; in __sbi_store()
708 if (t == 0 || t >= sbi->warm_data_age_threshold) in __sbi_store()
717 if (t <= sbi->hot_data_age_threshold) in __sbi_store()
737 if (t && f2fs_lfs_mode(sbi)) in __sbi_store()
739 SM_I(sbi)->ipu_policy = (unsigned int)t; in __sbi_store()
749 struct f2fs_sb_info *sbi, in f2fs_sbi_store() argument
757 if (!down_read_trylock(&sbi->sb->s_umount)) in f2fs_sbi_store()
760 ret = __sbi_store(a, sbi, buf, count); in f2fs_sbi_store()
762 up_read(&sbi->sb->s_umount); in f2fs_sbi_store()
770 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_attr_show() local
774 return a->show ? a->show(a, sbi, buf) : 0; in f2fs_attr_show()
780 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_attr_store() local
784 return a->store ? a->store(a, sbi, buf, len) : 0; in f2fs_attr_store()
789 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_sb_release() local
791 complete(&sbi->s_kobj_unregister); in f2fs_sb_release()
813 struct f2fs_sb_info *sbi, char *buf) in f2fs_feature_show() argument
825 struct f2fs_sb_info *sbi, char *buf) in f2fs_sb_feature_show() argument
827 if (F2FS_HAS_FEATURE(sbi, a->id)) in f2fs_sb_feature_show()
1278 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_stat_attr_show() local
1282 return a->show ? a->show(a, sbi, buf) : 0; in f2fs_stat_attr_show()
1288 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_stat_attr_store() local
1292 return a->store ? a->store(a, sbi, buf, len) : 0; in f2fs_stat_attr_store()
1297 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_stat_kobj_release() local
1299 complete(&sbi->s_stat_kobj_unregister); in f2fs_stat_kobj_release()
1316 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_sb_feat_attr_show() local
1320 return a->show ? a->show(a, sbi, buf) : 0; in f2fs_sb_feat_attr_show()
1325 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_feature_list_kobj_release() local
1327 complete(&sbi->s_feature_list_kobj_unregister); in f2fs_feature_list_kobj_release()
1344 struct f2fs_sb_info *sbi = F2FS_SB(sb); in segment_info_seq_show() local
1346 le32_to_cpu(sbi->raw_super->segment_count_main); in segment_info_seq_show()
1353 struct seg_entry *se = get_seg_entry(sbi, i); in segment_info_seq_show()
1371 struct f2fs_sb_info *sbi = F2FS_SB(sb); in segment_bits_seq_show() local
1373 le32_to_cpu(sbi->raw_super->segment_count_main); in segment_bits_seq_show()
1380 struct seg_entry *se = get_seg_entry(sbi, i); in segment_bits_seq_show()
1395 struct f2fs_sb_info *sbi = F2FS_SB(sb); in victim_bits_seq_show() local
1396 struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); in victim_bits_seq_show()
1401 for (i = 0; i < MAIN_SECS(sbi); i++) { in victim_bits_seq_show()
1405 if ((i % 10) == 9 || i == (MAIN_SECS(sbi) - 1)) in victim_bits_seq_show()
1417 struct f2fs_sb_info *sbi = F2FS_SB(sb); in discard_plist_seq_show() local
1418 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in discard_plist_seq_show()
1422 if (!f2fs_realtime_discard_enable(sbi)) in discard_plist_seq_show()
1487 int f2fs_register_sysfs(struct f2fs_sb_info *sbi) in f2fs_register_sysfs() argument
1489 struct super_block *sb = sbi->sb; in f2fs_register_sysfs()
1492 sbi->s_kobj.kset = &f2fs_kset; in f2fs_register_sysfs()
1493 init_completion(&sbi->s_kobj_unregister); in f2fs_register_sysfs()
1494 err = kobject_init_and_add(&sbi->s_kobj, &f2fs_sb_ktype, NULL, in f2fs_register_sysfs()
1499 sbi->s_stat_kobj.kset = &f2fs_kset; in f2fs_register_sysfs()
1500 init_completion(&sbi->s_stat_kobj_unregister); in f2fs_register_sysfs()
1501 err = kobject_init_and_add(&sbi->s_stat_kobj, &f2fs_stat_ktype, in f2fs_register_sysfs()
1502 &sbi->s_kobj, "stat"); in f2fs_register_sysfs()
1506 sbi->s_feature_list_kobj.kset = &f2fs_kset; in f2fs_register_sysfs()
1507 init_completion(&sbi->s_feature_list_kobj_unregister); in f2fs_register_sysfs()
1508 err = kobject_init_and_add(&sbi->s_feature_list_kobj, in f2fs_register_sysfs()
1510 &sbi->s_kobj, "feature_list"); in f2fs_register_sysfs()
1514 sbi->s_proc = proc_mkdir(sb->s_id, f2fs_proc_root); in f2fs_register_sysfs()
1515 if (!sbi->s_proc) { in f2fs_register_sysfs()
1520 proc_create_single_data("segment_info", 0444, sbi->s_proc, in f2fs_register_sysfs()
1522 proc_create_single_data("segment_bits", 0444, sbi->s_proc, in f2fs_register_sysfs()
1525 proc_create_single_data("iostat_info", 0444, sbi->s_proc, in f2fs_register_sysfs()
1528 proc_create_single_data("victim_bits", 0444, sbi->s_proc, in f2fs_register_sysfs()
1530 proc_create_single_data("discard_plist_info", 0444, sbi->s_proc, in f2fs_register_sysfs()
1534 kobject_put(&sbi->s_feature_list_kobj); in f2fs_register_sysfs()
1535 wait_for_completion(&sbi->s_feature_list_kobj_unregister); in f2fs_register_sysfs()
1537 kobject_put(&sbi->s_stat_kobj); in f2fs_register_sysfs()
1538 wait_for_completion(&sbi->s_stat_kobj_unregister); in f2fs_register_sysfs()
1540 kobject_put(&sbi->s_kobj); in f2fs_register_sysfs()
1541 wait_for_completion(&sbi->s_kobj_unregister); in f2fs_register_sysfs()
1545 void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi) in f2fs_unregister_sysfs() argument
1547 remove_proc_subtree(sbi->sb->s_id, f2fs_proc_root); in f2fs_unregister_sysfs()
1549 kobject_put(&sbi->s_stat_kobj); in f2fs_unregister_sysfs()
1550 wait_for_completion(&sbi->s_stat_kobj_unregister); in f2fs_unregister_sysfs()
1551 kobject_put(&sbi->s_feature_list_kobj); in f2fs_unregister_sysfs()
1552 wait_for_completion(&sbi->s_feature_list_kobj_unregister); in f2fs_unregister_sysfs()
1554 kobject_put(&sbi->s_kobj); in f2fs_unregister_sysfs()
1555 wait_for_completion(&sbi->s_kobj_unregister); in f2fs_unregister_sysfs()