aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/zram
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2015-05-05 19:23:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-05-05 20:10:10 -0400
commit99ebbd30e3640f6addb37f222b4d6ad4b807d9ea (patch)
tree4d2c84d1eaa83b8a48f3aeece8ff7245eb5aa315 /drivers/block/zram
parentd9cee5d4f66ef36f69b0108dedbad7f7009bb6a8 (diff)
revert "zram: move compact_store() to sysfs functions area"
Revert commit c72c6160d967ed26a0b136dbab337f821d233509 It was intended to be a cosmetic change that w/o any functional change and was part of a bigger change: http://lkml.iu.edu/hypermail/linux/kernel/1503.1/01818.html Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: 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.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index c94386aa563d..8dcbced0eafd 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -74,6 +74,27 @@ static inline struct zram *dev_to_zram(struct device *dev)
74 return (struct zram *)dev_to_disk(dev)->private_data; 74 return (struct zram *)dev_to_disk(dev)->private_data;
75} 75}
76 76
77static ssize_t compact_store(struct device *dev,
78 struct device_attribute *attr, const char *buf, size_t len)
79{
80 unsigned long nr_migrated;
81 struct zram *zram = dev_to_zram(dev);
82 struct zram_meta *meta;
83
84 down_read(&zram->init_lock);
85 if (!init_done(zram)) {
86 up_read(&zram->init_lock);
87 return -EINVAL;
88 }
89
90 meta = zram->meta;
91 nr_migrated = zs_compact(meta->mem_pool);
92 atomic64_add(nr_migrated, &zram->stats.num_migrated);
93 up_read(&zram->init_lock);
94
95 return len;
96}
97
77static ssize_t disksize_show(struct device *dev, 98static ssize_t disksize_show(struct device *dev,
78 struct device_attribute *attr, char *buf) 99 struct device_attribute *attr, char *buf)
79{ 100{
@@ -1038,6 +1059,7 @@ static const struct block_device_operations zram_devops = {
1038 .owner = THIS_MODULE 1059 .owner = THIS_MODULE
1039}; 1060};
1040 1061
1062static DEVICE_ATTR_WO(compact);
1041static DEVICE_ATTR_RW(disksize); 1063static DEVICE_ATTR_RW(disksize);
1042static DEVICE_ATTR_RO(initstate); 1064static DEVICE_ATTR_RO(initstate);
1043static DEVICE_ATTR_WO(reset); 1065static DEVICE_ATTR_WO(reset);
@@ -1114,6 +1136,7 @@ static struct attribute *zram_disk_attrs[] = {
1114 &dev_attr_num_writes.attr, 1136 &dev_attr_num_writes.attr,
1115 &dev_attr_failed_reads.attr, 1137 &dev_attr_failed_reads.attr,
1116 &dev_attr_failed_writes.attr, 1138 &dev_attr_failed_writes.attr,
1139 &dev_attr_compact.attr,
1117 &dev_attr_invalid_io.attr, 1140 &dev_attr_invalid_io.attr,
1118 &dev_attr_notify_free.attr, 1141 &dev_attr_notify_free.attr,
1119 &dev_attr_zero_pages.attr, 1142 &dev_attr_zero_pages.attr,