Whamcloud - gitweb
EX-8277 llite: set max compression size to 64 MiB
authorPatrick Farrell <pfarrell@whamcloud.com>
Thu, 21 Sep 2023 21:17:36 +0000 (17:17 -0400)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 28 Sep 2023 08:46:12 +0000 (08:46 +0000)
Compression size should never be larger than RPC size, so
set it to a maximum of 64 MiB.

Test-Parameters: trivial
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: Ia5958db3504f4f442fbd41e48416924debc26192
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52466
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/lod/lod_internal.h

index 51e68df..e4217bf 100644 (file)
@@ -2941,7 +2941,10 @@ enum ll_compr_type {
 };
 
 #define COMPR_CHUNK_MIN_BITS 16
-#define COMPR_CHUNK_MAX_BITS 31
+/* 64 MiB - a compressed chunk can never be bigger than PTLRPC_MAX_BRW_SIZE
+ * (which isn't easily accessed here)
+ */
+#define COMPR_CHUNK_MAX_BITS 26 /* == PTLRPC_MAX_BRW_BITS */
 #define COMPR_LEVEL_MAX 31
 #define COMPR_MIN_PAGES (1UL << (COMPR_CHUNK_MIN_BITS - PAGE_SHIFT))
 #if defined(__cplusplus)
index 89d26e4..4412738 100644 (file)
@@ -671,8 +671,9 @@ lod_comp_shrink_stripe_count(struct lod_layout_component *lod_comp,
 }
 
 /**
- * limit 2^log_bits to less than stripe_size and given stripe_size is already
- * a multiple fo 64KiB, stripe_size must be a multiple of chunk size.
+ * Limit 2^log_bits to less than stripe_size and maximum RPC size.
+ * Given that stripe_size is itself always a multiple fo 64KiB,
+ * stripe_size must also be an even multiple of some chunk_size.
  */
 static inline void
 lod_adjust_compr_chunk_size(__u16 *log_bits, __u32 stripe_size)
@@ -680,6 +681,10 @@ lod_adjust_compr_chunk_size(__u16 *log_bits, __u32 stripe_size)
        while ((1 << *log_bits) > stripe_size ||
               stripe_size & ((1 << *log_bits) - 1))
                (*log_bits)--;
+
+       BUILD_BUG_ON(COMPR_CHUNK_MAX_BITS > PTLRPC_MAX_BRW_BITS);
+       if (unlikely(*log_bits > COMPR_CHUNK_MAX_BITS))
+               *log_bits = COMPR_CHUNK_MAX_BITS;
 }
 
 void lod_fix_desc(struct lov_desc *desc);