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 issued_discard_show() argument
149 if (!SM_I(sbi)->dcc_info) in issued_discard_show()
152 &SM_I(sbi)->dcc_info->issued_discard)); in issued_discard_show()
156 struct f2fs_sb_info *sbi, char *buf) in queued_discard_show() argument
158 if (!SM_I(sbi)->dcc_info) in queued_discard_show()
161 &SM_I(sbi)->dcc_info->queued_discard)); in queued_discard_show()
165 struct f2fs_sb_info *sbi, char *buf) in undiscard_blks_show() argument
167 if (!SM_I(sbi)->dcc_info) in undiscard_blks_show()
170 SM_I(sbi)->dcc_info->undiscard_blks); in undiscard_blks_show()
174 struct f2fs_sb_info *sbi, char *buf) in atgc_enabled_show() argument
176 return sysfs_emit(buf, "%d\n", sbi->am.atgc_enabled ? 1 : 0); in atgc_enabled_show()
180 struct f2fs_sb_info *sbi, char *buf) in gc_mode_show() argument
182 return sysfs_emit(buf, "%s\n", gc_mode_names[sbi->gc_mode]); in gc_mode_show()
186 struct f2fs_sb_info *sbi, char *buf) in features_show() argument
190 if (f2fs_sb_has_encrypt(sbi)) in features_show()
193 if (f2fs_sb_has_blkzoned(sbi)) in features_show()
196 if (f2fs_sb_has_extra_attr(sbi)) in features_show()
199 if (f2fs_sb_has_project_quota(sbi)) in features_show()
202 if (f2fs_sb_has_inode_chksum(sbi)) in features_show()
205 if (f2fs_sb_has_flexible_inline_xattr(sbi)) in features_show()
208 if (f2fs_sb_has_quota_ino(sbi)) in features_show()
211 if (f2fs_sb_has_inode_crtime(sbi)) in features_show()
214 if (f2fs_sb_has_lost_found(sbi)) in features_show()
217 if (f2fs_sb_has_verity(sbi)) in features_show()
220 if (f2fs_sb_has_sb_chksum(sbi)) in features_show()
223 if (f2fs_sb_has_casefold(sbi)) in features_show()
226 if (f2fs_sb_has_readonly(sbi)) in features_show()
229 if (f2fs_sb_has_compression(sbi)) in features_show()
239 struct f2fs_sb_info *sbi, char *buf) in current_reserved_blocks_show() argument
241 return sysfs_emit(buf, "%u\n", sbi->current_reserved_blocks); in current_reserved_blocks_show()
245 struct f2fs_sb_info *sbi, char *buf) in unusable_show() argument
249 if (test_opt(sbi, DISABLE_CHECKPOINT)) in unusable_show()
250 unusable = sbi->unusable_block_count; in unusable_show()
252 unusable = f2fs_get_unusable_blocks(sbi); in unusable_show()
257 struct f2fs_sb_info *sbi, char *buf) in encoding_show() argument
260 struct super_block *sb = sbi->sb; in encoding_show()
262 if (f2fs_sb_has_casefold(sbi)) in encoding_show()
272 struct f2fs_sb_info *sbi, char *buf) in mounted_time_sec_show() argument
274 return sysfs_emit(buf, "%llu\n", SIT_I(sbi)->mounted_time); in mounted_time_sec_show()
279 struct f2fs_sb_info *sbi, char *buf) in moved_blocks_foreground_show() argument
281 struct f2fs_stat_info *si = F2FS_STAT(sbi); in moved_blocks_foreground_show()
289 struct f2fs_sb_info *sbi, char *buf) in moved_blocks_background_show() argument
291 struct f2fs_stat_info *si = F2FS_STAT(sbi); in moved_blocks_background_show()
298 struct f2fs_sb_info *sbi, char *buf) in avg_vblocks_show() argument
300 struct f2fs_stat_info *si = F2FS_STAT(sbi); in avg_vblocks_show()
302 si->dirty_count = dirty_segments(sbi); in avg_vblocks_show()
303 f2fs_update_sit_info(sbi); in avg_vblocks_show()
309 struct f2fs_sb_info *sbi, char *buf) in main_blkaddr_show() argument
312 (unsigned long long)MAIN_BLKADDR(sbi)); in main_blkaddr_show()
316 struct f2fs_sb_info *sbi, char *buf) in f2fs_sbi_show() argument
321 ptr = __struct_ptr(sbi, a->struct_type); in f2fs_sbi_show()
327 sbi->raw_super->extension_list; in f2fs_sbi_show()
328 int cold_count = le32_to_cpu(sbi->raw_super->extension_count); in f2fs_sbi_show()
329 int hot_count = sbi->raw_super->hot_ext_count; in f2fs_sbi_show()
344 struct ckpt_req_control *cprc = &sbi->cprc_info; in f2fs_sbi_show()
357 return sysfs_emit(buf, "%llu\n", sbi->compr_written_block); in f2fs_sbi_show()
360 return sysfs_emit(buf, "%llu\n", sbi->compr_saved_block); in f2fs_sbi_show()
363 return sysfs_emit(buf, "%u\n", sbi->compr_new_inode); in f2fs_sbi_show()
367 return sysfs_emit(buf, "%u\n", sbi->gc_segment_mode); in f2fs_sbi_show()
371 sbi->gc_reclaimed_segs[sbi->gc_segment_mode]); in f2fs_sbi_show()
375 s64 current_write = atomic64_read(&sbi->current_atomic_write); in f2fs_sbi_show()
381 return sysfs_emit(buf, "%lld\n", sbi->peak_atomic_write); in f2fs_sbi_show()
384 return sysfs_emit(buf, "%llu\n", sbi->committed_atomic_block); in f2fs_sbi_show()
387 return sysfs_emit(buf, "%llu\n", sbi->revoked_atomic_block); in f2fs_sbi_show()
392 atomic_read(&sbi->cp_call_count[TOTAL_CALL]) - in f2fs_sbi_show()
393 atomic_read(&sbi->cp_call_count[BACKGROUND])); in f2fs_sbi_show()
396 atomic_read(&sbi->cp_call_count[BACKGROUND])); in f2fs_sbi_show()
405 struct f2fs_sb_info *sbi, in __sbi_store() argument
413 ptr = __struct_ptr(sbi, a->struct_type); in __sbi_store()
438 f2fs_down_write(&sbi->sb_lock); in __sbi_store()
440 ret = f2fs_update_extension_list(sbi, name, hot, set); in __sbi_store()
444 ret = f2fs_commit_super(sbi, false); in __sbi_store()
446 f2fs_update_extension_list(sbi, name, hot, !set); in __sbi_store()
448 f2fs_up_write(&sbi->sb_lock); in __sbi_store()
454 struct ckpt_req_control *cprc = &sbi->cprc_info; in __sbi_store()
474 if (test_opt(sbi, MERGE_CHECKPOINT)) { in __sbi_store()
491 if (f2fs_build_fault_attr(sbi, 0, t)) in __sbi_store()
496 if (f2fs_build_fault_attr(sbi, t, 0)) in __sbi_store()
502 spin_lock(&sbi->stat_lock); in __sbi_store()
503 if (t > (unsigned long)(sbi->user_block_count - in __sbi_store()
504 F2FS_OPTION(sbi).root_reserved_blocks - in __sbi_store()
505 SEGS_TO_BLKS(sbi, in __sbi_store()
506 SM_I(sbi)->additional_reserved_segments))) { in __sbi_store()
507 spin_unlock(&sbi->stat_lock); in __sbi_store()
511 sbi->current_reserved_blocks = min(sbi->reserved_blocks, in __sbi_store()
512 sbi->user_block_count - valid_user_blocks(sbi)); in __sbi_store()
513 spin_unlock(&sbi->stat_lock); in __sbi_store()
520 if (!f2fs_block_unit_discard(sbi)) in __sbi_store()
531 if (!f2fs_block_unit_discard(sbi)) in __sbi_store()
542 if (!f2fs_block_unit_discard(sbi)) in __sbi_store()
563 if (t == 0 || t > SEGS_PER_SEC(sbi)) in __sbi_store()
568 if (t == 0 || t > SEGS_PER_SEC(sbi)) in __sbi_store()
574 sbi->gc_mode = GC_NORMAL; in __sbi_store()
576 sbi->gc_mode = GC_URGENT_HIGH; in __sbi_store()
577 if (sbi->gc_thread) { in __sbi_store()
578 sbi->gc_thread->gc_wake = true; in __sbi_store()
580 &sbi->gc_thread->gc_wait_queue_head); in __sbi_store()
581 wake_up_discard_thread(sbi, true); in __sbi_store()
584 sbi->gc_mode = GC_URGENT_LOW; in __sbi_store()
586 sbi->gc_mode = GC_URGENT_MID; in __sbi_store()
587 if (sbi->gc_thread) { in __sbi_store()
588 sbi->gc_thread->gc_wake = true; in __sbi_store()
590 &sbi->gc_thread->gc_wait_queue_head); in __sbi_store()
599 sbi->gc_mode = GC_IDLE_CB; in __sbi_store()
601 sbi->gc_mode = GC_IDLE_GREEDY; in __sbi_store()
603 if (!sbi->am.atgc_enabled) in __sbi_store()
605 sbi->gc_mode = GC_IDLE_AT; in __sbi_store()
607 sbi->gc_mode = GC_NORMAL; in __sbi_store()
613 spin_lock(&sbi->gc_remaining_trials_lock); in __sbi_store()
614 sbi->gc_remaining_trials = t; in __sbi_store()
615 spin_unlock(&sbi->gc_remaining_trials_lock); in __sbi_store()
622 sbi->iostat_enable = !!t; in __sbi_store()
623 if (!sbi->iostat_enable) in __sbi_store()
624 f2fs_reset_iostat(sbi); in __sbi_store()
631 spin_lock_irq(&sbi->iostat_lock); in __sbi_store()
632 sbi->iostat_period_ms = (unsigned int)t; in __sbi_store()
633 spin_unlock_irq(&sbi->iostat_lock); in __sbi_store()
642 sbi->blkzone_alloc_policy = t; in __sbi_store()
652 sbi->compr_written_block = 0; in __sbi_store()
653 sbi->compr_saved_block = 0; in __sbi_store()
660 sbi->compr_new_inode = 0; in __sbi_store()
682 sbi->am.candidate_ratio = t; in __sbi_store()
689 sbi->am.age_weight = t; in __sbi_store()
695 sbi->gc_segment_mode = t; in __sbi_store()
704 sbi->gc_pin_file_threshold = t; in __sbi_store()
711 sbi->gc_reclaimed_segs[sbi->gc_segment_mode] = 0; in __sbi_store()
717 sbi->seq_file_ra_mul = t; in __sbi_store()
725 sbi->max_fragment_chunk = t; in __sbi_store()
733 sbi->max_fragment_hole = t; in __sbi_store()
742 sbi->peak_atomic_write = 0; in __sbi_store()
749 sbi->committed_atomic_block = 0; in __sbi_store()
756 sbi->revoked_atomic_block = 0; in __sbi_store()
761 sbi->readdir_ra = !!t; in __sbi_store()
766 if (t == 0 || t >= sbi->warm_data_age_threshold) in __sbi_store()
775 if (t <= sbi->hot_data_age_threshold) in __sbi_store()
796 if (f2fs_lfs_mode(sbi) && (t & ~BIT(F2FS_IPU_NOCACHE))) in __sbi_store()
798 SM_I(sbi)->ipu_policy = (unsigned int)t; in __sbi_store()
805 sbi->dir_level = t; in __sbi_store()
815 struct f2fs_sb_info *sbi, in f2fs_sbi_store() argument
823 if (!down_read_trylock(&sbi->sb->s_umount)) in f2fs_sbi_store()
826 ret = __sbi_store(a, sbi, buf, count); in f2fs_sbi_store()
828 up_read(&sbi->sb->s_umount); in f2fs_sbi_store()
836 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_attr_show() local
840 return a->show ? a->show(a, sbi, buf) : 0; in f2fs_attr_show()
846 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_attr_store() local
850 return a->store ? a->store(a, sbi, buf, len) : 0; in f2fs_attr_store()
855 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_sb_release() local
857 complete(&sbi->s_kobj_unregister); in f2fs_sb_release()
879 struct f2fs_sb_info *sbi, char *buf) in f2fs_feature_show() argument
891 struct f2fs_sb_info *sbi, char *buf) in f2fs_sb_feature_show() argument
893 if (F2FS_HAS_FEATURE(sbi, a->id)) in f2fs_sb_feature_show()
1367 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_stat_attr_show() local
1371 return a->show ? a->show(a, sbi, buf) : 0; in f2fs_stat_attr_show()
1377 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_stat_attr_store() local
1381 return a->store ? a->store(a, sbi, buf, len) : 0; in f2fs_stat_attr_store()
1386 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_stat_kobj_release() local
1388 complete(&sbi->s_stat_kobj_unregister); in f2fs_stat_kobj_release()
1405 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_sb_feat_attr_show() local
1409 return a->show ? a->show(a, sbi, buf) : 0; in f2fs_sb_feat_attr_show()
1414 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info, in f2fs_feature_list_kobj_release() local
1416 complete(&sbi->s_feature_list_kobj_unregister); in f2fs_feature_list_kobj_release()
1433 struct f2fs_sb_info *sbi = F2FS_SB(sb); in segment_info_seq_show() local
1435 le32_to_cpu(sbi->raw_super->segment_count_main); in segment_info_seq_show()
1442 struct seg_entry *se = get_seg_entry(sbi, i); in segment_info_seq_show()
1460 struct f2fs_sb_info *sbi = F2FS_SB(sb); in segment_bits_seq_show() local
1462 le32_to_cpu(sbi->raw_super->segment_count_main); in segment_bits_seq_show()
1469 struct seg_entry *se = get_seg_entry(sbi, i); in segment_bits_seq_show()
1484 struct f2fs_sb_info *sbi = F2FS_SB(sb); in victim_bits_seq_show() local
1485 struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); in victim_bits_seq_show()
1490 for (i = 0; i < MAIN_SECS(sbi); i++) { in victim_bits_seq_show()
1494 if ((i % 10) == 9 || i == (MAIN_SECS(sbi) - 1)) in victim_bits_seq_show()
1506 struct f2fs_sb_info *sbi = F2FS_SB(sb); in discard_plist_seq_show() local
1507 struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; in discard_plist_seq_show()
1511 if (!f2fs_realtime_discard_enable(sbi)) in discard_plist_seq_show()
1544 struct f2fs_sb_info *sbi = F2FS_SB(sb); in disk_map_seq_show() local
1550 seq_printf(seq, " seg0_blkaddr : 0x%010x\n", SEG0_BLKADDR(sbi)); in disk_map_seq_show()
1552 le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr), 2); in disk_map_seq_show()
1554 SIT_I(sbi)->sit_base_addr, in disk_map_seq_show()
1555 le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment_count_sit)); in disk_map_seq_show()
1557 NM_I(sbi)->nat_blkaddr, in disk_map_seq_show()
1558 le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment_count_nat)); in disk_map_seq_show()
1560 SM_I(sbi)->ssa_blkaddr, in disk_map_seq_show()
1561 le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment_count_ssa)); in disk_map_seq_show()
1563 SM_I(sbi)->main_blkaddr, in disk_map_seq_show()
1564 le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment_count_main)); in disk_map_seq_show()
1566 le32_to_cpu(F2FS_RAW_SUPER(sbi)->section_count)); in disk_map_seq_show()
1568 SEGS_PER_SEC(sbi)); in disk_map_seq_show()
1570 SEGS_PER_SEC(sbi) << 1); in disk_map_seq_show()
1572 if (!f2fs_is_multi_device(sbi)) in disk_map_seq_show()
1576 for (i = 0; i < sbi->s_ndevs; i++) in disk_map_seq_show()
1620 int f2fs_register_sysfs(struct f2fs_sb_info *sbi) in f2fs_register_sysfs() argument
1622 struct super_block *sb = sbi->sb; in f2fs_register_sysfs()
1625 sbi->s_kobj.kset = &f2fs_kset; in f2fs_register_sysfs()
1626 init_completion(&sbi->s_kobj_unregister); in f2fs_register_sysfs()
1627 err = kobject_init_and_add(&sbi->s_kobj, &f2fs_sb_ktype, NULL, in f2fs_register_sysfs()
1632 sbi->s_stat_kobj.kset = &f2fs_kset; in f2fs_register_sysfs()
1633 init_completion(&sbi->s_stat_kobj_unregister); in f2fs_register_sysfs()
1634 err = kobject_init_and_add(&sbi->s_stat_kobj, &f2fs_stat_ktype, in f2fs_register_sysfs()
1635 &sbi->s_kobj, "stat"); in f2fs_register_sysfs()
1639 sbi->s_feature_list_kobj.kset = &f2fs_kset; in f2fs_register_sysfs()
1640 init_completion(&sbi->s_feature_list_kobj_unregister); in f2fs_register_sysfs()
1641 err = kobject_init_and_add(&sbi->s_feature_list_kobj, in f2fs_register_sysfs()
1643 &sbi->s_kobj, "feature_list"); in f2fs_register_sysfs()
1647 sbi->s_proc = proc_mkdir(sb->s_id, f2fs_proc_root); in f2fs_register_sysfs()
1648 if (!sbi->s_proc) { in f2fs_register_sysfs()
1653 proc_create_single_data("segment_info", 0444, sbi->s_proc, in f2fs_register_sysfs()
1655 proc_create_single_data("segment_bits", 0444, sbi->s_proc, in f2fs_register_sysfs()
1658 proc_create_single_data("iostat_info", 0444, sbi->s_proc, in f2fs_register_sysfs()
1661 proc_create_single_data("victim_bits", 0444, sbi->s_proc, in f2fs_register_sysfs()
1663 proc_create_single_data("discard_plist_info", 0444, sbi->s_proc, in f2fs_register_sysfs()
1665 proc_create_single_data("disk_map", 0444, sbi->s_proc, in f2fs_register_sysfs()
1669 kobject_put(&sbi->s_feature_list_kobj); in f2fs_register_sysfs()
1670 wait_for_completion(&sbi->s_feature_list_kobj_unregister); in f2fs_register_sysfs()
1672 kobject_put(&sbi->s_stat_kobj); in f2fs_register_sysfs()
1673 wait_for_completion(&sbi->s_stat_kobj_unregister); in f2fs_register_sysfs()
1675 kobject_put(&sbi->s_kobj); in f2fs_register_sysfs()
1676 wait_for_completion(&sbi->s_kobj_unregister); in f2fs_register_sysfs()
1680 void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi) in f2fs_unregister_sysfs() argument
1682 remove_proc_subtree(sbi->sb->s_id, f2fs_proc_root); in f2fs_unregister_sysfs()
1684 kobject_put(&sbi->s_stat_kobj); in f2fs_unregister_sysfs()
1685 wait_for_completion(&sbi->s_stat_kobj_unregister); in f2fs_unregister_sysfs()
1686 kobject_put(&sbi->s_feature_list_kobj); in f2fs_unregister_sysfs()
1687 wait_for_completion(&sbi->s_feature_list_kobj_unregister); in f2fs_unregister_sysfs()
1689 kobject_put(&sbi->s_kobj); in f2fs_unregister_sysfs()
1690 wait_for_completion(&sbi->s_kobj_unregister); in f2fs_unregister_sysfs()