Tidy up lblk percpu stuff
This commit is contained in:
parent
f90c744a38
commit
309bb2d5ef
|
@ -105,7 +105,7 @@ struct lblk_compress_state {
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct lblk_compress_state*
|
static struct lblk_compress_state*
|
||||||
lblk_get_compress_state(void* percpu, const struct cbd_params* params, int cpu)
|
lblk_get_compress_state(void* percpu, int cpu)
|
||||||
{
|
{
|
||||||
struct lblk_compress_state** statep;
|
struct lblk_compress_state** statep;
|
||||||
|
|
||||||
|
@ -122,11 +122,8 @@ lblk_compress_lz4(struct lbd* lbd)
|
||||||
struct lblk_compress_state* state;
|
struct lblk_compress_state* state;
|
||||||
|
|
||||||
cpu = get_cpu();
|
cpu = get_cpu();
|
||||||
state = lblk_get_compress_state(lbd->percpu, lbd->params, cpu);
|
state = lblk_get_compress_state(lbd->percpu, cpu);
|
||||||
if (!state) {
|
BUG_ON(state == NULL);
|
||||||
put_cpu();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
clen = LZ4_compress_fast(lbd->buf, state->buf,
|
clen = LZ4_compress_fast(lbd->buf, state->buf,
|
||||||
PBLK_SIZE * lblk_per_pblk(lbd->params),
|
PBLK_SIZE * lblk_per_pblk(lbd->params),
|
||||||
PBLK_SIZE * (lblk_per_pblk(lbd->params) - 1),
|
PBLK_SIZE * (lblk_per_pblk(lbd->params) - 1),
|
||||||
|
@ -150,11 +147,8 @@ lblk_decompress_lz4(struct lbd* lbd)
|
||||||
u32 dlen = PBLK_SIZE * lblk_per_pblk(lbd->params);
|
u32 dlen = PBLK_SIZE * lblk_per_pblk(lbd->params);
|
||||||
|
|
||||||
cpu = get_cpu();
|
cpu = get_cpu();
|
||||||
state = lblk_get_compress_state(lbd->percpu, lbd->params, cpu);
|
state = lblk_get_compress_state(lbd->percpu, cpu);
|
||||||
if (!state) {
|
BUG_ON(state == NULL);
|
||||||
put_cpu();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ret = LZ4_decompress_safe(lbd->buf,
|
ret = LZ4_decompress_safe(lbd->buf,
|
||||||
state->buf,
|
state->buf,
|
||||||
lbd->c_len,
|
lbd->c_len,
|
||||||
|
@ -181,11 +175,8 @@ lblk_compress_zlib(struct lbd* lbd)
|
||||||
z_stream* stream;
|
z_stream* stream;
|
||||||
|
|
||||||
cpu = get_cpu();
|
cpu = get_cpu();
|
||||||
state = lblk_get_compress_state(lbd->percpu, lbd->params, cpu);
|
state = lblk_get_compress_state(lbd->percpu, cpu);
|
||||||
if (!state) {
|
BUG_ON(state == NULL);
|
||||||
put_cpu();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
stream = &state->zlib_cstream;
|
stream = &state->zlib_cstream;
|
||||||
ret = zlib_deflateReset(stream);
|
ret = zlib_deflateReset(stream);
|
||||||
BUG_ON(ret != Z_OK);
|
BUG_ON(ret != Z_OK);
|
||||||
|
@ -215,11 +206,8 @@ lblk_decompress_zlib(struct lbd* lbd)
|
||||||
u32 dlen = PBLK_SIZE * lblk_per_pblk(lbd->params);
|
u32 dlen = PBLK_SIZE * lblk_per_pblk(lbd->params);
|
||||||
|
|
||||||
cpu = get_cpu();
|
cpu = get_cpu();
|
||||||
state = lblk_get_compress_state(lbd->percpu, lbd->params, cpu);
|
state = lblk_get_compress_state(lbd->percpu, cpu);
|
||||||
if (!state) {
|
BUG_ON(state == NULL);
|
||||||
put_cpu();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
stream = &state->zlib_dstream;
|
stream = &state->zlib_dstream;
|
||||||
ret = zlib_inflateReset(stream);
|
ret = zlib_inflateReset(stream);
|
||||||
BUG_ON(ret != Z_OK);
|
BUG_ON(ret != Z_OK);
|
||||||
|
|
Loading…
Reference in New Issue