|
@@ -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;
|
|
|
|
- bool locked = false;
|
|
|
|
|
|
+ struct zcomp_strm *zstrm = NULL;
|
|
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,
|
|
}
|
|
}
|
|
|
|
|
|
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,
|
|
}
|
|
}
|
|
|
|
|
|
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,
|
|
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);
|