diff options
author | Sergey Senozhatsky <sergey.senozhatsky@gmail.com> | 2015-04-15 19:15:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-15 19:35:21 -0400 |
commit | c72c6160d967ed26a0b136dbab337f821d233509 (patch) | |
tree | 65c38726e1260d222c1785fb257ff38560df590e /drivers/block/zram | |
parent | 10447b60bee52f026bdbc5fe2aca52d0492fc91d (diff) |
zram: move compact_store() to sysfs functions area
A cosmetic change. We have a new code layout and keep zram per-device
sysfs store and show functions in one place. Move compact_store() to that
handlers block to conform to current layout.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block/zram')
-rw-r--r-- | drivers/block/zram/zram_drv.c | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index f416e3ce6392..871bd3550cb0 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
@@ -63,27 +63,6 @@ static inline struct zram *dev_to_zram(struct device *dev) | |||
63 | return (struct zram *)dev_to_disk(dev)->private_data; | 63 | return (struct zram *)dev_to_disk(dev)->private_data; |
64 | } | 64 | } |
65 | 65 | ||
66 | static ssize_t compact_store(struct device *dev, | ||
67 | struct device_attribute *attr, const char *buf, size_t len) | ||
68 | { | ||
69 | unsigned long nr_migrated; | ||
70 | struct zram *zram = dev_to_zram(dev); | ||
71 | struct zram_meta *meta; | ||
72 | |||
73 | down_read(&zram->init_lock); | ||
74 | if (!init_done(zram)) { | ||
75 | up_read(&zram->init_lock); | ||
76 | return -EINVAL; | ||
77 | } | ||
78 | |||
79 | meta = zram->meta; | ||
80 | nr_migrated = zs_compact(meta->mem_pool); | ||
81 | atomic64_add(nr_migrated, &zram->stats.num_migrated); | ||
82 | up_read(&zram->init_lock); | ||
83 | |||
84 | return len; | ||
85 | } | ||
86 | |||
87 | static ssize_t disksize_show(struct device *dev, | 66 | static ssize_t disksize_show(struct device *dev, |
88 | struct device_attribute *attr, char *buf) | 67 | struct device_attribute *attr, char *buf) |
89 | { | 68 | { |
@@ -1038,7 +1017,6 @@ static const struct block_device_operations zram_devops = { | |||
1038 | .owner = THIS_MODULE | 1017 | .owner = THIS_MODULE |
1039 | }; | 1018 | }; |
1040 | 1019 | ||
1041 | static DEVICE_ATTR_WO(compact); | ||
1042 | static DEVICE_ATTR_RW(disksize); | 1020 | static DEVICE_ATTR_RW(disksize); |
1043 | static DEVICE_ATTR_RO(initstate); | 1021 | static DEVICE_ATTR_RO(initstate); |
1044 | static DEVICE_ATTR_WO(reset); | 1022 | static DEVICE_ATTR_WO(reset); |
@@ -1066,7 +1044,6 @@ static struct attribute *zram_disk_attrs[] = { | |||
1066 | &dev_attr_num_writes.attr, | 1044 | &dev_attr_num_writes.attr, |
1067 | &dev_attr_failed_reads.attr, | 1045 | &dev_attr_failed_reads.attr, |
1068 | &dev_attr_failed_writes.attr, | 1046 | &dev_attr_failed_writes.attr, |
1069 | &dev_attr_compact.attr, | ||
1070 | &dev_attr_invalid_io.attr, | 1047 | &dev_attr_invalid_io.attr, |
1071 | &dev_attr_notify_free.attr, | 1048 | &dev_attr_notify_free.attr, |
1072 | &dev_attr_zero_pages.attr, | 1049 | &dev_attr_zero_pages.attr, |