sysfs.c (611ac726f9ebbb12f2113e5345ef109660954eeb) sysfs.c (07c6b5933ebf58b6132aea9f3e72a62486882bfb)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * f2fs sysfs interface
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 * Copyright (c) 2017 Chao Yu <chao@kernel.org>
8 */

--- 293 unchanged lines hidden (view full) ---

302
303 if (!strcmp(a->attr.name, "compr_saved_block"))
304 return sysfs_emit(buf, "%llu\n", sbi->compr_saved_block);
305
306 if (!strcmp(a->attr.name, "compr_new_inode"))
307 return sysfs_emit(buf, "%u\n", sbi->compr_new_inode);
308#endif
309
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * f2fs sysfs interface
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 * Copyright (c) 2017 Chao Yu <chao@kernel.org>
8 */

--- 293 unchanged lines hidden (view full) ---

302
303 if (!strcmp(a->attr.name, "compr_saved_block"))
304 return sysfs_emit(buf, "%llu\n", sbi->compr_saved_block);
305
306 if (!strcmp(a->attr.name, "compr_new_inode"))
307 return sysfs_emit(buf, "%u\n", sbi->compr_new_inode);
308#endif
309
310 if (!strcmp(a->attr.name, "gc_segment_mode"))
311 return sysfs_emit(buf, "%u\n", sbi->gc_segment_mode);
312
313 if (!strcmp(a->attr.name, "gc_reclaimed_segments")) {
314 return sysfs_emit(buf, "%u\n",
315 sbi->gc_reclaimed_segs[sbi->gc_segment_mode]);
316 }
317
310 ui = (unsigned int *)(ptr + a->offset);
311
312 return sprintf(buf, "%u\n", *ui);
313}
314
315static ssize_t __sbi_store(struct f2fs_attr *a,
316 struct f2fs_sb_info *sbi,
317 const char *buf, size_t count)

--- 192 unchanged lines hidden (view full) ---

510
511 if (!strcmp(a->attr.name, "atgc_age_weight")) {
512 if (t > 100)
513 return -EINVAL;
514 sbi->am.age_weight = t;
515 return count;
516 }
517
318 ui = (unsigned int *)(ptr + a->offset);
319
320 return sprintf(buf, "%u\n", *ui);
321}
322
323static ssize_t __sbi_store(struct f2fs_attr *a,
324 struct f2fs_sb_info *sbi,
325 const char *buf, size_t count)

--- 192 unchanged lines hidden (view full) ---

518
519 if (!strcmp(a->attr.name, "atgc_age_weight")) {
520 if (t > 100)
521 return -EINVAL;
522 sbi->am.age_weight = t;
523 return count;
524 }
525
526 if (!strcmp(a->attr.name, "gc_segment_mode")) {
527 if (t < MAX_GC_MODE)
528 sbi->gc_segment_mode = t;
529 else
530 return -EINVAL;
531 return count;
532 }
533
534 if (!strcmp(a->attr.name, "gc_reclaimed_segments")) {
535 if (t != 0)
536 return -EINVAL;
537 sbi->gc_reclaimed_segs[sbi->gc_segment_mode] = 0;
538 return count;
539 }
540
518 *ui = (unsigned int)t;
519
520 return count;
521}
522
523static ssize_t f2fs_sbi_store(struct f2fs_attr *a,
524 struct f2fs_sb_info *sbi,
525 const char *buf, size_t count)

--- 209 unchanged lines hidden (view full) ---

735F2FS_FEATURE_RO_ATTR(pin_file);
736
737/* For ATGC */
738F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_candidate_ratio, candidate_ratio);
739F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_candidate_count, max_candidate_count);
740F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_age_weight, age_weight);
741F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_age_threshold, age_threshold);
742
541 *ui = (unsigned int)t;
542
543 return count;
544}
545
546static ssize_t f2fs_sbi_store(struct f2fs_attr *a,
547 struct f2fs_sb_info *sbi,
548 const char *buf, size_t count)

--- 209 unchanged lines hidden (view full) ---

758F2FS_FEATURE_RO_ATTR(pin_file);
759
760/* For ATGC */
761F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_candidate_ratio, candidate_ratio);
762F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_candidate_count, max_candidate_count);
763F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_age_weight, age_weight);
764F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_age_threshold, age_threshold);
765
766F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_segment_mode, gc_segment_mode);
767F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_reclaimed_segments, gc_reclaimed_segs);
768
743#define ATTR_LIST(name) (&f2fs_attr_##name.attr)
744static struct attribute *f2fs_attrs[] = {
745 ATTR_LIST(gc_urgent_sleep_time),
746 ATTR_LIST(gc_min_sleep_time),
747 ATTR_LIST(gc_max_sleep_time),
748 ATTR_LIST(gc_no_gc_sleep_time),
749 ATTR_LIST(gc_idle),
750 ATTR_LIST(gc_urgent),

--- 56 unchanged lines hidden (view full) ---

807 ATTR_LIST(compr_saved_block),
808 ATTR_LIST(compr_new_inode),
809#endif
810 /* For ATGC */
811 ATTR_LIST(atgc_candidate_ratio),
812 ATTR_LIST(atgc_candidate_count),
813 ATTR_LIST(atgc_age_weight),
814 ATTR_LIST(atgc_age_threshold),
769#define ATTR_LIST(name) (&f2fs_attr_##name.attr)
770static struct attribute *f2fs_attrs[] = {
771 ATTR_LIST(gc_urgent_sleep_time),
772 ATTR_LIST(gc_min_sleep_time),
773 ATTR_LIST(gc_max_sleep_time),
774 ATTR_LIST(gc_no_gc_sleep_time),
775 ATTR_LIST(gc_idle),
776 ATTR_LIST(gc_urgent),

--- 56 unchanged lines hidden (view full) ---

833 ATTR_LIST(compr_saved_block),
834 ATTR_LIST(compr_new_inode),
835#endif
836 /* For ATGC */
837 ATTR_LIST(atgc_candidate_ratio),
838 ATTR_LIST(atgc_candidate_count),
839 ATTR_LIST(atgc_age_weight),
840 ATTR_LIST(atgc_age_threshold),
841 ATTR_LIST(gc_segment_mode),
842 ATTR_LIST(gc_reclaimed_segments),
815 NULL,
816};
817ATTRIBUTE_GROUPS(f2fs);
818
819static struct attribute *f2fs_feat_attrs[] = {
820#ifdef CONFIG_FS_ENCRYPTION
821 ATTR_LIST(encryption),
822 ATTR_LIST(test_dummy_encryption_v2),

--- 436 unchanged lines hidden ---
843 NULL,
844};
845ATTRIBUTE_GROUPS(f2fs);
846
847static struct attribute *f2fs_feat_attrs[] = {
848#ifdef CONFIG_FS_ENCRYPTION
849 ATTR_LIST(encryption),
850 ATTR_LIST(test_dummy_encryption_v2),

--- 436 unchanged lines hidden ---