Whamcloud - gitweb
LU-14286 osd-ldiskfs: fallocate() should zero new blocks
[fs/lustre-release.git] / lustre / include / obd_cksum.h
index a2ce2ec..15353a3 100644 (file)
@@ -112,10 +112,17 @@ enum cksum_types obd_cksum_types_supported_server(const char *obd_name);
  * checksum type due to its benchmarking at libcfs module load.
  * Caution is advised, however, since what is fastest on a single client may
  * not be the fastest or most efficient algorithm on the server.  */
-static inline enum cksum_types
-obd_cksum_type_select(const char *obd_name, enum cksum_types cksum_types)
+static inline
+enum cksum_types obd_cksum_type_select(const char *obd_name,
+                                      enum cksum_types cksum_types,
+                                      enum cksum_types preferred)
 {
-       u32 flag = obd_cksum_type_pack(obd_name, cksum_types);
+       u32 flag;
+
+       if (preferred & cksum_types)
+               return preferred;
+
+       flag = obd_cksum_type_pack(obd_name, cksum_types);
 
        return obd_cksum_type_unpack(flag);
 }
@@ -144,6 +151,7 @@ static inline void obd_t10_cksum2dif(enum cksum_types cksum_type,
        *fn = NULL;
        *sector_size = 0;
 
+#if IS_ENABLED(CONFIG_CRC_T10DIF)
        switch (cksum_type) {
        case OBD_CKSUM_T10IP512:
                *fn = obd_dif_ip_fn;
@@ -164,6 +172,7 @@ static inline void obd_t10_cksum2dif(enum cksum_types cksum_type,
        default:
                break;
        }
+#endif /* CONFIG_CRC_T10DIF */
 }
 
 enum obd_t10_cksum_type {