Whamcloud - gitweb
LU-14889 lproc: Add server checksum_type 55/44755/6
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Thu, 26 Aug 2021 12:07:50 +0000 (08:07 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 22 Sep 2021 04:44:04 +0000 (04:44 +0000)
This patch adds 'checksum_type' lproc entries under server:
1. obdfilter.$FSNAME-OST${count}.checksum_type
2. mdt.$FSNAME-MDT${count}.checksum_type

Test-case: sanity/77o added

Test-Parameters: trivial
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: I12a26f5c8c8f2f93d57f377626b1753fc13ffbb3
Reviewed-on: https://review.whamcloud.com/44755
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdt/mdt_lproc.c
lustre/ofd/lproc_ofd.c
lustre/tests/sanity.sh

index 4dd78ef..1d09ad4 100644 (file)
@@ -56,6 +56,7 @@
 #include <lustre_mds.h>
 #include <lprocfs_status.h>
 #include "mdt_internal.h"
+#include <obd_cksum.h>
 
 /**
  * The rename stats output would be YAML formats, like
@@ -1324,6 +1325,43 @@ static ssize_t checksum_t10pi_enforce_store(struct kobject *kobj,
 }
 LUSTRE_RW_ATTR(checksum_t10pi_enforce);
 
+/*
+ * mdt_checksum_type(server) proc handling
+ */
+DECLARE_CKSUM_NAME;
+
+static int mdt_checksum_type_seq_show(struct seq_file *m, void *data)
+{
+       struct obd_device *obd = m->private;
+       struct lu_target *lut;
+       enum cksum_types pref;
+       int i;
+
+       if (!obd)
+               return 0;
+
+       lut = obd->u.obt.obt_lut;
+
+       /* select fastest checksum type on the server */
+       pref = obd_cksum_type_select(obd->obd_name,
+                                    lut->lut_cksum_types_supported, 0);
+
+       for (i = 0; i < ARRAY_SIZE(cksum_name); i++) {
+               if ((BIT(i) & lut->lut_cksum_types_supported) == 0)
+                       continue;
+
+               if (pref == BIT(i))
+                       seq_printf(m, "[%s] ", cksum_name[i]);
+               else
+                       seq_printf(m, "%s ", cksum_name[i]);
+       }
+       seq_puts(m, "\n");
+
+       return 0;
+}
+
+LPROC_SEQ_FOPS_RO(mdt_checksum_type);
+
 LPROC_SEQ_FOPS_RO_TYPE(mdt, hash);
 LPROC_SEQ_FOPS_WR_ONLY(mdt, mds_evict_client);
 LPROC_SEQ_FOPS_RW_TYPE(mdt, checksum_dump);
@@ -1402,6 +1440,8 @@ static struct lprocfs_vars lprocfs_mdt_obd_vars[] = {
          .fops =       &mdt_root_squash_fops                   },
        { .name =       "nosquash_nids",
          .fops =       &mdt_nosquash_nids_fops                 },
+       { .name =       "checksum_type",
+         .fops =       &mdt_checksum_type_fops         },
        { NULL }
 };
 
index 6c7d5f8..e0bdfed 100644 (file)
@@ -45,6 +45,7 @@
 #include <linux/seq_file.h>
 #include <lustre_lfsck.h>
 #include <uapi/linux/lustre/lustre_access_log.h>
+#include <obd_cksum.h>
 
 #include "ofd_internal.h"
 
@@ -470,6 +471,44 @@ ofd_brw_size_seq_write(struct file *file, const char __user *buffer,
 }
 LPROC_SEQ_FOPS(ofd_brw_size);
 
+/*
+ * ofd_checksum_type(server) proc handling
+ */
+DECLARE_CKSUM_NAME;
+
+static int ofd_checksum_type_seq_show(struct seq_file *m, void *data)
+{
+       struct obd_device *obd = m->private;
+       struct lu_target *lut;
+       enum cksum_types pref;
+       int i;
+
+       if (!obd)
+               return 0;
+
+       lut = obd->u.obt.obt_lut;
+
+       /* select fastest checksum type on the server */
+       pref = obd_cksum_type_select(obd->obd_name,
+                                    lut->lut_cksum_types_supported, 0);
+
+       for (i = 0; i < ARRAY_SIZE(cksum_name); i++) {
+               if ((BIT(i) & lut->lut_cksum_types_supported) == 0)
+                       continue;
+
+               if (pref == BIT(i))
+                       seq_printf(m, "[%s] ", cksum_name[i]);
+               else
+                       seq_printf(m, "%s ", cksum_name[i]);
+       }
+       seq_puts(m, "\n");
+
+       return 0;
+}
+
+LPROC_SEQ_FOPS_RO(ofd_checksum_type);
+
+
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 16, 53, 0)
 static bool sync_on_lock_cancel_warned;
 static ssize_t sync_on_lock_cancel_show(struct kobject *kobj,
@@ -1017,6 +1056,8 @@ struct lprocfs_vars lprocfs_ofd_obd_vars[] = {
          .fops =       &ofd_lfsck_verify_pfid_fops     },
        { .name =       "site_stats",
          .fops =       &ofd_site_stats_fops            },
+       { .name =       "checksum_type",
+         .fops =       &ofd_checksum_type_fops         },
        { NULL }
 };
 
index 16d3553..65c457e 100755 (executable)
@@ -9840,6 +9840,36 @@ test_77n() {
 }
 run_test 77n "Verify read from a hole inside contiguous blocks with T10PI"
 
+test_77o() {
+       (( $CLIENT_VERSION >= $(version_code 2.14.54) )) ||
+               skip "Need at least version 2.14.54"
+       local ofd=obdfilter
+       local mdt=mdt
+
+       # print OST checksum_type
+       echo "$ofd.$FSNAME-*.checksum_type:"
+       do_nodes $(comma_list $(osts_nodes)) \
+               $LCTL get_param -n $ofd.$FSNAME-*.checksum_type
+
+       # print MDT checksum_type
+       echo "$mdt.$FSNAME-*.checksum_type:"
+       do_nodes $(comma_list $(mdts_nodes)) \
+               $LCTL get_param -n $mdt.$FSNAME-*.checksum_type
+
+       local o_count=$(do_nodes $(comma_list $(osts_nodes)) \
+                  $LCTL get_param -n $ofd.$FSNAME-*.checksum_type | wc -l)
+
+       (( $o_count == $OSTCOUNT )) ||
+               error "found $o_count checksums, not \$MDSCOUNT=$OSTCOUNT"
+
+       local m_count=$(do_nodes $(comma_list $(mdts_nodes)) \
+                  $LCTL get_param -n $mdt.$FSNAME-*.checksum_type | wc -l)
+
+       (( $m_count == $MDSCOUNT )) ||
+               error "found $m_count checksums, not \$MDSCOUNT=$MDSCOUNT"
+}
+run_test 77o "Verify checksum_type for server (mdt and ofd(obdfilter))"
+
 cleanup_test_78() {
        trap 0
        rm -f $DIR/$tfile