Permalink
Browse files

zram: block I/O error fix

  • Loading branch information...
damentz authored and heftig committed Oct 24, 2012
1 parent 79f8dc8 commit ac5de538f14c8c1ff335d150d9ca9bc6dda77b4c
Showing with 7 additions and 2 deletions.
  1. +7 −2 drivers/staging/zram/zram_drv.c
@@ -265,8 +265,13 @@ static int zram_read_before_write(struct zram *zram, char *mem, u32 index)
}
cmem = zs_map_object(zram->mem_pool, handle, ZS_MM_RO);
- ret = lzo1x_decompress_safe(cmem, zram->table[index].size,
- mem, &clen);
+ if (zram->table[index].size == PAGE_SIZE) {
+ memcpy(mem, cmem, PAGE_SIZE);
+ ret = LZO_E_OK;
+ } else {
+ ret = lzo1x_decompress_safe(cmem, zram->table[index].size,
+ mem, &clen);
+ }
zs_unmap_object(zram->mem_pool, handle);
/* Should NEVER happen. Return bio error if it does. */

0 comments on commit ac5de53

Please sign in to comment.