Re: [PATCH 2/6] zram: move compact_store() to sysfs functions area
On Wed, Mar 11, 2015 at 12:08:30AM +0900, Sergey Senozhatsky wrote: > 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 Acked-by: Minchan Kim I should have done by myself. Thanks, Sergey! -- Kind regards, Minchan Kim -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/6] zram: move compact_store() to sysfs functions area
On Wed, Mar 11, 2015 at 12:08:30AM +0900, Sergey Senozhatsky wrote: 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.senozhat...@gmail.com Acked-by: Minchan Kim minc...@kernel.org I should have done by myself. Thanks, Sergey! -- Kind regards, Minchan Kim -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/6] 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 --- drivers/block/zram/zram_drv.c | 42 +- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 2009a5a..472c40c 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -67,27 +67,6 @@ static inline struct zram *dev_to_zram(struct device *dev) return (struct zram *)dev_to_disk(dev)->private_data; } -static ssize_t compact_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) -{ - unsigned long nr_migrated; - struct zram *zram = dev_to_zram(dev); - struct zram_meta *meta; - - down_read(>init_lock); - if (!init_done(zram)) { - up_read(>init_lock); - return -EINVAL; - } - - meta = zram->meta; - nr_migrated = zs_compact(meta->mem_pool); - atomic64_add(nr_migrated, >stats.num_migrated); - up_read(>init_lock); - - return len; -} - /* flag operations require table entry bit_spin_lock() being held */ static int zram_test_flag(struct zram_meta *meta, u32 index, enum zram_pageflags flag) @@ -384,6 +363,27 @@ static ssize_t comp_algorithm_store(struct device *dev, return len; } +static ssize_t compact_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t len) +{ + unsigned long nr_migrated; + struct zram *zram = dev_to_zram(dev); + struct zram_meta *meta; + + down_read(>init_lock); + if (!init_done(zram)) { + up_read(>init_lock); + return -EINVAL; + } + + meta = zram->meta; + nr_migrated = zs_compact(meta->mem_pool); + atomic64_add(nr_migrated, >stats.num_migrated); + up_read(>init_lock); + + return len; +} + ZRAM_ATTR_RO(num_reads); ZRAM_ATTR_RO(num_writes); ZRAM_ATTR_RO(failed_reads); -- 2.3.2.209.gd67f9d5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/6] 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.senozhat...@gmail.com --- drivers/block/zram/zram_drv.c | 42 +- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 2009a5a..472c40c 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -67,27 +67,6 @@ static inline struct zram *dev_to_zram(struct device *dev) return (struct zram *)dev_to_disk(dev)-private_data; } -static ssize_t compact_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) -{ - unsigned long nr_migrated; - struct zram *zram = dev_to_zram(dev); - struct zram_meta *meta; - - down_read(zram-init_lock); - if (!init_done(zram)) { - up_read(zram-init_lock); - return -EINVAL; - } - - meta = zram-meta; - nr_migrated = zs_compact(meta-mem_pool); - atomic64_add(nr_migrated, zram-stats.num_migrated); - up_read(zram-init_lock); - - return len; -} - /* flag operations require table entry bit_spin_lock() being held */ static int zram_test_flag(struct zram_meta *meta, u32 index, enum zram_pageflags flag) @@ -384,6 +363,27 @@ static ssize_t comp_algorithm_store(struct device *dev, return len; } +static ssize_t compact_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t len) +{ + unsigned long nr_migrated; + struct zram *zram = dev_to_zram(dev); + struct zram_meta *meta; + + down_read(zram-init_lock); + if (!init_done(zram)) { + up_read(zram-init_lock); + return -EINVAL; + } + + meta = zram-meta; + nr_migrated = zs_compact(meta-mem_pool); + atomic64_add(nr_migrated, zram-stats.num_migrated); + up_read(zram-init_lock); + + return len; +} + ZRAM_ATTR_RO(num_reads); ZRAM_ATTR_RO(num_writes); ZRAM_ATTR_RO(failed_reads); -- 2.3.2.209.gd67f9d5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/