From: Patrick Farrell Date: Fri, 10 Nov 2023 22:19:00 +0000 (-0500) Subject: EX-7601 osc: cleanup compression variables X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=c0a8fd4c4189a3bfd1c95c49f0c1c87940a79610;p=fs%2Flustre-release.git EX-7601 osc: cleanup compression variables Make usage of the compression variables more readable. Test-Parameters: trivial Signed-off-by: Patrick Farrell Change-Id: I6daff56b56877c8f36e02303cc0579ba7faa731b Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53099 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/lustre/osc/osc_compress.c b/lustre/osc/osc_compress.c index 263b896..93a0de1 100644 --- a/lustre/osc/osc_compress.c +++ b/lustre/osc/osc_compress.c @@ -117,12 +117,14 @@ int compress_request(const char *obd_name, struct obdo *oa, 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; @@ -133,10 +135,15 @@ int compress_request(const char *obd_name, struct obdo *oa, 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; @@ -149,18 +156,13 @@ int compress_request(const char *obd_name, struct obdo *oa, 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); @@ -173,13 +175,10 @@ int compress_request(const char *obd_name, struct obdo *oa, * - 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",