enum ll_compr_type type, int lvl,
int chunk_size, bool write)
{
- struct ll_compr_hdr *llch = NULL;
+ struct ll_compr_hdr llch;
struct crypto_comp *cc = NULL;
int pages_in_chunk = chunk_size / PAGE_SIZE;
/* dst_size must be initialized for kernel compression code */
*/
CDEBUG(D_SEC,
"chunk_size %d, layout: type %d, lvl %d, disk: type %d, lvl %d\n",
- chunk_size, type, lvl, llch->llch_compr_type,
- llch->llch_compr_level);
+ chunk_size, type, lvl, llch.llch_compr_type,
+ llch.llch_compr_level);
if (chunk_size !=
- COMPR_GET_CHUNK_SIZE(llch->llch_chunk_log_bits)) {
+ COMPR_GET_CHUNK_SIZE(llch.llch_chunk_log_bits)) {
CERROR("%s: chunk size disagreement: "DFID" at %llu: layout %d, from disk %d\n",
obd_name, PFID(fid), lnbs[lnb_start].lnb_file_offset,
chunk_size,
- COMPR_GET_CHUNK_SIZE(llch->llch_chunk_log_bits));
+ COMPR_GET_CHUNK_SIZE(llch.llch_chunk_log_bits));
/* compression type and level can disagree with layout, we just
* dump them for debugging
*/
CERROR("layout: type %d, lvl %d, disk: type %d, lvl %d\n",
- type, lvl, llch->llch_compr_type, llch->llch_compr_level);
+ type, lvl, llch.llch_compr_type, llch.llch_compr_level);
GOTO(out, rc = -EINVAL);
}
- type = llch->llch_compr_type;
- lvl = llch->llch_compr_level;
- hdr_size = llch->llch_header_size;
+ type = llch.llch_compr_type;
+ lvl = llch.llch_compr_level;
+ hdr_size = llch.llch_header_size;
rc = alloc_decompr(obd_name, &type, &lvl, &cc);
if (rc) {
CERROR("%s: Setup for decompression failed: "DFID" at %llu: type %i, lvl %d: rc = %d\n",
rc = decompress_chunk(obd_name, cc,
((char *) bounce_src) + hdr_size,
- llch->llch_compr_size,
+ llch.llch_compr_size,
(char *) bounce_dst, &dst_size, type,
lvl);
if (rc != 0) {
CERROR("%s: Failed to decompress: "DFID", %d byte chunk at %llu: rc = %d\n",
- obd_name, PFID(fid), llch->llch_compr_size,
+ obd_name, PFID(fid), llch.llch_compr_size,
lnbs[lnb_start].lnb_file_offset, rc);
GOTO(out, rc);
}
/* uncompressed size is not set by older clients, but older clients
* reliably zero unused parts of the header, so we skip if it's zero
*/
- if (llch->llch_uncompr_size != 0 && dst_size != llch->llch_uncompr_size) {
+ if (llch.llch_uncompr_size != 0 && dst_size != llch.llch_uncompr_size) {
CERROR("%s: object invalid, size %d != %d: "DFID" at %llu: rc = %d\n",
- obd_name, llch->llch_uncompr_size, dst_size, PFID(fid),
+ obd_name, llch.llch_uncompr_size, dst_size, PFID(fid),
lnbs[lnb_start].lnb_file_offset, rc);
GOTO(out, rc = -EUCLEAN);
}
{
struct brw_page **pga = aa->aa_ppga;
struct osc_async_page *oap = NULL;
- struct ll_compr_hdr *llch = NULL;
+ struct ll_compr_hdr llch;
struct client_obd *cli = aa->aa_cli;
char *obd_name = cli->cl_import->imp_obd->obd_name;
enum ll_compr_type type = LL_COMPR_TYPE_NONE;
* In the future it may be that the type is also changing in
* a single component, so handle this properly if that happens.
*/
- if (unlikely(cc && type != llch->llch_compr_type)) {
+ if (unlikely(cc && type != llch.llch_compr_type)) {
crypto_free_comp(cc);
cc = NULL;
}
if (!cc) {
- type = llch->llch_compr_type;
- lvl = llch->llch_compr_level;
+ type = llch.llch_compr_type;
+ lvl = llch.llch_compr_level;
rc = alloc_decompr(obd_name, &type, &lvl, &cc);
if (rc)
GOTO(out, rc);
if (!src) { /* get chunk size once */
int rpc_chunk_bits;
- rpc_chunk_bits = llch->llch_chunk_log_bits +
+ rpc_chunk_bits = llch.llch_chunk_log_bits +
COMPR_CHUNK_MIN_BITS;
/* the chunk bits from storage must be the same as from
* the layout (but don't assert on it, since it comes
GOTO(out, rc = -ENOMEM);
}
- compressed_bytes = llch->llch_compr_size + sizeof(*llch);
+ compressed_bytes = llch.llch_compr_size + sizeof(llch);
compressed_pages = ((compressed_bytes - 1) >> PAGE_SHIFT) + 1;
CDEBUG(D_SEC, "compressed bytes %d compressed pages %d\n",
compressed_bytes, compressed_pages);
}
dst_size = 2 * chunk_size;
CDEBUG(D_SEC, "Compressed size %lu, type %i\n",
- llch->llch_compr_size + sizeof(*llch), type);
+ llch.llch_compr_size + sizeof(llch), type);
rc = decompress_chunk(obd_name, cc,
- src + llch->llch_header_size,
- llch->llch_compr_size, dst, &dst_size,
+ src + llch.llch_header_size,
+ llch.llch_compr_size, dst, &dst_size,
type, lvl);
if (rc)
GOTO(out, rc);