Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354349
b: refs/heads/master
c: 3de738c
h: refs/heads/master
i:
  354347: 802575c
v: v3
  • Loading branch information
Minchan Kim authored and Greg Kroah-Hartman committed Feb 4, 2013
1 parent bb85c5a commit 74d98b6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 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: 0231c403bb065307493fe997ad170487b4d55eb8
refs/heads/master: 3de738cd30306f754ea35d35b5dad29fdbec84c9
20 changes: 4 additions & 16 deletions trunk/drivers/staging/zram/zram_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,26 +442,22 @@ static void zram_make_request(struct request_queue *queue, struct bio *bio)
{
struct zram *zram = queue->queuedata;

if (unlikely(!zram->init_done) && zram_init_device(zram))
goto error;

down_read(&zram->init_lock);
if (unlikely(!zram->init_done))
goto error_unlock;
goto error;

if (!valid_io_request(zram, bio)) {
zram_stat64_inc(zram, &zram->stats.invalid_io);
goto error_unlock;
goto error;
}

__zram_make_request(zram, bio, bio_data_dir(bio));
up_read(&zram->init_lock);

return;

error_unlock:
up_read(&zram->init_lock);
error:
up_read(&zram->init_lock);
bio_io_error(bio);
}

Expand Down Expand Up @@ -510,18 +506,12 @@ void zram_reset_device(struct zram *zram)
up_write(&zram->init_lock);
}

/* zram->init_lock should be held */
int zram_init_device(struct zram *zram)
{
int ret;
size_t num_pages;

down_write(&zram->init_lock);

if (zram->init_done) {
up_write(&zram->init_lock);
return 0;
}

if (zram->disksize > 2 * (totalram_pages << PAGE_SHIFT)) {
pr_info(
"There is little point creating a zram of greater than "
Expand Down Expand Up @@ -570,7 +560,6 @@ int zram_init_device(struct zram *zram)
}

zram->init_done = 1;
up_write(&zram->init_lock);

pr_debug("Initialization done!\n");
return 0;
Expand All @@ -580,7 +569,6 @@ int zram_init_device(struct zram *zram)
zram->disksize = 0;
fail:
__zram_reset_device(zram);
up_write(&zram->init_lock);
pr_err("Initialization failed: err=%d\n", ret);
return ret;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/staging/zram/zram_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ static ssize_t disksize_store(struct device *dev,

zram->disksize = PAGE_ALIGN(disksize);
set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT);
zram_init_device(zram);
up_write(&zram->init_lock);

return len;
Expand Down

0 comments on commit 74d98b6

Please sign in to comment.