Commit 17162f41 authored by Sergey Senozhatsky's avatar Sergey Senozhatsky Committed by Linus Torvalds

zram: cosmetic zram_bvec_write() cleanup

`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: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: default avatarMinchan Kim <minchan@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6566d1a3
...@@ -642,8 +642,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, ...@@ -642,8 +642,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
struct page *page; struct page *page;
unsigned char *user_mem, *cmem, *src, *uncmem = NULL; unsigned char *user_mem, *cmem, *src, *uncmem = NULL;
struct zram_meta *meta = zram->meta; struct zram_meta *meta = zram->meta;
struct zcomp_strm *zstrm; struct zcomp_strm *zstrm = NULL;
bool locked = false;
unsigned long alloced_pages; unsigned long alloced_pages;
page = bvec->bv_page; page = bvec->bv_page;
...@@ -663,7 +662,6 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, ...@@ -663,7 +662,6 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
} }
zstrm = zcomp_strm_find(zram->comp); zstrm = zcomp_strm_find(zram->comp);
locked = true;
user_mem = kmap_atomic(page); user_mem = kmap_atomic(page);
if (is_partial_io(bvec)) { if (is_partial_io(bvec)) {
...@@ -735,7 +733,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, ...@@ -735,7 +733,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
} }
zcomp_strm_release(zram->comp, zstrm); zcomp_strm_release(zram->comp, zstrm);
locked = false; zstrm = NULL;
zs_unmap_object(meta->mem_pool, handle); zs_unmap_object(meta->mem_pool, handle);
/* /*
...@@ -753,7 +751,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, ...@@ -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_add(clen, &zram->stats.compr_data_size);
atomic64_inc(&zram->stats.pages_stored); atomic64_inc(&zram->stats.pages_stored);
out: out:
if (locked) if (zstrm)
zcomp_strm_release(zram->comp, zstrm); zcomp_strm_release(zram->comp, zstrm);
if (is_partial_io(bvec)) if (is_partial_io(bvec))
kfree(uncmem); kfree(uncmem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment