diff options
author | Jiri Kosina <jkosina@suse.cz> | 2010-10-30 22:16:56 +0200 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2010-10-30 22:16:56 +0200 |
commit | f1e095f1d206b81b44160f41278ce5c78641e9b7 (patch) | |
tree | bd293d46d2d3e4cdf435a22ddb2877c6ba1b8acc /drivers/staging/zram/zram_drv.h | |
parent | telephony: fix return value (diff) | |
parent | Merge branch 'for-linus' of git://git.infradead.org/users/eparis/notify (diff) | |
download | linux-dev-f1e095f1d206b81b44160f41278ce5c78641e9b7.tar.xz linux-dev-f1e095f1d206b81b44160f41278ce5c78641e9b7.zip |
Merge branch 'master' into for-next
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 945f9740442f..a48155112b1e 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 |