aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/ramzswap
diff options
context:
space:
mode:
authorNitin Gupta <ngupta@vflare.org>2010-01-28 21:13:41 +0530
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-03 16:42:53 -0800
commit2e882281742f7e483e751bbbaf6c0946b5f8513f (patch)
tree8bc191e244b3865b2a244a07db9bb4c002525789 /drivers/staging/ramzswap
parentde1a21a0f1f614dac0d8cacc13f41e32a15bba98 (diff)
Staging: ramzswap: Remove redundant check for zero page
ramzswap_free_page() already handles the case for zero filled pages. So, remove redundant logic for the same in ramzswap_write(). Signed-off-by: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/ramzswap')
-rw-r--r--drivers/staging/ramzswap/ramzswap_drv.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/staging/ramzswap/ramzswap_drv.c b/drivers/staging/ramzswap/ramzswap_drv.c
index 3035addfaed..7e0a3fab9cd 100644
--- a/drivers/staging/ramzswap/ramzswap_drv.c
+++ b/drivers/staging/ramzswap/ramzswap_drv.c
@@ -593,6 +593,10 @@ static void ramzswap_free_page(struct ramzswap *rzs, size_t index)
u32 offset = rzs->table[index].offset;
if (unlikely(!page)) {
+ /*
+ * No memory is allocated for zero filled pages.
+ * Simply clear zero page flag.
+ */
if (rzs_test_flag(rzs, index, RZS_ZERO)) {
rzs_clear_flag(rzs, index, RZS_ZERO);
rzs_stat_dec(&rzs->stats.pages_zero);
@@ -789,18 +793,9 @@ static int ramzswap_write(struct ramzswap *rzs, struct bio *bio)
* is no longer referenced by any process. So, its now safe
* to free the memory that was allocated for this page.
*/
- if (rzs->table[index].page)
+ if (rzs->table[index].page || rzs_test_flag(rzs, index, RZS_ZERO))
ramzswap_free_page(rzs, index);
- /*
- * No memory is allocated for zero filled pages.
- * Simply clear zero page flag.
- */
- if (rzs_test_flag(rzs, index, RZS_ZERO)) {
- rzs_stat_dec(&rzs->stats.pages_zero);
- rzs_clear_flag(rzs, index, RZS_ZERO);
- }
-
mutex_lock(&rzs->lock);
user_mem = kmap_atomic(page, KM_USER0);