cp_comp_type should be 8 bits, as llch_compr_type and all associated
variables are declared as u8.
So remove useless cp_comp_enabled and fix code to test for compressed
component with cp_comp_type against LL_COMPR_TYPE_NONE.
And update LL_COMPR_TYPE_MAX value to 255 to avoid conflicts with
future compression types.
Fixes:
f43b9ce9af ("EX-6127 osc: osc brw request compression")
Test-Parameters: trivial
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: Ia15868ac0ac003b62942540a57f782226ae8c141
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51481
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
/* which slab kmem index this memory allocated from */
short int cp_kmem_index; /* 48 bits */
/** Compression type **/
- enum ll_compr_type cp_comp_type:4;
+ enum ll_compr_type cp_comp_type:8;
/** Compression level **/
u8 cp_comp_level:4;
- /** Compression enabled **/
- u8 cp_comp_enabled:1;
/** Chunk Size **/
- u8 cp_chunk_log_bits:7; /* 64 bits */
+ u8 cp_chunk_log_bits:4; /* 64 bits */
/**
* Owning IO in cl_page_state::CPS_OWNED state. Sub-page can be owned
* by sub-io. Protected by a VM lock.
LL_COMPR_TYPE_LZ4HC = 5,
LL_COMPR_TYPE_LZO = 6,
LL_COMPR_TYPE_MAX,
- LL_COMPR_TYPE_UNCHANGED = 15
+ LL_COMPR_TYPE_UNCHANGED = 255
};
#define COMPR_CHUNK_MIN_BITS 16
lse->lsme_pattern,
lse->lsme_layout_gen, lse->lsme_stripe_count,
lse->lsme_stripe_size, lse->lsme_pool_name);
- if (lse->lsme_compr_type > 0) {
+ if (lse->lsme_compr_type != LL_COMPR_TYPE_NONE) {
CDEBUG(level, " compr_type %u, compr_lvl %u, "
"compr_chunk_log_bits %u\n",
lse->lsme_compr_type,
lsme = lsm->lsm_entries[0];
/* No support for compressed yet. */
- if (cl_io_is_fallocate(parent) && lsme->lsme_compr_type) {
+ if (cl_io_is_fallocate(parent) &&
+ lsme->lsme_compr_type != LL_COMPR_TYPE_NONE) {
struct lov_io *lio = cl2lov_io(env, ios);
struct lov_object *loo = lio->lis_object;
struct lov_stripe_md_entry *lsme)
{
if (lsme->lsme_pattern & LOV_PATTERN_COMPRESS) {
- page->cp_comp_enabled = true;
page->cp_comp_type = lsme->lsme_compr_type;
page->cp_comp_level = lsme->lsme_compr_lvl;
page->cp_chunk_log_bits = lsme->lsme_compr_chunk_log_bits;
lsme = lsm->lsm_entries[0];
/* No support for compressed yet. */
- if (lsme->lsme_compr_type)
+ if (lsme->lsme_compr_type != LL_COMPR_TYPE_NONE)
GOTO(out_lsm, rc = -EOPNOTSUPP);
if (!(fiemap->fm_flags & FIEMAP_FLAG_DEVICE_ORDER)) {
* - last chunk in the request is not compressed to
* preserve the right size of object
*/
- if (clpage->cp_comp_type && applied_type &&
- (pga_i != page_count - 1)) {
+ if (clpage->cp_comp_type != LL_COMPR_TYPE_NONE &&
+ applied_type && (pga_i != page_count - 1)) {
done = compress_chunk(obd_name, oa, src,
src_size, dst, &dst_size,
wrkmem, clpage,
&applied_type);
- CDEBUG(D_SEC, "Compressed %u, plain %u, rc %i\n",
+ CDEBUG(D_SEC,
+ "Compressed %u, plain %u, rc %i\n",
dst_size, src_size, done);
} else {
done = 0;
* If compression disabled for the file -1 is set to
* all pages, so it is enough to check only one
* */
- if ((oap2cl_page(brw_page2oap(pga[0])))->cp_comp_enabled
- == false) {
+ if ((oap2cl_page(brw_page2oap(pga[0])))->cp_comp_type
+ == LL_COMPR_TYPE_NONE) {
compressed = 0;
goto skip_compression;
}
if (comp == NULL)
goto fail;
- /* type 0 means this is not a compress component */
+ /* type LL_COMPR_TYPE_NONE means this is not a compress component */
comp->llc_compr_type = type;
if (type == LL_COMPR_TYPE_NONE)
return 0;