diff mbox series

[28/42] lustre: obdclass: prefer T10 checksum if the target supports it

Message ID 1674514855-15399-29-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: sync to OpenSFS tree as of Jan 22 2023 | expand

Commit Message

James Simmons Jan. 23, 2023, 11 p.m. UTC
From: Li Dongyang <dongyangli@ddn.com>

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.

WC-bug-id: https://jira.whamcloud.com/browse/LU-14912
Lustre-commit: 5e9059e08aec6fb36 ("LU-14912 obdclass: prefer T10 checksum if the target supports it")
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/44657
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/obd_cksum.h | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/fs/lustre/include/obd_cksum.h b/fs/lustre/include/obd_cksum.h
index 36443fd5a156..052635d5d5b0 100644
--- a/fs/lustre/include/obd_cksum.h
+++ b/fs/lustre/include/obd_cksum.h
@@ -118,6 +118,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);