1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
9 #include <linux/compiler.h>
10 #include <linux/proc_fs.h>
11 #include <linux/f2fs_fs.h>
12 #include <linux/seq_file.h>
13 #include <linux/unicode.h>
14 #include <linux/ioprio.h>
15 #include <linux/sysfs.h>
21 #include <trace/events/f2fs.h>
23 static struct proc_dir_entry *f2fs_proc_root;
25 /* Sysfs support for f2fs */
27 GC_THREAD, /* struct f2fs_gc_thread */
28 SM_INFO, /* struct f2fs_sm_info */
29 DCC_INFO, /* struct discard_cmd_control */
30 NM_INFO, /* struct f2fs_nm_info */
31 F2FS_SBI, /* struct f2fs_sb_info */
32 #ifdef CONFIG_F2FS_STAT_FS
33 STAT_INFO, /* struct f2fs_stat_info */
35 #ifdef CONFIG_F2FS_FAULT_INJECTION
36 FAULT_INFO_RATE, /* struct f2fs_fault_info */
37 FAULT_INFO_TYPE, /* struct f2fs_fault_info */
39 RESERVED_BLOCKS, /* struct f2fs_sb_info */
40 CPRC_INFO, /* struct ckpt_req_control */
41 ATGC_INFO, /* struct atgc_management */
45 struct attribute attr;
46 ssize_t (*show)(struct f2fs_attr *, struct f2fs_sb_info *, char *);
47 ssize_t (*store)(struct f2fs_attr *, struct f2fs_sb_info *,
48 const char *, size_t);
54 static ssize_t f2fs_sbi_show(struct f2fs_attr *a,
55 struct f2fs_sb_info *sbi, char *buf);
57 static unsigned char *__struct_ptr(struct f2fs_sb_info *sbi, int struct_type)
59 if (struct_type == GC_THREAD)
60 return (unsigned char *)sbi->gc_thread;
61 else if (struct_type == SM_INFO)
62 return (unsigned char *)SM_I(sbi);
63 else if (struct_type == DCC_INFO)
64 return (unsigned char *)SM_I(sbi)->dcc_info;
65 else if (struct_type == NM_INFO)
66 return (unsigned char *)NM_I(sbi);
67 else if (struct_type == F2FS_SBI || struct_type == RESERVED_BLOCKS)
68 return (unsigned char *)sbi;
69 #ifdef CONFIG_F2FS_FAULT_INJECTION
70 else if (struct_type == FAULT_INFO_RATE ||
71 struct_type == FAULT_INFO_TYPE)
72 return (unsigned char *)&F2FS_OPTION(sbi).fault_info;
74 #ifdef CONFIG_F2FS_STAT_FS
75 else if (struct_type == STAT_INFO)
76 return (unsigned char *)F2FS_STAT(sbi);
78 else if (struct_type == CPRC_INFO)
79 return (unsigned char *)&sbi->cprc_info;
80 else if (struct_type == ATGC_INFO)
81 return (unsigned char *)&sbi->am;
85 static ssize_t dirty_segments_show(struct f2fs_attr *a,
86 struct f2fs_sb_info *sbi, char *buf)
88 return sprintf(buf, "%llu\n",
89 (unsigned long long)(dirty_segments(sbi)));
92 static ssize_t free_segments_show(struct f2fs_attr *a,
93 struct f2fs_sb_info *sbi, char *buf)
95 return sprintf(buf, "%llu\n",
96 (unsigned long long)(free_segments(sbi)));
99 static ssize_t ovp_segments_show(struct f2fs_attr *a,
100 struct f2fs_sb_info *sbi, char *buf)
102 return sprintf(buf, "%llu\n",
103 (unsigned long long)(overprovision_segments(sbi)));
106 static ssize_t lifetime_write_kbytes_show(struct f2fs_attr *a,
107 struct f2fs_sb_info *sbi, char *buf)
109 return sprintf(buf, "%llu\n",
110 (unsigned long long)(sbi->kbytes_written +
111 ((f2fs_get_sectors_written(sbi) -
112 sbi->sectors_written_start) >> 1)));
115 static ssize_t sb_status_show(struct f2fs_attr *a,
116 struct f2fs_sb_info *sbi, char *buf)
118 return sprintf(buf, "%lx\n", sbi->s_flag);
121 static ssize_t pending_discard_show(struct f2fs_attr *a,
122 struct f2fs_sb_info *sbi, char *buf)
124 if (!SM_I(sbi)->dcc_info)
126 return sprintf(buf, "%llu\n", (unsigned long long)atomic_read(
127 &SM_I(sbi)->dcc_info->discard_cmd_cnt));
130 static ssize_t features_show(struct f2fs_attr *a,
131 struct f2fs_sb_info *sbi, char *buf)
135 if (f2fs_sb_has_encrypt(sbi))
136 len += scnprintf(buf, PAGE_SIZE - len, "%s",
138 if (f2fs_sb_has_blkzoned(sbi))
139 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
140 len ? ", " : "", "blkzoned");
141 if (f2fs_sb_has_extra_attr(sbi))
142 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
143 len ? ", " : "", "extra_attr");
144 if (f2fs_sb_has_project_quota(sbi))
145 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
146 len ? ", " : "", "projquota");
147 if (f2fs_sb_has_inode_chksum(sbi))
148 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
149 len ? ", " : "", "inode_checksum");
150 if (f2fs_sb_has_flexible_inline_xattr(sbi))
151 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
152 len ? ", " : "", "flexible_inline_xattr");
153 if (f2fs_sb_has_quota_ino(sbi))
154 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
155 len ? ", " : "", "quota_ino");
156 if (f2fs_sb_has_inode_crtime(sbi))
157 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
158 len ? ", " : "", "inode_crtime");
159 if (f2fs_sb_has_lost_found(sbi))
160 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
161 len ? ", " : "", "lost_found");
162 if (f2fs_sb_has_verity(sbi))
163 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
164 len ? ", " : "", "verity");
165 if (f2fs_sb_has_sb_chksum(sbi))
166 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
167 len ? ", " : "", "sb_checksum");
168 if (f2fs_sb_has_casefold(sbi))
169 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
170 len ? ", " : "", "casefold");
171 if (f2fs_sb_has_readonly(sbi))
172 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
173 len ? ", " : "", "readonly");
174 if (f2fs_sb_has_compression(sbi))
175 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
176 len ? ", " : "", "compression");
177 len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
178 len ? ", " : "", "pin_file");
179 len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
183 static ssize_t current_reserved_blocks_show(struct f2fs_attr *a,
184 struct f2fs_sb_info *sbi, char *buf)
186 return sprintf(buf, "%u\n", sbi->current_reserved_blocks);
189 static ssize_t unusable_show(struct f2fs_attr *a,
190 struct f2fs_sb_info *sbi, char *buf)
194 if (test_opt(sbi, DISABLE_CHECKPOINT))
195 unusable = sbi->unusable_block_count;
197 unusable = f2fs_get_unusable_blocks(sbi);
198 return sprintf(buf, "%llu\n", (unsigned long long)unusable);
201 static ssize_t encoding_show(struct f2fs_attr *a,
202 struct f2fs_sb_info *sbi, char *buf)
204 #ifdef CONFIG_UNICODE
205 struct super_block *sb = sbi->sb;
207 if (f2fs_sb_has_casefold(sbi))
208 return sysfs_emit(buf, "UTF-8 (%d.%d.%d)\n",
209 (sb->s_encoding->version >> 16) & 0xff,
210 (sb->s_encoding->version >> 8) & 0xff,
211 sb->s_encoding->version & 0xff);
213 return sprintf(buf, "(none)");
216 static ssize_t mounted_time_sec_show(struct f2fs_attr *a,
217 struct f2fs_sb_info *sbi, char *buf)
219 return sprintf(buf, "%llu", SIT_I(sbi)->mounted_time);
222 #ifdef CONFIG_F2FS_STAT_FS
223 static ssize_t moved_blocks_foreground_show(struct f2fs_attr *a,
224 struct f2fs_sb_info *sbi, char *buf)
226 struct f2fs_stat_info *si = F2FS_STAT(sbi);
228 return sprintf(buf, "%llu\n",
229 (unsigned long long)(si->tot_blks -
230 (si->bg_data_blks + si->bg_node_blks)));
233 static ssize_t moved_blocks_background_show(struct f2fs_attr *a,
234 struct f2fs_sb_info *sbi, char *buf)
236 struct f2fs_stat_info *si = F2FS_STAT(sbi);
238 return sprintf(buf, "%llu\n",
239 (unsigned long long)(si->bg_data_blks + si->bg_node_blks));
242 static ssize_t avg_vblocks_show(struct f2fs_attr *a,
243 struct f2fs_sb_info *sbi, char *buf)
245 struct f2fs_stat_info *si = F2FS_STAT(sbi);
247 si->dirty_count = dirty_segments(sbi);
248 f2fs_update_sit_info(sbi);
249 return sprintf(buf, "%llu\n", (unsigned long long)(si->avg_vblocks));
253 static ssize_t main_blkaddr_show(struct f2fs_attr *a,
254 struct f2fs_sb_info *sbi, char *buf)
256 return sysfs_emit(buf, "%llu\n",
257 (unsigned long long)MAIN_BLKADDR(sbi));
260 static ssize_t f2fs_sbi_show(struct f2fs_attr *a,
261 struct f2fs_sb_info *sbi, char *buf)
263 unsigned char *ptr = NULL;
266 ptr = __struct_ptr(sbi, a->struct_type);
270 if (!strcmp(a->attr.name, "extension_list")) {
271 __u8 (*extlist)[F2FS_EXTENSION_LEN] =
272 sbi->raw_super->extension_list;
273 int cold_count = le32_to_cpu(sbi->raw_super->extension_count);
274 int hot_count = sbi->raw_super->hot_ext_count;
277 len += scnprintf(buf + len, PAGE_SIZE - len,
278 "cold file extension:\n");
279 for (i = 0; i < cold_count; i++)
280 len += scnprintf(buf + len, PAGE_SIZE - len, "%s\n",
283 len += scnprintf(buf + len, PAGE_SIZE - len,
284 "hot file extension:\n");
285 for (i = cold_count; i < cold_count + hot_count; i++)
286 len += scnprintf(buf + len, PAGE_SIZE - len, "%s\n",
291 if (!strcmp(a->attr.name, "ckpt_thread_ioprio")) {
292 struct ckpt_req_control *cprc = &sbi->cprc_info;
294 int class = IOPRIO_PRIO_CLASS(cprc->ckpt_thread_ioprio);
295 int data = IOPRIO_PRIO_DATA(cprc->ckpt_thread_ioprio);
297 if (class == IOPRIO_CLASS_RT)
298 len += scnprintf(buf + len, PAGE_SIZE - len, "rt,");
299 else if (class == IOPRIO_CLASS_BE)
300 len += scnprintf(buf + len, PAGE_SIZE - len, "be,");
304 len += scnprintf(buf + len, PAGE_SIZE - len, "%d\n", data);
308 #ifdef CONFIG_F2FS_FS_COMPRESSION
309 if (!strcmp(a->attr.name, "compr_written_block"))
310 return sysfs_emit(buf, "%llu\n", sbi->compr_written_block);
312 if (!strcmp(a->attr.name, "compr_saved_block"))
313 return sysfs_emit(buf, "%llu\n", sbi->compr_saved_block);
315 if (!strcmp(a->attr.name, "compr_new_inode"))
316 return sysfs_emit(buf, "%u\n", sbi->compr_new_inode);
319 if (!strcmp(a->attr.name, "gc_segment_mode"))
320 return sysfs_emit(buf, "%u\n", sbi->gc_segment_mode);
322 if (!strcmp(a->attr.name, "gc_reclaimed_segments")) {
323 return sysfs_emit(buf, "%u\n",
324 sbi->gc_reclaimed_segs[sbi->gc_segment_mode]);
327 ui = (unsigned int *)(ptr + a->offset);
329 return sprintf(buf, "%u\n", *ui);
332 static ssize_t __sbi_store(struct f2fs_attr *a,
333 struct f2fs_sb_info *sbi,
334 const char *buf, size_t count)
341 ptr = __struct_ptr(sbi, a->struct_type);
345 if (!strcmp(a->attr.name, "extension_list")) {
346 const char *name = strim((char *)buf);
347 bool set = true, hot;
349 if (!strncmp(name, "[h]", 3))
351 else if (!strncmp(name, "[c]", 3))
363 if (!strlen(name) || strlen(name) >= F2FS_EXTENSION_LEN)
366 down_write(&sbi->sb_lock);
368 ret = f2fs_update_extension_list(sbi, name, hot, set);
372 ret = f2fs_commit_super(sbi, false);
374 f2fs_update_extension_list(sbi, name, hot, !set);
376 up_write(&sbi->sb_lock);
377 return ret ? ret : count;
380 if (!strcmp(a->attr.name, "ckpt_thread_ioprio")) {
381 const char *name = strim((char *)buf);
382 struct ckpt_req_control *cprc = &sbi->cprc_info;
387 if (!strncmp(name, "rt,", 3))
388 class = IOPRIO_CLASS_RT;
389 else if (!strncmp(name, "be,", 3))
390 class = IOPRIO_CLASS_BE;
395 ret = kstrtol(name, 10, &data);
398 if (data >= IOPRIO_NR_LEVELS || data < 0)
401 cprc->ckpt_thread_ioprio = IOPRIO_PRIO_VALUE(class, data);
402 if (test_opt(sbi, MERGE_CHECKPOINT)) {
403 ret = set_task_ioprio(cprc->f2fs_issue_ckpt,
404 cprc->ckpt_thread_ioprio);
412 ui = (unsigned int *)(ptr + a->offset);
414 ret = kstrtoul(skip_spaces(buf), 0, &t);
417 #ifdef CONFIG_F2FS_FAULT_INJECTION
418 if (a->struct_type == FAULT_INFO_TYPE && t >= (1 << FAULT_MAX))
420 if (a->struct_type == FAULT_INFO_RATE && t >= UINT_MAX)
423 if (a->struct_type == RESERVED_BLOCKS) {
424 spin_lock(&sbi->stat_lock);
425 if (t > (unsigned long)(sbi->user_block_count -
426 F2FS_OPTION(sbi).root_reserved_blocks -
427 sbi->blocks_per_seg *
428 SM_I(sbi)->additional_reserved_segments)) {
429 spin_unlock(&sbi->stat_lock);
433 sbi->current_reserved_blocks = min(sbi->reserved_blocks,
434 sbi->user_block_count - valid_user_blocks(sbi));
435 spin_unlock(&sbi->stat_lock);
439 if (!strcmp(a->attr.name, "discard_granularity")) {
440 if (t == 0 || t > MAX_PLIST_NUM)
442 if (!f2fs_block_unit_discard(sbi))
450 if (!strcmp(a->attr.name, "migration_granularity")) {
451 if (t == 0 || t > sbi->segs_per_sec)
455 if (!strcmp(a->attr.name, "trim_sections"))
458 if (!strcmp(a->attr.name, "gc_urgent")) {
460 sbi->gc_mode = GC_NORMAL;
462 sbi->gc_mode = GC_URGENT_HIGH;
463 if (sbi->gc_thread) {
464 sbi->gc_thread->gc_wake = 1;
465 wake_up_interruptible_all(
466 &sbi->gc_thread->gc_wait_queue_head);
467 wake_up_discard_thread(sbi, true);
470 sbi->gc_mode = GC_URGENT_LOW;
476 if (!strcmp(a->attr.name, "gc_idle")) {
477 if (t == GC_IDLE_CB) {
478 sbi->gc_mode = GC_IDLE_CB;
479 } else if (t == GC_IDLE_GREEDY) {
480 sbi->gc_mode = GC_IDLE_GREEDY;
481 } else if (t == GC_IDLE_AT) {
482 if (!sbi->am.atgc_enabled)
484 sbi->gc_mode = GC_AT;
486 sbi->gc_mode = GC_NORMAL;
491 if (!strcmp(a->attr.name, "gc_urgent_high_remaining")) {
492 spin_lock(&sbi->gc_urgent_high_lock);
493 sbi->gc_urgent_high_limited = t != 0;
494 sbi->gc_urgent_high_remaining = t;
495 spin_unlock(&sbi->gc_urgent_high_lock);
500 #ifdef CONFIG_F2FS_IOSTAT
501 if (!strcmp(a->attr.name, "iostat_enable")) {
502 sbi->iostat_enable = !!t;
503 if (!sbi->iostat_enable)
504 f2fs_reset_iostat(sbi);
508 if (!strcmp(a->attr.name, "iostat_period_ms")) {
509 if (t < MIN_IOSTAT_PERIOD_MS || t > MAX_IOSTAT_PERIOD_MS)
511 spin_lock(&sbi->iostat_lock);
512 sbi->iostat_period_ms = (unsigned int)t;
513 spin_unlock(&sbi->iostat_lock);
518 #ifdef CONFIG_F2FS_FS_COMPRESSION
519 if (!strcmp(a->attr.name, "compr_written_block") ||
520 !strcmp(a->attr.name, "compr_saved_block")) {
523 sbi->compr_written_block = 0;
524 sbi->compr_saved_block = 0;
528 if (!strcmp(a->attr.name, "compr_new_inode")) {
531 sbi->compr_new_inode = 0;
536 if (!strcmp(a->attr.name, "atgc_candidate_ratio")) {
539 sbi->am.candidate_ratio = t;
543 if (!strcmp(a->attr.name, "atgc_age_weight")) {
546 sbi->am.age_weight = t;
550 if (!strcmp(a->attr.name, "gc_segment_mode")) {
552 sbi->gc_segment_mode = t;
558 if (!strcmp(a->attr.name, "gc_reclaimed_segments")) {
561 sbi->gc_reclaimed_segs[sbi->gc_segment_mode] = 0;
565 if (!strcmp(a->attr.name, "seq_file_ra_mul")) {
566 if (t >= MIN_RA_MUL && t <= MAX_RA_MUL)
567 sbi->seq_file_ra_mul = t;
573 if (!strcmp(a->attr.name, "max_fragment_chunk")) {
574 if (t >= MIN_FRAGMENT_SIZE && t <= MAX_FRAGMENT_SIZE)
575 sbi->max_fragment_chunk = t;
581 if (!strcmp(a->attr.name, "max_fragment_hole")) {
582 if (t >= MIN_FRAGMENT_SIZE && t <= MAX_FRAGMENT_SIZE)
583 sbi->max_fragment_hole = t;
589 *ui = (unsigned int)t;
594 static ssize_t f2fs_sbi_store(struct f2fs_attr *a,
595 struct f2fs_sb_info *sbi,
596 const char *buf, size_t count)
599 bool gc_entry = (!strcmp(a->attr.name, "gc_urgent") ||
600 a->struct_type == GC_THREAD);
603 if (!down_read_trylock(&sbi->sb->s_umount))
606 ret = __sbi_store(a, sbi, buf, count);
608 up_read(&sbi->sb->s_umount);
613 static ssize_t f2fs_attr_show(struct kobject *kobj,
614 struct attribute *attr, char *buf)
616 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info,
618 struct f2fs_attr *a = container_of(attr, struct f2fs_attr, attr);
620 return a->show ? a->show(a, sbi, buf) : 0;
623 static ssize_t f2fs_attr_store(struct kobject *kobj, struct attribute *attr,
624 const char *buf, size_t len)
626 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info,
628 struct f2fs_attr *a = container_of(attr, struct f2fs_attr, attr);
630 return a->store ? a->store(a, sbi, buf, len) : 0;
633 static void f2fs_sb_release(struct kobject *kobj)
635 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info,
637 complete(&sbi->s_kobj_unregister);
641 * Note that there are three feature list entries:
642 * 1) /sys/fs/f2fs/features
643 * : shows runtime features supported by in-kernel f2fs along with Kconfig.
644 * - ref. F2FS_FEATURE_RO_ATTR()
646 * 2) /sys/fs/f2fs/$s_id/features <deprecated>
647 * : shows on-disk features enabled by mkfs.f2fs, used for old kernels. This
648 * won't add new feature anymore, and thus, users should check entries in 3)
649 * instead of this 2).
651 * 3) /sys/fs/f2fs/$s_id/feature_list
652 * : shows on-disk features enabled by mkfs.f2fs per instance, which follows
653 * sysfs entry rule where each entry should expose single value.
654 * This list covers old feature list provided by 2) and beyond. Therefore,
655 * please add new on-disk feature in this list only.
656 * - ref. F2FS_SB_FEATURE_RO_ATTR()
658 static ssize_t f2fs_feature_show(struct f2fs_attr *a,
659 struct f2fs_sb_info *sbi, char *buf)
661 return sprintf(buf, "supported\n");
664 #define F2FS_FEATURE_RO_ATTR(_name) \
665 static struct f2fs_attr f2fs_attr_##_name = { \
666 .attr = {.name = __stringify(_name), .mode = 0444 }, \
667 .show = f2fs_feature_show, \
670 static ssize_t f2fs_sb_feature_show(struct f2fs_attr *a,
671 struct f2fs_sb_info *sbi, char *buf)
673 if (F2FS_HAS_FEATURE(sbi, a->id))
674 return sprintf(buf, "supported\n");
675 return sprintf(buf, "unsupported\n");
678 #define F2FS_SB_FEATURE_RO_ATTR(_name, _feat) \
679 static struct f2fs_attr f2fs_attr_sb_##_name = { \
680 .attr = {.name = __stringify(_name), .mode = 0444 }, \
681 .show = f2fs_sb_feature_show, \
682 .id = F2FS_FEATURE_##_feat, \
685 #define F2FS_ATTR_OFFSET(_struct_type, _name, _mode, _show, _store, _offset) \
686 static struct f2fs_attr f2fs_attr_##_name = { \
687 .attr = {.name = __stringify(_name), .mode = _mode }, \
690 .struct_type = _struct_type, \
694 #define F2FS_RW_ATTR(struct_type, struct_name, name, elname) \
695 F2FS_ATTR_OFFSET(struct_type, name, 0644, \
696 f2fs_sbi_show, f2fs_sbi_store, \
697 offsetof(struct struct_name, elname))
699 #define F2FS_GENERAL_RO_ATTR(name) \
700 static struct f2fs_attr f2fs_attr_##name = __ATTR(name, 0444, name##_show, NULL)
702 #define F2FS_STAT_ATTR(_struct_type, _struct_name, _name, _elname) \
703 static struct f2fs_attr f2fs_attr_##_name = { \
704 .attr = {.name = __stringify(_name), .mode = 0444 }, \
705 .show = f2fs_sbi_show, \
706 .struct_type = _struct_type, \
707 .offset = offsetof(struct _struct_name, _elname), \
710 F2FS_RW_ATTR(GC_THREAD, f2fs_gc_kthread, gc_urgent_sleep_time,
712 F2FS_RW_ATTR(GC_THREAD, f2fs_gc_kthread, gc_min_sleep_time, min_sleep_time);
713 F2FS_RW_ATTR(GC_THREAD, f2fs_gc_kthread, gc_max_sleep_time, max_sleep_time);
714 F2FS_RW_ATTR(GC_THREAD, f2fs_gc_kthread, gc_no_gc_sleep_time, no_gc_sleep_time);
715 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_idle, gc_mode);
716 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_urgent, gc_mode);
717 F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, reclaim_segments, rec_prefree_segments);
718 F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, max_small_discards, max_discards);
719 F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, discard_granularity, discard_granularity);
720 F2FS_RW_ATTR(RESERVED_BLOCKS, f2fs_sb_info, reserved_blocks, reserved_blocks);
721 F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, batched_trim_sections, trim_sections);
722 F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, ipu_policy, ipu_policy);
723 F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, min_ipu_util, min_ipu_util);
724 F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, min_fsync_blocks, min_fsync_blocks);
725 F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, min_seq_blocks, min_seq_blocks);
726 F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, min_hot_blocks, min_hot_blocks);
727 F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, min_ssr_sections, min_ssr_sections);
728 F2FS_RW_ATTR(NM_INFO, f2fs_nm_info, ram_thresh, ram_thresh);
729 F2FS_RW_ATTR(NM_INFO, f2fs_nm_info, ra_nid_pages, ra_nid_pages);
730 F2FS_RW_ATTR(NM_INFO, f2fs_nm_info, dirty_nats_ratio, dirty_nats_ratio);
731 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_victim_search, max_victim_search);
732 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, migration_granularity, migration_granularity);
733 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, dir_level, dir_level);
734 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, cp_interval, interval_time[CP_TIME]);
735 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, idle_interval, interval_time[REQ_TIME]);
736 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, discard_idle_interval,
737 interval_time[DISCARD_TIME]);
738 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_idle_interval, interval_time[GC_TIME]);
739 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info,
740 umount_discard_timeout, interval_time[UMOUNT_DISCARD_TIMEOUT]);
741 #ifdef CONFIG_F2FS_IOSTAT
742 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, iostat_enable, iostat_enable);
743 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, iostat_period_ms, iostat_period_ms);
745 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, readdir_ra, readdir_ra);
746 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_io_bytes, max_io_bytes);
747 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_pin_file_thresh, gc_pin_file_threshold);
748 F2FS_RW_ATTR(F2FS_SBI, f2fs_super_block, extension_list, extension_list);
749 #ifdef CONFIG_F2FS_FAULT_INJECTION
750 F2FS_RW_ATTR(FAULT_INFO_RATE, f2fs_fault_info, inject_rate, inject_rate);
751 F2FS_RW_ATTR(FAULT_INFO_TYPE, f2fs_fault_info, inject_type, inject_type);
753 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, data_io_flag, data_io_flag);
754 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, node_io_flag, node_io_flag);
755 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_urgent_high_remaining, gc_urgent_high_remaining);
756 F2FS_RW_ATTR(CPRC_INFO, ckpt_req_control, ckpt_thread_ioprio, ckpt_thread_ioprio);
757 F2FS_GENERAL_RO_ATTR(dirty_segments);
758 F2FS_GENERAL_RO_ATTR(free_segments);
759 F2FS_GENERAL_RO_ATTR(ovp_segments);
760 F2FS_GENERAL_RO_ATTR(lifetime_write_kbytes);
761 F2FS_GENERAL_RO_ATTR(features);
762 F2FS_GENERAL_RO_ATTR(current_reserved_blocks);
763 F2FS_GENERAL_RO_ATTR(unusable);
764 F2FS_GENERAL_RO_ATTR(encoding);
765 F2FS_GENERAL_RO_ATTR(mounted_time_sec);
766 F2FS_GENERAL_RO_ATTR(main_blkaddr);
767 F2FS_GENERAL_RO_ATTR(pending_discard);
768 #ifdef CONFIG_F2FS_STAT_FS
769 F2FS_STAT_ATTR(STAT_INFO, f2fs_stat_info, cp_foreground_calls, cp_count);
770 F2FS_STAT_ATTR(STAT_INFO, f2fs_stat_info, cp_background_calls, bg_cp_count);
771 F2FS_STAT_ATTR(STAT_INFO, f2fs_stat_info, gc_foreground_calls, call_count);
772 F2FS_STAT_ATTR(STAT_INFO, f2fs_stat_info, gc_background_calls, bg_gc);
773 F2FS_GENERAL_RO_ATTR(moved_blocks_background);
774 F2FS_GENERAL_RO_ATTR(moved_blocks_foreground);
775 F2FS_GENERAL_RO_ATTR(avg_vblocks);
778 #ifdef CONFIG_FS_ENCRYPTION
779 F2FS_FEATURE_RO_ATTR(encryption);
780 F2FS_FEATURE_RO_ATTR(test_dummy_encryption_v2);
781 #ifdef CONFIG_UNICODE
782 F2FS_FEATURE_RO_ATTR(encrypted_casefold);
784 #endif /* CONFIG_FS_ENCRYPTION */
785 #ifdef CONFIG_BLK_DEV_ZONED
786 F2FS_FEATURE_RO_ATTR(block_zoned);
788 F2FS_FEATURE_RO_ATTR(atomic_write);
789 F2FS_FEATURE_RO_ATTR(extra_attr);
790 F2FS_FEATURE_RO_ATTR(project_quota);
791 F2FS_FEATURE_RO_ATTR(inode_checksum);
792 F2FS_FEATURE_RO_ATTR(flexible_inline_xattr);
793 F2FS_FEATURE_RO_ATTR(quota_ino);
794 F2FS_FEATURE_RO_ATTR(inode_crtime);
795 F2FS_FEATURE_RO_ATTR(lost_found);
796 #ifdef CONFIG_FS_VERITY
797 F2FS_FEATURE_RO_ATTR(verity);
799 F2FS_FEATURE_RO_ATTR(sb_checksum);
800 #ifdef CONFIG_UNICODE
801 F2FS_FEATURE_RO_ATTR(casefold);
803 F2FS_FEATURE_RO_ATTR(readonly);
804 #ifdef CONFIG_F2FS_FS_COMPRESSION
805 F2FS_FEATURE_RO_ATTR(compression);
806 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_written_block, compr_written_block);
807 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_saved_block, compr_saved_block);
808 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_new_inode, compr_new_inode);
810 F2FS_FEATURE_RO_ATTR(pin_file);
813 F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_candidate_ratio, candidate_ratio);
814 F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_candidate_count, max_candidate_count);
815 F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_age_weight, age_weight);
816 F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_age_threshold, age_threshold);
818 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, seq_file_ra_mul, seq_file_ra_mul);
819 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_segment_mode, gc_segment_mode);
820 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_reclaimed_segments, gc_reclaimed_segs);
821 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_fragment_chunk, max_fragment_chunk);
822 F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_fragment_hole, max_fragment_hole);
824 #define ATTR_LIST(name) (&f2fs_attr_##name.attr)
825 static struct attribute *f2fs_attrs[] = {
826 ATTR_LIST(gc_urgent_sleep_time),
827 ATTR_LIST(gc_min_sleep_time),
828 ATTR_LIST(gc_max_sleep_time),
829 ATTR_LIST(gc_no_gc_sleep_time),
831 ATTR_LIST(gc_urgent),
832 ATTR_LIST(reclaim_segments),
833 ATTR_LIST(main_blkaddr),
834 ATTR_LIST(max_small_discards),
835 ATTR_LIST(discard_granularity),
836 ATTR_LIST(pending_discard),
837 ATTR_LIST(batched_trim_sections),
838 ATTR_LIST(ipu_policy),
839 ATTR_LIST(min_ipu_util),
840 ATTR_LIST(min_fsync_blocks),
841 ATTR_LIST(min_seq_blocks),
842 ATTR_LIST(min_hot_blocks),
843 ATTR_LIST(min_ssr_sections),
844 ATTR_LIST(max_victim_search),
845 ATTR_LIST(migration_granularity),
846 ATTR_LIST(dir_level),
847 ATTR_LIST(ram_thresh),
848 ATTR_LIST(ra_nid_pages),
849 ATTR_LIST(dirty_nats_ratio),
850 ATTR_LIST(cp_interval),
851 ATTR_LIST(idle_interval),
852 ATTR_LIST(discard_idle_interval),
853 ATTR_LIST(gc_idle_interval),
854 ATTR_LIST(umount_discard_timeout),
855 #ifdef CONFIG_F2FS_IOSTAT
856 ATTR_LIST(iostat_enable),
857 ATTR_LIST(iostat_period_ms),
859 ATTR_LIST(readdir_ra),
860 ATTR_LIST(max_io_bytes),
861 ATTR_LIST(gc_pin_file_thresh),
862 ATTR_LIST(extension_list),
863 #ifdef CONFIG_F2FS_FAULT_INJECTION
864 ATTR_LIST(inject_rate),
865 ATTR_LIST(inject_type),
867 ATTR_LIST(data_io_flag),
868 ATTR_LIST(node_io_flag),
869 ATTR_LIST(gc_urgent_high_remaining),
870 ATTR_LIST(ckpt_thread_ioprio),
871 ATTR_LIST(dirty_segments),
872 ATTR_LIST(free_segments),
873 ATTR_LIST(ovp_segments),
875 ATTR_LIST(lifetime_write_kbytes),
877 ATTR_LIST(reserved_blocks),
878 ATTR_LIST(current_reserved_blocks),
880 ATTR_LIST(mounted_time_sec),
881 #ifdef CONFIG_F2FS_STAT_FS
882 ATTR_LIST(cp_foreground_calls),
883 ATTR_LIST(cp_background_calls),
884 ATTR_LIST(gc_foreground_calls),
885 ATTR_LIST(gc_background_calls),
886 ATTR_LIST(moved_blocks_foreground),
887 ATTR_LIST(moved_blocks_background),
888 ATTR_LIST(avg_vblocks),
890 #ifdef CONFIG_F2FS_FS_COMPRESSION
891 ATTR_LIST(compr_written_block),
892 ATTR_LIST(compr_saved_block),
893 ATTR_LIST(compr_new_inode),
896 ATTR_LIST(atgc_candidate_ratio),
897 ATTR_LIST(atgc_candidate_count),
898 ATTR_LIST(atgc_age_weight),
899 ATTR_LIST(atgc_age_threshold),
900 ATTR_LIST(seq_file_ra_mul),
901 ATTR_LIST(gc_segment_mode),
902 ATTR_LIST(gc_reclaimed_segments),
903 ATTR_LIST(max_fragment_chunk),
904 ATTR_LIST(max_fragment_hole),
907 ATTRIBUTE_GROUPS(f2fs);
909 static struct attribute *f2fs_feat_attrs[] = {
910 #ifdef CONFIG_FS_ENCRYPTION
911 ATTR_LIST(encryption),
912 ATTR_LIST(test_dummy_encryption_v2),
913 #ifdef CONFIG_UNICODE
914 ATTR_LIST(encrypted_casefold),
916 #endif /* CONFIG_FS_ENCRYPTION */
917 #ifdef CONFIG_BLK_DEV_ZONED
918 ATTR_LIST(block_zoned),
920 ATTR_LIST(atomic_write),
921 ATTR_LIST(extra_attr),
922 ATTR_LIST(project_quota),
923 ATTR_LIST(inode_checksum),
924 ATTR_LIST(flexible_inline_xattr),
925 ATTR_LIST(quota_ino),
926 ATTR_LIST(inode_crtime),
927 ATTR_LIST(lost_found),
928 #ifdef CONFIG_FS_VERITY
931 ATTR_LIST(sb_checksum),
932 #ifdef CONFIG_UNICODE
936 #ifdef CONFIG_F2FS_FS_COMPRESSION
937 ATTR_LIST(compression),
942 ATTRIBUTE_GROUPS(f2fs_feat);
944 F2FS_GENERAL_RO_ATTR(sb_status);
945 static struct attribute *f2fs_stat_attrs[] = {
946 ATTR_LIST(sb_status),
949 ATTRIBUTE_GROUPS(f2fs_stat);
951 F2FS_SB_FEATURE_RO_ATTR(encryption, ENCRYPT);
952 F2FS_SB_FEATURE_RO_ATTR(block_zoned, BLKZONED);
953 F2FS_SB_FEATURE_RO_ATTR(extra_attr, EXTRA_ATTR);
954 F2FS_SB_FEATURE_RO_ATTR(project_quota, PRJQUOTA);
955 F2FS_SB_FEATURE_RO_ATTR(inode_checksum, INODE_CHKSUM);
956 F2FS_SB_FEATURE_RO_ATTR(flexible_inline_xattr, FLEXIBLE_INLINE_XATTR);
957 F2FS_SB_FEATURE_RO_ATTR(quota_ino, QUOTA_INO);
958 F2FS_SB_FEATURE_RO_ATTR(inode_crtime, INODE_CRTIME);
959 F2FS_SB_FEATURE_RO_ATTR(lost_found, LOST_FOUND);
960 F2FS_SB_FEATURE_RO_ATTR(verity, VERITY);
961 F2FS_SB_FEATURE_RO_ATTR(sb_checksum, SB_CHKSUM);
962 F2FS_SB_FEATURE_RO_ATTR(casefold, CASEFOLD);
963 F2FS_SB_FEATURE_RO_ATTR(compression, COMPRESSION);
964 F2FS_SB_FEATURE_RO_ATTR(readonly, RO);
966 static struct attribute *f2fs_sb_feat_attrs[] = {
967 ATTR_LIST(sb_encryption),
968 ATTR_LIST(sb_block_zoned),
969 ATTR_LIST(sb_extra_attr),
970 ATTR_LIST(sb_project_quota),
971 ATTR_LIST(sb_inode_checksum),
972 ATTR_LIST(sb_flexible_inline_xattr),
973 ATTR_LIST(sb_quota_ino),
974 ATTR_LIST(sb_inode_crtime),
975 ATTR_LIST(sb_lost_found),
976 ATTR_LIST(sb_verity),
977 ATTR_LIST(sb_sb_checksum),
978 ATTR_LIST(sb_casefold),
979 ATTR_LIST(sb_compression),
980 ATTR_LIST(sb_readonly),
983 ATTRIBUTE_GROUPS(f2fs_sb_feat);
985 static const struct sysfs_ops f2fs_attr_ops = {
986 .show = f2fs_attr_show,
987 .store = f2fs_attr_store,
990 static struct kobj_type f2fs_sb_ktype = {
991 .default_groups = f2fs_groups,
992 .sysfs_ops = &f2fs_attr_ops,
993 .release = f2fs_sb_release,
996 static struct kobj_type f2fs_ktype = {
997 .sysfs_ops = &f2fs_attr_ops,
1000 static struct kset f2fs_kset = {
1001 .kobj = {.ktype = &f2fs_ktype},
1004 static struct kobj_type f2fs_feat_ktype = {
1005 .default_groups = f2fs_feat_groups,
1006 .sysfs_ops = &f2fs_attr_ops,
1009 static struct kobject f2fs_feat = {
1013 static ssize_t f2fs_stat_attr_show(struct kobject *kobj,
1014 struct attribute *attr, char *buf)
1016 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info,
1018 struct f2fs_attr *a = container_of(attr, struct f2fs_attr, attr);
1020 return a->show ? a->show(a, sbi, buf) : 0;
1023 static ssize_t f2fs_stat_attr_store(struct kobject *kobj, struct attribute *attr,
1024 const char *buf, size_t len)
1026 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info,
1028 struct f2fs_attr *a = container_of(attr, struct f2fs_attr, attr);
1030 return a->store ? a->store(a, sbi, buf, len) : 0;
1033 static void f2fs_stat_kobj_release(struct kobject *kobj)
1035 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info,
1037 complete(&sbi->s_stat_kobj_unregister);
1040 static const struct sysfs_ops f2fs_stat_attr_ops = {
1041 .show = f2fs_stat_attr_show,
1042 .store = f2fs_stat_attr_store,
1045 static struct kobj_type f2fs_stat_ktype = {
1046 .default_groups = f2fs_stat_groups,
1047 .sysfs_ops = &f2fs_stat_attr_ops,
1048 .release = f2fs_stat_kobj_release,
1051 static ssize_t f2fs_sb_feat_attr_show(struct kobject *kobj,
1052 struct attribute *attr, char *buf)
1054 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info,
1055 s_feature_list_kobj);
1056 struct f2fs_attr *a = container_of(attr, struct f2fs_attr, attr);
1058 return a->show ? a->show(a, sbi, buf) : 0;
1061 static void f2fs_feature_list_kobj_release(struct kobject *kobj)
1063 struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info,
1064 s_feature_list_kobj);
1065 complete(&sbi->s_feature_list_kobj_unregister);
1068 static const struct sysfs_ops f2fs_feature_list_attr_ops = {
1069 .show = f2fs_sb_feat_attr_show,
1072 static struct kobj_type f2fs_feature_list_ktype = {
1073 .default_groups = f2fs_sb_feat_groups,
1074 .sysfs_ops = &f2fs_feature_list_attr_ops,
1075 .release = f2fs_feature_list_kobj_release,
1078 static int __maybe_unused segment_info_seq_show(struct seq_file *seq,
1081 struct super_block *sb = seq->private;
1082 struct f2fs_sb_info *sbi = F2FS_SB(sb);
1083 unsigned int total_segs =
1084 le32_to_cpu(sbi->raw_super->segment_count_main);
1087 seq_puts(seq, "format: segment_type|valid_blocks\n"
1088 "segment_type(0:HD, 1:WD, 2:CD, 3:HN, 4:WN, 5:CN)\n");
1090 for (i = 0; i < total_segs; i++) {
1091 struct seg_entry *se = get_seg_entry(sbi, i);
1094 seq_printf(seq, "%-10d", i);
1095 seq_printf(seq, "%d|%-3u", se->type, se->valid_blocks);
1096 if ((i % 10) == 9 || i == (total_segs - 1))
1097 seq_putc(seq, '\n');
1105 static int __maybe_unused segment_bits_seq_show(struct seq_file *seq,
1108 struct super_block *sb = seq->private;
1109 struct f2fs_sb_info *sbi = F2FS_SB(sb);
1110 unsigned int total_segs =
1111 le32_to_cpu(sbi->raw_super->segment_count_main);
1114 seq_puts(seq, "format: segment_type|valid_blocks|bitmaps\n"
1115 "segment_type(0:HD, 1:WD, 2:CD, 3:HN, 4:WN, 5:CN)\n");
1117 for (i = 0; i < total_segs; i++) {
1118 struct seg_entry *se = get_seg_entry(sbi, i);
1120 seq_printf(seq, "%-10d", i);
1121 seq_printf(seq, "%d|%-3u|", se->type, se->valid_blocks);
1122 for (j = 0; j < SIT_VBLOCK_MAP_SIZE; j++)
1123 seq_printf(seq, " %.2x", se->cur_valid_map[j]);
1124 seq_putc(seq, '\n');
1129 static int __maybe_unused victim_bits_seq_show(struct seq_file *seq,
1132 struct super_block *sb = seq->private;
1133 struct f2fs_sb_info *sbi = F2FS_SB(sb);
1134 struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
1137 seq_puts(seq, "format: victim_secmap bitmaps\n");
1139 for (i = 0; i < MAIN_SECS(sbi); i++) {
1141 seq_printf(seq, "%-10d", i);
1142 seq_printf(seq, "%d", test_bit(i, dirty_i->victim_secmap) ? 1 : 0);
1143 if ((i % 10) == 9 || i == (MAIN_SECS(sbi) - 1))
1144 seq_putc(seq, '\n');
1151 int __init f2fs_init_sysfs(void)
1155 kobject_set_name(&f2fs_kset.kobj, "f2fs");
1156 f2fs_kset.kobj.parent = fs_kobj;
1157 ret = kset_register(&f2fs_kset);
1161 ret = kobject_init_and_add(&f2fs_feat, &f2fs_feat_ktype,
1164 kobject_put(&f2fs_feat);
1165 kset_unregister(&f2fs_kset);
1167 f2fs_proc_root = proc_mkdir("fs/f2fs", NULL);
1172 void f2fs_exit_sysfs(void)
1174 kobject_put(&f2fs_feat);
1175 kset_unregister(&f2fs_kset);
1176 remove_proc_entry("fs/f2fs", NULL);
1177 f2fs_proc_root = NULL;
1180 int f2fs_register_sysfs(struct f2fs_sb_info *sbi)
1182 struct super_block *sb = sbi->sb;
1185 sbi->s_kobj.kset = &f2fs_kset;
1186 init_completion(&sbi->s_kobj_unregister);
1187 err = kobject_init_and_add(&sbi->s_kobj, &f2fs_sb_ktype, NULL,
1192 sbi->s_stat_kobj.kset = &f2fs_kset;
1193 init_completion(&sbi->s_stat_kobj_unregister);
1194 err = kobject_init_and_add(&sbi->s_stat_kobj, &f2fs_stat_ktype,
1195 &sbi->s_kobj, "stat");
1199 sbi->s_feature_list_kobj.kset = &f2fs_kset;
1200 init_completion(&sbi->s_feature_list_kobj_unregister);
1201 err = kobject_init_and_add(&sbi->s_feature_list_kobj,
1202 &f2fs_feature_list_ktype,
1203 &sbi->s_kobj, "feature_list");
1205 goto put_feature_list_kobj;
1208 sbi->s_proc = proc_mkdir(sb->s_id, f2fs_proc_root);
1211 proc_create_single_data("segment_info", 0444, sbi->s_proc,
1212 segment_info_seq_show, sb);
1213 proc_create_single_data("segment_bits", 0444, sbi->s_proc,
1214 segment_bits_seq_show, sb);
1215 #ifdef CONFIG_F2FS_IOSTAT
1216 proc_create_single_data("iostat_info", 0444, sbi->s_proc,
1217 iostat_info_seq_show, sb);
1219 proc_create_single_data("victim_bits", 0444, sbi->s_proc,
1220 victim_bits_seq_show, sb);
1223 put_feature_list_kobj:
1224 kobject_put(&sbi->s_feature_list_kobj);
1225 wait_for_completion(&sbi->s_feature_list_kobj_unregister);
1227 kobject_put(&sbi->s_stat_kobj);
1228 wait_for_completion(&sbi->s_stat_kobj_unregister);
1230 kobject_put(&sbi->s_kobj);
1231 wait_for_completion(&sbi->s_kobj_unregister);
1235 void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi)
1238 #ifdef CONFIG_F2FS_IOSTAT
1239 remove_proc_entry("iostat_info", sbi->s_proc);
1241 remove_proc_entry("segment_info", sbi->s_proc);
1242 remove_proc_entry("segment_bits", sbi->s_proc);
1243 remove_proc_entry("victim_bits", sbi->s_proc);
1244 remove_proc_entry(sbi->sb->s_id, f2fs_proc_root);
1247 kobject_del(&sbi->s_stat_kobj);
1248 kobject_put(&sbi->s_stat_kobj);
1249 wait_for_completion(&sbi->s_stat_kobj_unregister);
1250 kobject_del(&sbi->s_feature_list_kobj);
1251 kobject_put(&sbi->s_feature_list_kobj);
1252 wait_for_completion(&sbi->s_feature_list_kobj_unregister);
1254 kobject_del(&sbi->s_kobj);
1255 kobject_put(&sbi->s_kobj);
1256 wait_for_completion(&sbi->s_kobj_unregister);