From 1de17e5124fc01180374ac6b9d5e28f849285000 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Wed, 8 Nov 2023 17:29:26 -0700 Subject: [PATCH] EX-7601 csdc: improve preview warning messages Avoid printing duplicate warning messages on the console when creating files with multiple compressed components. On the flip side, log a console message when compression is enabled so that this will later be visible if enabled on a system. Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: I8cb2f67689824513335f3fa65e9ea751923ebbe5 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53045 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Artem Blagodarenko --- lustre/llite/lproc_llite.c | 10 ++++++++++ lustre/utils/liblustreapi_layout.c | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 7f57967..9c24359 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -2060,6 +2060,7 @@ static ssize_t ll_enable_compression_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { + static bool printed; int val; int rc; @@ -2067,6 +2068,15 @@ static ssize_t ll_enable_compression_seq_write(struct file *file, if (rc < 0) return rc; + if (!printed && val) { + struct seq_file *m = file->private_data; + struct super_block *sb = m->private; + struct ll_sb_info *sbi = ll_s2sbi(sb); + + LCONSOLE_WARN("%s: file compression preview enabled\n", + sbi->ll_fsname); + printed = true; + } llite_enable_compression = !!val; return count; diff --git a/lustre/utils/liblustreapi_layout.c b/lustre/utils/liblustreapi_layout.c index 1974782..ba26268 100644 --- a/lustre/utils/liblustreapi_layout.c +++ b/lustre/utils/liblustreapi_layout.c @@ -1577,6 +1577,7 @@ int llapi_layout_compress_set(struct llapi_layout *layout, enum ll_compr_type type, int level, __u32 chunk_size, unsigned long long stripe_size) { + static bool printed; struct llapi_layout_comp *comp; bool compr_level_set = false; int log_bits; @@ -1591,9 +1592,10 @@ int llapi_layout_compress_set(struct llapi_layout *layout, if (type == LL_COMPR_TYPE_NONE) return 0; - if (getenv("LFS_SETSTRIPE_COMPR_OK") == NULL) { + if (!printed && getenv("LFS_SETSTRIPE_COMPR_OK") == NULL) { fprintf(stderr, - "WARNING: File compression is a technology preview feature and is not yet intended for production use. Compression is skipped for encrypted files.\n"); + "WARNING: File compression is a technology preview feature and is not yet intended for production use. Compression is skipped for encrypted files. Set LFS_SETSTRIPE_COMPR_OK=y to acknowledge limitations.\n"); + printed = true; } for (i = 0; i < ARRAY_SIZE(compr_type_table); i++) { -- 1.8.3.1