From fa7424c6fc5ee284c7ba8c3b964fa95ab15f6379 Mon Sep 17 00:00:00 2001 From: Arshad Hussain Date: Thu, 26 Aug 2021 08:07:50 -0400 Subject: [PATCH] LU-14889 lproc: Add server checksum_type 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 Lustre-change: https://review.whamcloud.com/44755 Lustre-commit: c18d5d892b62ccee3cc9ec20a2278f17bb2d2f2c Signed-off-by: Arshad Hussain Change-Id: I12a26f5c8c8f2f93d57f377626b1753fc13ffbb3 Reviewed-by: Andreas Dilger Reviewed-by: Li Dongyang Reviewed-on: https://review.whamcloud.com/47142 Tested-by: jenkins Tested-by: Maloo --- lustre/mdt/mdt_lproc.c | 40 ++++++++++++++++++++++++++++++++++++++++ lustre/ofd/lproc_ofd.c | 41 +++++++++++++++++++++++++++++++++++++++++ lustre/tests/sanity.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+) diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c index 574b2ff..98ede5f 100644 --- a/lustre/mdt/mdt_lproc.c +++ b/lustre/mdt/mdt_lproc.c @@ -57,6 +57,7 @@ #include #include #include "mdt_internal.h" +#include /** * The rename stats output would be YAML formats, like @@ -1407,6 +1408,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); @@ -1487,6 +1525,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 } }; diff --git a/lustre/ofd/lproc_ofd.c b/lustre/ofd/lproc_ofd.c index 5155c26..6115a69 100644 --- a/lustre/ofd/lproc_ofd.c +++ b/lustre/ofd/lproc_ofd.c @@ -46,6 +46,7 @@ #include #include #include +#include #include "ofd_internal.h" @@ -471,6 +472,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 ssize_t sync_on_lock_cancel_show(struct kobject *kobj, struct attribute *attr, char *buf) @@ -1004,6 +1043,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 } }; diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 594918d..64ca378 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -9535,6 +9535,38 @@ test_77n() { } run_test 77n "Verify read from a hole inside contiguous blocks with T10PI" +test_77o() { + (( $MDS1_VERSION >= $(version_code 2.12.6.72) )) || + skip "Need MDS at least version 2.12.6.72" + (( $OSTT1_VERSION >= $(version_code 2.12.6.72) )) || + skip "Need OSS at least version 2.12.6.72" + 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 -- 1.8.3.1