u32 *page_count)
{
struct cl_page *clpage;
- unsigned int applied_type = LL_COMPR_TYPE_UNCHANGED;
+ enum ll_compr_type applied_type = LL_COMPR_TYPE_UNCHANGED;
+ enum ll_compr_type type;
bool compressed = false;
unsigned int src_size;
unsigned int dst_size;
int chunk_start = 0;
int pages_per_chunk;
+ int chunk_log_bits;
int dest_buf_bits;
int src_buf_bits;
void *src = NULL;
int count = 0;
int rc = 0;
int pga_i;
+ int lvl;
ENTRY;
- clpage = oap2cl_page(brw_page2oap(pga[chunk_start]));
+ clpage = oap2cl_page(brw_page2oap(pga[0]));
+ lvl = clpage->cp_comp_level;
+ type = clpage->cp_comp_type;
+ chunk_log_bits = clpage->cp_chunk_log_bits;
+
chunk_bits = cl_page_compr_bits(clpage);
chunk_size = (1 << chunk_bits);
pages_per_chunk = chunk_size / PAGE_SIZE;
if (*cpga == NULL || src == NULL)
GOTO(out, rc = -ENOMEM);
+ CDEBUG(D_SEC, "Compression type %i, level %i\n", type, lvl);
+
for (pga_i = 0; pga_i < *page_count; pga_i++) {
if ((pga_i + 1 - chunk_start == pages_per_chunk) ||
(pga_i == *page_count - 1) ||
!can_merge_pages(pga[pga_i], pga[pga_i + 1])) {
- clpage = oap2cl_page(brw_page2oap(pga[chunk_start]));
- /* TDB: change chunk size, reallocate src.
- * NB: This shouldn't happen as long as RPCs are for
- * a single component/object
- */
- CDEBUG(D_SEC, "Chunk [%i,%i], type %i, level %i\n",
- chunk_start, pga_i, clpage->cp_comp_type,
- clpage->cp_comp_level);
+ CDEBUG(D_SEC, "Chunk [%i,%i]\n", chunk_start, pga_i);
merge_chunk(pga, NULL, chunk_start,
pga_i + 1 - chunk_start, src, &src_size);
* - applied_type == 0 if no supported algorithms
* found during the previous compress_chunk call
*/
- if (clpage->cp_comp_type != LL_COMPR_TYPE_NONE &&
- applied_type) {
+ if (applied_type) {
compressed = compress_chunk(obd_name, src,
src_size, dst, &dst_size,
- clpage->cp_comp_type,
- clpage->cp_comp_level,
- clpage->cp_chunk_log_bits,
+ type, lvl, chunk_log_bits,
&applied_type);
CDEBUG(D_SEC,
"%s: rc %d: inode "DFID"\n",