zram: remove unnecessary free
authorMinchan Kim <minchan@kernel.org>
Thu, 30 Jan 2014 23:46:01 +0000 (15:46 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 31 Jan 2014 00:56:55 +0000 (16:56 -0800)
Commit a0c516cbfc74 ("zram: don't grab mutex in zram_slot_free_noity")
introduced pending zram slot free in zram's write path in case of
missing slot free by memory allocation failure in zram_slot_free_notify
but it is not necessary because we have already freed the slot right
before overwriting.

Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Jerome Marchand <jmarchan@redhat.com>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/block/zram/zram_drv.c

index d87c7e98fb1117ee37a987df505f59eca80c2f00..ebfddd852272eb60172af99ccdbc2232b6a5ba74 100644 (file)
@@ -441,14 +441,6 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
                goto out;
        }
 
-       /*
-        * zram_slot_free_notify could miss free so that let's
-        * double check.
-        */
-       if (unlikely(meta->table[index].handle ||
-                       zram_test_flag(meta, index, ZRAM_ZERO)))
-               zram_free_page(zram, index);
-
        ret = lzo1x_1_compress(uncmem, PAGE_SIZE, src, &clen,
                               meta->compress_workmem);