From b6319622ea0aa52bc85564775392f296fc40528a Mon Sep 17 00:00:00 2001 From: Li Dongyang Date: Fri, 13 Aug 2021 18:58:46 +1000 Subject: [PATCH] LU-14912 obdclass: prefer T10 checksum if the target supports it If the target actually has T10PI support, we prefer to use that T10 checksum even it's not the fastest on the client, given checksum_type is not explicitly set. Lustre-change: https://review.whamcloud.com/44657 Lustre-commit: 5e9059e08aec6fb36de6788465978de0e962b956 Change-Id: If91217881fcadbc84d1e360e65648344f5ac2447 Test-Parameters: trivial Signed-off-by: Li Dongyang Reviewed-by: Andreas Dilger Reviewed-by: Li Xi Reviewed-on: https://review.whamcloud.com/46927 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Patrick Farrell --- lustre/include/obd_cksum.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lustre/include/obd_cksum.h b/lustre/include/obd_cksum.h index 15353a3..2c16502 100644 --- a/lustre/include/obd_cksum.h +++ b/lustre/include/obd_cksum.h @@ -122,6 +122,13 @@ enum cksum_types obd_cksum_type_select(const char *obd_name, if (preferred & cksum_types) return preferred; + /* + * Server reporting a single T10 checksum type + * means the target actually supports T10-PI. + */ + if (hweight32(cksum_types & OBD_CKSUM_T10_ALL) == 1) + return cksum_types & OBD_CKSUM_T10_ALL; + flag = obd_cksum_type_pack(obd_name, cksum_types); return obd_cksum_type_unpack(flag); -- 1.8.3.1