]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/staging/zram/zram_drv.c
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / drivers / staging / zram / zram_drv.c
index d0e9e0207539e2c9491fc6c1de25c75dda4bd9c6..4bd8cbdaee76fe8de24b4d88bf0543314f285410 100644 (file)
@@ -227,6 +227,7 @@ static int zram_read(struct zram *zram, struct bio *bio)
 
                if (zram_test_flag(zram, index, ZRAM_ZERO)) {
                        handle_zero_page(page);
+                       index++;
                        continue;
                }
 
@@ -235,12 +236,14 @@ static int zram_read(struct zram *zram, struct bio *bio)
                        pr_debug("Read before write: sector=%lu, size=%u",
                                (ulong)(bio->bi_sector), bio->bi_size);
                        /* Do nothing */
+                       index++;
                        continue;
                }
 
                /* Page is stored uncompressed since it's incompressible */
                if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) {
                        handle_uncompressed_page(zram, page, index);
+                       index++;
                        continue;
                }
 
@@ -320,6 +323,7 @@ static int zram_write(struct zram *zram, struct bio *bio)
                        mutex_unlock(&zram->lock);
                        zram_stat_inc(&zram->stats.pages_zero);
                        zram_set_flag(zram, index, ZRAM_ZERO);
+                       index++;
                        continue;
                }
 
@@ -527,7 +531,7 @@ int zram_init_device(struct zram *zram)
        }
 
        num_pages = zram->disksize >> PAGE_SHIFT;
-       zram->table = vmalloc(num_pages * sizeof(*zram->table));
+       zram->table = vzalloc(num_pages * sizeof(*zram->table));
        if (!zram->table) {
                pr_err("Error allocating zram address table\n");
                /* To prevent accessing table entries during cleanup */
@@ -535,7 +539,6 @@ int zram_init_device(struct zram *zram)
                ret = -ENOMEM;
                goto fail;
        }
-       memset(zram->table, 0, num_pages * sizeof(*zram->table));
 
        set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT);