From 6fc1ce555e316eaa1578c80f2827c225aee0d938 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Fri, 10 Nov 2023 17:21:52 -0500 Subject: [PATCH] EX-7601 ofd: make compress_chunk take chunk_bits Chunk bits is used everywhere, have compress_chunk convert to log bits rather than have the callers do it. Test-Parameters: trivial Signed-off-by: Patrick Farrell Change-Id: Ic01bb749425cb95d9c5717965d692a18138ceeb7 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53100 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/include/lustre_compr.h | 2 +- lustre/obdclass/lustre_compr.c | 5 +++-- lustre/ofd/ofd_compress.c | 1 + lustre/osc/osc_compress.c | 4 +--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lustre/include/lustre_compr.h b/lustre/include/lustre_compr.h index 5c46f57..dc40fd1 100644 --- a/lustre/include/lustre_compr.h +++ b/lustre/include/lustre_compr.h @@ -34,7 +34,7 @@ int alloc_compr(enum ll_compr_type *type, unsigned int lvl, int compress_chunk(const char *obd_name, const unsigned char *in, unsigned int in_len, unsigned char *out, unsigned int *out_len, enum ll_compr_type type, - unsigned int lvl, unsigned int chunk_log_bits, + unsigned int lvl, unsigned int chunk_bits, enum ll_compr_type *applied_type); static inline struct page *mem_to_page(void *addr) diff --git a/lustre/obdclass/lustre_compr.c b/lustre/obdclass/lustre_compr.c index 3156c44..0eb2840 100644 --- a/lustre/obdclass/lustre_compr.c +++ b/lustre/obdclass/lustre_compr.c @@ -121,7 +121,7 @@ EXPORT_SYMBOL(alloc_compr); int compress_chunk(const char *obd_name, const unsigned char *in, unsigned int in_len, unsigned char *out, unsigned int *out_len, enum ll_compr_type type, - unsigned int lvl, unsigned int chunk_log_bits, + unsigned int lvl, unsigned int chunk_bits, enum ll_compr_type *applied_type) { struct ll_compr_hdr *llch; @@ -187,7 +187,8 @@ again: llch->llch_header_size = sizeof(*llch); llch->llch_compr_type = type; llch->llch_compr_level = lvl; - llch->llch_chunk_log_bits = chunk_log_bits; + /* chunk_log_bits from chunk_bits */ + llch->llch_chunk_log_bits = chunk_bits - COMPR_CHUNK_MIN_BITS; llch->llch_flags = 0; llch->llch_compr_size = len; llch->llch_compr_csum = 0; diff --git a/lustre/ofd/ofd_compress.c b/lustre/ofd/ofd_compress.c index a2ae44d..f2330a7 100644 --- a/lustre/ofd/ofd_compress.c +++ b/lustre/ofd/ofd_compress.c @@ -32,3 +32,4 @@ #include "ofd_compress.h" #include #include + diff --git a/lustre/osc/osc_compress.c b/lustre/osc/osc_compress.c index 93a0de1..7cc2d97 100644 --- a/lustre/osc/osc_compress.c +++ b/lustre/osc/osc_compress.c @@ -124,7 +124,6 @@ int compress_request(const char *obd_name, struct obdo *oa, 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; @@ -142,7 +141,6 @@ int compress_request(const char *obd_name, struct obdo *oa, 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); @@ -178,7 +176,7 @@ int compress_request(const char *obd_name, struct obdo *oa, if (applied_type) { compressed = compress_chunk(obd_name, src, src_size, dst, &dst_size, - type, lvl, chunk_log_bits, + type, lvl, chunk_bits, &applied_type); CDEBUG(D_SEC, "%s: rc %d: inode "DFID"\n", -- 1.8.3.1