diff options
Diffstat (limited to 'drivers/staging/zram/zram_drv.h')
-rw-r--r-- | drivers/staging/zram/zram_drv.h | 57 |
1 files changed, 12 insertions, 45 deletions
diff --git a/drivers/staging/zram/zram_drv.h b/drivers/staging/zram/zram_drv.h index 945f974..a481551 100644 --- a/drivers/staging/zram/zram_drv.h +++ b/drivers/staging/zram/zram_drv.h @@ -18,7 +18,6 @@ #include <linux/spinlock.h> #include <linux/mutex.h> -#include "zram_ioctl.h" #include "xvmalloc.h" /* @@ -85,11 +84,7 @@ struct table { } __attribute__((aligned(4))); struct zram_stats { - /* basic stats */ - size_t compr_size; /* compressed size of pages stored - - * needed to enforce memlimit */ - /* more stats */ -#if defined(CONFIG_ZRAM_STATS) + u64 compr_size; /* compressed size of pages stored */ u64 num_reads; /* failed + successful */ u64 num_writes; /* --do-- */ u64 failed_reads; /* should NEVER! happen */ @@ -100,7 +95,6 @@ struct zram_stats { u32 pages_stored; /* no. of pages currently stored */ u32 good_compress; /* % of pages with compression ratio<=50% */ u32 pages_expand; /* % of incompressible pages */ -#endif }; struct zram { @@ -114,51 +108,24 @@ struct zram { struct request_queue *queue; struct gendisk *disk; int init_done; + /* Prevent concurrent execution of device init and reset */ + struct mutex init_lock; /* * This is the limit on amount of *uncompressed* worth of data * we can store in a disk. */ - size_t disksize; /* bytes */ + u64 disksize; /* bytes */ struct zram_stats stats; }; -/*-- */ - -/* Debugging and Stats */ -#if defined(CONFIG_ZRAM_STATS) -static void zram_stat_inc(u32 *v) -{ - *v = *v + 1; -} - -static void zram_stat_dec(u32 *v) -{ - *v = *v - 1; -} - -static void zram_stat64_inc(struct zram *zram, u64 *v) -{ - spin_lock(&zram->stat64_lock); - *v = *v + 1; - spin_unlock(&zram->stat64_lock); -} - -static u64 zram_stat64_read(struct zram *zram, u64 *v) -{ - u64 val; - - spin_lock(&zram->stat64_lock); - val = *v; - spin_unlock(&zram->stat64_lock); - - return val; -} -#else -#define zram_stat_inc(v) -#define zram_stat_dec(v) -#define zram_stat64_inc(r, v) -#define zram_stat64_read(r, v) -#endif /* CONFIG_ZRAM_STATS */ +extern struct zram *devices; +extern unsigned int num_devices; +#ifdef CONFIG_SYSFS +extern struct attribute_group zram_disk_attr_group; +#endif + +extern int zram_init_device(struct zram *zram); +extern void zram_reset_device(struct zram *zram); #endif |