Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 317247
b: refs/heads/master
c: 374a691
h: refs/heads/master
i:
  317245: 209ff32
  317243: 601fe7f
  317239: 9cfb209
  317231: 80342cb
  317215: a610484
  317183: 4374de8
v: v3
  • Loading branch information
Minchan Kim authored and Greg Kroah-Hartman committed Jun 11, 2012
1 parent 522dd78 commit fb5d0a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c234434835b1f4bad9bdbae6710044cba387c9e5
refs/heads/master: 374a69191d12a0525b7ffe1197abc30c4795a230
15 changes: 8 additions & 7 deletions trunk/drivers/staging/zram/zram_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,26 +280,27 @@ static int zram_read_before_write(struct zram *zram, char *mem, u32 index)
size_t clen = PAGE_SIZE;
struct zobj_header *zheader;
unsigned char *cmem;
unsigned long handle = zram->table[index].handle;

if (zram_test_flag(zram, index, ZRAM_ZERO) ||
!zram->table[index].handle) {
if (zram_test_flag(zram, index, ZRAM_ZERO) || !handle) {
memset(mem, 0, PAGE_SIZE);
return 0;
}

cmem = zs_map_object(zram->mem_pool, zram->table[index].handle);

/* Page is stored uncompressed since it's incompressible */
if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) {
memcpy(mem, cmem, PAGE_SIZE);
kunmap_atomic(cmem);
char *src = kmap_atomic((struct page *)handle);
memcpy(mem, src, PAGE_SIZE);
kunmap_atomic(src);
return 0;
}

cmem = zs_map_object(zram->mem_pool, handle);

ret = lzo1x_decompress_safe(cmem + sizeof(*zheader),
zram->table[index].size,
mem, &clen);
zs_unmap_object(zram->mem_pool, zram->table[index].handle);
zs_unmap_object(zram->mem_pool, handle);

/* Should NEVER happen. Return bio error if it does. */
if (unlikely(ret != LZO_E_OK)) {
Expand Down

0 comments on commit fb5d0a5

Please sign in to comment.