sysfs.c (6f10f7d1b02b1bbc305f88d7696445dd38b13881) sysfs.c (1fae7cf05293d3a2c9e59c1bc59372322386467c)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * bcache sysfs interfaces
4 *
5 * Copyright 2010, 2011 Kent Overstreet <kent.overstreet@gmail.com>
6 * Copyright 2012 Google, Inc.
7 */
8

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

454 struct bcache_device *d = container_of(kobj, struct bcache_device,
455 kobj);
456 struct uuid_entry *u = &d->c->uuids[d->id];
457
458 sysfs_strtoul(data_csum, d->data_csum);
459
460 if (attr == &sysfs_size) {
461 uint64_t v;
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * bcache sysfs interfaces
4 *
5 * Copyright 2010, 2011 Kent Overstreet <kent.overstreet@gmail.com>
6 * Copyright 2012 Google, Inc.
7 */
8

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

454 struct bcache_device *d = container_of(kobj, struct bcache_device,
455 kobj);
456 struct uuid_entry *u = &d->c->uuids[d->id];
457
458 sysfs_strtoul(data_csum, d->data_csum);
459
460 if (attr == &sysfs_size) {
461 uint64_t v;
462
462 strtoi_h_or_return(buf, v);
463
464 u->sectors = v >> 9;
465 bch_uuid_write(d->c);
466 set_capacity(d->disk, u->sectors);
467 }
468
469 if (attr == &sysfs_label) {

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

698 SET_CACHE_SYNC(&c->sb, sync);
699 bcache_write_super(c);
700 }
701 }
702
703 if (attr == &sysfs_flash_vol_create) {
704 int r;
705 uint64_t v;
463 strtoi_h_or_return(buf, v);
464
465 u->sectors = v >> 9;
466 bch_uuid_write(d->c);
467 set_capacity(d->disk, u->sectors);
468 }
469
470 if (attr == &sysfs_label) {

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

699 SET_CACHE_SYNC(&c->sb, sync);
700 bcache_write_super(c);
701 }
702 }
703
704 if (attr == &sysfs_flash_vol_create) {
705 int r;
706 uint64_t v;
707
706 strtoi_h_or_return(buf, v);
707
708 r = bch_flash_dev_create(c, v);
709 if (r)
710 return r;
711 }
712
713 if (attr == &sysfs_clear_stats) {

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

731 * thread takes effect.
732 */
733 atomic_set(&c->sectors_to_gc, -1);
734 wake_up_gc(c);
735 }
736
737 if (attr == &sysfs_prune_cache) {
738 struct shrink_control sc;
708 strtoi_h_or_return(buf, v);
709
710 r = bch_flash_dev_create(c, v);
711 if (r)
712 return r;
713 }
714
715 if (attr == &sysfs_clear_stats) {

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

733 * thread takes effect.
734 */
735 atomic_set(&c->sectors_to_gc, -1);
736 wake_up_gc(c);
737 }
738
739 if (attr == &sysfs_prune_cache) {
740 struct shrink_control sc;
741
739 sc.gfp_mask = GFP_KERNEL;
740 sc.nr_to_scan = strtoul_or_return(buf);
741 c->shrink.scan_objects(&c->shrink, &sc);
742 }
743
744 sysfs_strtoul(congested_read_threshold_us,
745 c->congested_read_threshold_us);
746 sysfs_strtoul(congested_write_threshold_us,

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

784
785 return size;
786}
787STORE_LOCKED(bch_cache_set)
788
789SHOW(bch_cache_set_internal)
790{
791 struct cache_set *c = container_of(kobj, struct cache_set, internal);
742 sc.gfp_mask = GFP_KERNEL;
743 sc.nr_to_scan = strtoul_or_return(buf);
744 c->shrink.scan_objects(&c->shrink, &sc);
745 }
746
747 sysfs_strtoul(congested_read_threshold_us,
748 c->congested_read_threshold_us);
749 sysfs_strtoul(congested_write_threshold_us,

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

787
788 return size;
789}
790STORE_LOCKED(bch_cache_set)
791
792SHOW(bch_cache_set_internal)
793{
794 struct cache_set *c = container_of(kobj, struct cache_set, internal);
795
792 return bch_cache_set_show(&c->kobj, attr, buf);
793}
794
795STORE(bch_cache_set_internal)
796{
797 struct cache_set *c = container_of(kobj, struct cache_set, internal);
796 return bch_cache_set_show(&c->kobj, attr, buf);
797}
798
799STORE(bch_cache_set_internal)
800{
801 struct cache_set *c = container_of(kobj, struct cache_set, internal);
802
798 return bch_cache_set_store(&c->kobj, attr, buf, size);
799}
800
801static void bch_cache_set_internal_release(struct kobject *k)
802{
803}
804
805static struct attribute *bch_cache_set_files[] = {

--- 229 unchanged lines hidden ---
803 return bch_cache_set_store(&c->kobj, attr, buf, size);
804}
805
806static void bch_cache_set_internal_release(struct kobject *k)
807{
808}
809
810static struct attribute *bch_cache_set_files[] = {

--- 229 unchanged lines hidden ---