On Fri, Apr 21, 2017 at 10:14:50AM +0900, js1...@gmail.com wrote:
> From: Joonsoo Kim <iamjoonsoo....@lge.com>
> 
> Benefit of deduplication is dependent on the workload so it's not
> preferable to always enable. Therefore, make it optional in Kconfig
> and device param. Default is 'off'. This option will be beneficial
> for users who use the zram as blockdev and stores build output to it.
> 
> Signed-off-by: Joonsoo Kim <iamjoonsoo....@lge.com>

< snip >

>  
>  static struct attribute *zram_disk_attrs[] = {
>       &dev_attr_disksize.attr,
> @@ -1169,6 +1227,7 @@ static struct attribute *zram_disk_attrs[] = {
>       &dev_attr_mem_used_max.attr,
>       &dev_attr_max_comp_streams.attr,
>       &dev_attr_comp_algorithm.attr,
> +     &dev_attr_use_dedup.attr,
>       &dev_attr_io_stat.attr,
>       &dev_attr_mm_stat.attr,
>       &dev_attr_debug_stat.attr,
> diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h
> index 4b86921..3f7649a 100644
> --- a/drivers/block/zram/zram_drv.h
> +++ b/drivers/block/zram/zram_drv.h
> @@ -134,7 +134,12 @@ struct zram {
>        * zram is claimed so open request will be failed
>        */
>       bool claim; /* Protected by bdev->bd_mutex */
> +     bool use_dedup;
>  };
>  
> +static inline bool zram_dedup_enabled(struct zram *zram)
> +{
> +     return zram->use_dedup;

#ifdef CONFIG_ZRAM_DEDUP
        return zram->use_dedup;
#else
        return false;
#endif

Otherwise, looks good to me.

Reply via email to