Skip to content

Commit

Permalink
zram: cosmetic zram_bvec_write() cleanup
Browse files Browse the repository at this point in the history
`bool locked' local variable tells us if we should perform
zcomp_strm_release() or not (jumped to `out' label before
zcomp_strm_find() occurred), which is equivalent to `zstrm' being or not
being NULL.  remove `locked' and check `zstrm' instead.

Signed-off-by: Sergey Senozhatsky <[email protected]>
Acked-by: Minchan Kim <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
sergey-senozhatsky authored and torvalds committed Jun 26, 2015
1 parent 6566d1a commit 17162f4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/block/zram/zram_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
struct page *page;
unsigned char *user_mem, *cmem, *src, *uncmem = NULL;
struct zram_meta *meta = zram->meta;
struct zcomp_strm *zstrm;
bool locked = false;
struct zcomp_strm *zstrm = NULL;
unsigned long alloced_pages;

page = bvec->bv_page;
Expand All @@ -663,7 +662,6 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
}

zstrm = zcomp_strm_find(zram->comp);
locked = true;
user_mem = kmap_atomic(page);

if (is_partial_io(bvec)) {
Expand Down Expand Up @@ -735,7 +733,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
}

zcomp_strm_release(zram->comp, zstrm);
locked = false;
zstrm = NULL;
zs_unmap_object(meta->mem_pool, handle);

/*
Expand All @@ -753,7 +751,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
atomic64_add(clen, &zram->stats.compr_data_size);
atomic64_inc(&zram->stats.pages_stored);
out:
if (locked)
if (zstrm)
zcomp_strm_release(zram->comp, zstrm);
if (is_partial_io(bvec))
kfree(uncmem);
Expand Down

0 comments on commit 17162f4

Please sign in to comment.