linux-next: manual merge of the staging tree with Linus' tree

From: Stephen Rothwell
Date: Wed Jan 16 2013 - 21:35:27 EST


Hi Greg,

Today's linux-next merge of the staging tree got a conflict in
drivers/staging/zram/zram_drv.c between commit 397c60668aa5 ("staging:
zram: fix invalid memory references during disk write") from Linus' tree
and commit d178a07c4bd3 ("staging: zram: drop zram_stat_dec/inc
functions") from the staging tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx

diff --cc drivers/staging/zram/zram_drv.c
index f2a73bd,6762b99..0000000
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@@ -300,19 -291,17 +289,19 @@@ static int zram_bvec_write(struct zram

user_mem = kmap_atomic(page);

- if (is_partial_io(bvec))
+ if (is_partial_io(bvec)) {
memcpy(uncmem + offset, user_mem + bvec->bv_offset,
bvec->bv_len);
- else
+ kunmap_atomic(user_mem);
+ user_mem = NULL;
+ } else {
uncmem = user_mem;
+ }

if (page_zero_filled(uncmem)) {
- kunmap_atomic(user_mem);
- if (is_partial_io(bvec))
- kfree(uncmem);
+ if (!is_partial_io(bvec))
+ kunmap_atomic(user_mem);
- zram_stat_inc(&zram->stats.pages_zero);
+ zram->stats.pages_zero++;
zram_set_flag(zram, index, ZRAM_ZERO);
ret = 0;
goto out;
@@@ -333,11 -320,9 +322,11 @@@
}

if (unlikely(clen > max_zpage_size)) {
- zram_stat_inc(&zram->stats.bad_compress);
+ zram->stats.bad_compress++;
- src = uncmem;
clen = PAGE_SIZE;
+ src = NULL;
+ if (is_partial_io(bvec))
+ src = uncmem;
}

handle = zs_malloc(zram->mem_pool, clen);
@@@ -362,14 -343,13 +351,14 @@@

/* Update stats */
zram_stat64_add(zram, &zram->stats.compr_size, clen);
- zram_stat_inc(&zram->stats.pages_stored);
+ zram->stats.pages_stored++;
if (clen <= PAGE_SIZE / 2)
- zram_stat_inc(&zram->stats.good_compress);
+ zram->stats.good_compress++;

- return 0;
-
out:
+ if (is_partial_io(bvec))
+ kfree(uncmem);
+
if (ret)
zram_stat64_inc(zram, &zram->stats.failed_writes);
return ret;

Attachment: pgp00000.pgp
Description: PGP signature