zram: use zram_free_page instead of open-coded
Subsystems (2)
PATCH 84/102 zram: use zram_free_page instead of open-coded
From: Minchan Kim <[email protected]>
Subject: zram: use zram_free_page instead of open-coded
The zram_free_page already handles NULL handle case and same page so use it to reduce error probability. (Acutaully, I made a mistake when I handled same page feature)
Signed-off-by Minchan Kim <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc Johannes Thumshirn <[email protected]>
Cc Sergey Senozhatsky <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
drivers/block/zram/zram_drv.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/block/zram/zram_drv.c renamed from drivers/block/zram/zram_drv.c~zram-use-zram_free_page-instead-of-open-coded +2 -11
@@ -480,17 +480,8 @@ static void zram_meta_free(struct zram *size_t index;/* Free all pages that are still in this zram device */ -for (index =0 ; index < num_pages; index++) { -unsigned long handle =zram_get_handle (zram, index); -/* -* No memory is allocated for same element filled pages. -* Simply clear same page flag. -*/ -if (!handle ||zram_test_flag (zram, index,ZRAM_SAME )) -continue ; - -zs_free (zram->mem_pool, handle); - } +for (index =0 ; index < num_pages; index++) +zram_free_page (zram, index);zs_destroy_pool (zram->mem_pool);vfree (zram->table);
@@ -978,9 +969,6 @@ static void zram_reset_device(struct zra comp = zram->comp; disksize = zram->disksize;