Whamcloud - gitweb
EX-7601 csdc: improve preview warning messages
authorAndreas Dilger <adilger@whamcloud.com>
Thu, 9 Nov 2023 00:29:26 +0000 (17:29 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 10 Nov 2023 09:33:17 +0000 (09:33 +0000)
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 <adilger@whamcloud.com>
Change-Id: I8cb2f67689824513335f3fa65e9ea751923ebbe5
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53045
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>
lustre/llite/lproc_llite.c
lustre/utils/liblustreapi_layout.c

index 7f57967..9c24359 100644 (file)
@@ -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;
index 1974782..ba26268 100644 (file)
@@ -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++) {