summaryrefslogtreecommitdiff
path: root/drivers/staging/zcache
diff options
context:
space:
mode:
authorWanpeng Li <liwanp@linux.vnet.ibm.com>2013-04-02 06:46:15 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-02 23:49:51 +0400
commitb0749e77ae972713c1734cea069f32597ecedbd5 (patch)
treeef99772356a2cae06f105456ffdb747995d71a4b /drivers/staging/zcache
parent8762c7dde745f1de0488c6a3ed6894390303f76f (diff)
downloadlinux-b0749e77ae972713c1734cea069f32597ecedbd5.tar.xz
staging: zcache: handle zcache_[eph|pers]_zpages for zero-filled page
Increment/decrement zcache_[eph|pers]_zpages for zero-filled pages, the main point of the counters for zpages and pageframes is to be able to calculate density == zpages/pageframes. A zero-filled page becomes a zpage that "compresses" to zero bytes and, as a result, requires zero pageframes for storage. So the zpages counter should be increased but the pageframes counter should not. [Dan Magenheimer <dan.magenheimer@oracle.com>: patch description] Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/zcache')
-rw-r--r--drivers/staging/zcache/zcache-main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 927d5fdaa3b1..1994cab6edf1 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -648,6 +648,8 @@ static int zcache_pampd_get_data_and_free(char *data, size_t *sizep, bool raw,
if (pampd == (void *)ZERO_FILLED) {
handle_zero_filled_page(data);
zero_filled = true;
+ zsize = 0;
+ zpages = 1;
if (!raw)
*sizep = PAGE_SIZE;
goto zero_fill;
@@ -696,8 +698,11 @@ static void zcache_pampd_free(void *pampd, struct tmem_pool *pool,
BUG_ON(preemptible());
- if (pampd == (void *)ZERO_FILLED)
+ if (pampd == (void *)ZERO_FILLED) {
zero_filled = true;
+ zsize = 0;
+ zpages = 1;
+ }
if (pampd_is_remote(pampd) && !zero_filled) {
BUG_ON(!ramster_enabled);