Whamcloud - gitweb
EX-7601 ofd: make compress_chunk take chunk_bits
authorPatrick Farrell <pfarrell@whamcloud.com>
Fri, 10 Nov 2023 22:21:52 +0000 (17:21 -0500)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 24 Nov 2023 09:28:19 +0000 (09:28 +0000)
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 <pfarrell@whamcloud.com>
Change-Id: Ic01bb749425cb95d9c5717965d692a18138ceeb7
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53100
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/include/lustre_compr.h
lustre/obdclass/lustre_compr.c
lustre/ofd/ofd_compress.c
lustre/osc/osc_compress.c

index 5c46f57..dc40fd1 100644 (file)
@@ -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)
index 3156c44..0eb2840 100644 (file)
@@ -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;
index a2ae44d..f2330a7 100644 (file)
@@ -32,3 +32,4 @@
 #include "ofd_compress.h"
 #include <lustre_compr.h>
 #include <lustre_sec.h>
+
index 93a0de1..7cc2d97 100644 (file)
@@ -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",