[lustre-devel] [PATCH 27/42] lustre: obdclass: fix T10PI prototypes

James Simmons <[email protected]>
Newsgroups org.lustre.lists.lustre-devel
Message-ID <[email protected]>
From: Li Dongyang <[email protected]>

Update the custom generate and verify functions, to sync
with upstream versions.
 - Use __be16 instead of __u16 for guard tags.

WC-bug-id: https://jira.whamcloud.com/browse/LU-16413
Lustre-commit: 4f0273b3bc7d2159d ("LU-16413 osd-ldiskfs: fix T10PI for CentOS 8.x")
Signed-off-by: Li Dongyang <[email protected]>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49441
Reviewed-by: Andreas Dilger <[email protected]>
Reviewed-by: Li Xi <[email protected]>
Reviewed-by: Oleg Drokin <[email protected]>
Signed-off-by: James Simmons <[email protected]>
---
 fs/lustre/include/obd_cksum.h  |  8 ++++----
 fs/lustre/obdclass/integrity.c | 12 ++++++------
 fs/lustre/osc/osc_request.c    |  4 ++--
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/fs/lustre/include/obd_cksum.h b/fs/lustre/include/obd_cksum.h
index 1189bc2c73e9..36443fd5a156 100644
--- a/fs/lustre/include/obd_cksum.h
+++ b/fs/lustre/include/obd_cksum.h
@@ -129,13 +129,13 @@ enum cksum_types obd_cksum_type_select(const char *obd_name,
 #define DECLARE_CKSUM_NAME const char *const cksum_name[] = {"crc32", "adler", \
 	"crc32c", "reserved", "t10ip512", "t10ip4K", "t10crc512", "t10crc4K"}
 
-typedef u16 (obd_dif_csum_fn) (void *, unsigned int);
+typedef __be16 (obd_dif_csum_fn) (void *, unsigned int);
 
-u16 obd_dif_crc_fn(void *data, unsigned int len);
-u16 obd_dif_ip_fn(void *data, unsigned int len);
+__be16 obd_dif_crc_fn(void *data, unsigned int len);
+__be16 obd_dif_ip_fn(void *data, unsigned int len);
 int obd_page_dif_generate_buffer(const char *obd_name, struct page *page,
 				 u32 offset, u32 length,
-				 u16 *guard_start, int guard_number,
+				 __be16 *guard_start, int guard_number,
 				 int *used_number, int sector_size,
 				 obd_dif_csum_fn *fn);
 /*
diff --git a/fs/lustre/obdclass/integrity.c b/fs/lustre/obdclass/integrity.c
index 7a95a11f112f..e6069cb30213 100644
--- a/fs/lustre/obdclass/integrity.c
+++ b/fs/lustre/obdclass/integrity.c
@@ -32,13 +32,13 @@
 #include <obd_class.h>
 #include <obd_cksum.h>
 
-u16 obd_dif_crc_fn(void *data, unsigned int len)
+__be16 obd_dif_crc_fn(void *data, unsigned int len)
 {
 	return cpu_to_be16(crc_t10dif(data, len));
 }
 EXPORT_SYMBOL(obd_dif_crc_fn);
 
-u16 obd_dif_ip_fn(void *data, unsigned int len)
+__be16 obd_dif_ip_fn(void *data, unsigned int len)
 {
 	return ip_compute_csum(data, len);
 }
@@ -46,14 +46,14 @@ EXPORT_SYMBOL(obd_dif_ip_fn);
 
 int obd_page_dif_generate_buffer(const char *obd_name, struct page *page,
 				 u32 offset, u32 length,
-				 u16 *guard_start, int guard_number,
+				 __be16 *guard_start, int guard_number,
 				 int *used_number, int sector_size,
 				 obd_dif_csum_fn *fn)
 {
 	unsigned int i = offset;
 	unsigned int end = offset + length;
 	char *data_buf;
-	u16 *guard_buf = guard_start;
+	__be16 *guard_buf = guard_start;
 	unsigned int data_size;
 	int used = 0;
 
@@ -90,7 +90,7 @@ static int __obd_t10_performance_test(const char *obd_name,
 	unsigned int bufsize;
 	unsigned char *buffer;
 	struct page *__page;
-	u16 *guard_start;
+	__be16 *guard_start;
 	int guard_number;
 	int used_number = 0;
 	int sector_size = 0;
@@ -117,7 +117,7 @@ static int __obd_t10_performance_test(const char *obd_name,
 	}
 
 	buffer = kmap(__page);
-	guard_start = (u16 *)buffer;
+	guard_start = (__be16 *)buffer;
 	guard_number = PAGE_SIZE / sizeof(*guard_start);
 	for (i = 0; i < repeat_number; i++) {
 		/*
diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c
index 5a3f418615ca..fb0facc8ddd1 100644
--- a/fs/lustre/osc/osc_request.c
+++ b/fs/lustre/osc/osc_request.c
@@ -1196,7 +1196,7 @@ static int osc_checksum_bulk_t10pi(const char *obd_name, int nob,
 	unsigned char cfs_alg = cksum_obd2cfs(OBD_CKSUM_T10_TOP);
 	struct page *__page;
 	unsigned char *buffer;
-	u16 *guard_start;
+	__be16 *guard_start;
 	unsigned int bufsize;
 	int guard_number;
 	int used_number = 0;
@@ -1220,7 +1220,7 @@ static int osc_checksum_bulk_t10pi(const char *obd_name, int nob,
 	}
 
 	buffer = kmap(__page);
-	guard_start = (u16 *)buffer;
+	guard_start = (__be16 *)buffer;
 	guard_number = PAGE_SIZE / sizeof(*guard_start);
 	CDEBUG(D_PAGE | (resend ? D_HA : 0),
 	       "GRD tags per page=%u, resend=%u, bytes=%u, pages=%zu\n",
-- 
2.27.0

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.