Whamcloud - gitweb
LU-241 Support crc32c with hardware accelerated instruction as one of lustre checksums
[fs/lustre-release.git] / lustre / ptlrpc / import.c
index 03311e5..b0a5292 100644 (file)
@@ -1010,33 +1010,25 @@ finish:
                         /* We sent to the server ocd_cksum_types with bits set
                          * for algorithms we understand. The server masked off
                          * the checksum types it doesn't support */
-                        if ((ocd->ocd_cksum_types & OBD_CKSUM_ALL) == 0) {
+                        if ((ocd->ocd_cksum_types & cksum_types_supported()) == 0) {
                                 LCONSOLE_WARN("The negotiation of the checksum "
                                               "alogrithm to use with server %s "
                                               "failed (%x/%x), disabling "
                                               "checksums\n",
                                               obd2cli_tgt(imp->imp_obd),
                                               ocd->ocd_cksum_types,
-                                              OBD_CKSUM_ALL);
+                                              cksum_types_supported());
                                 cli->cl_checksum = 0;
                                 cli->cl_supp_cksum_types = OBD_CKSUM_CRC32;
-                                cli->cl_cksum_type = OBD_CKSUM_CRC32;
                         } else {
                                 cli->cl_supp_cksum_types = ocd->ocd_cksum_types;
-
-                                if (ocd->ocd_cksum_types & OSC_DEFAULT_CKSUM)
-                                        cli->cl_cksum_type = OSC_DEFAULT_CKSUM;
-                                else if (ocd->ocd_cksum_types & OBD_CKSUM_ADLER)
-                                        cli->cl_cksum_type = OBD_CKSUM_ADLER;
-                                else
-                                        cli->cl_cksum_type = OBD_CKSUM_CRC32;
                         }
                 } else {
                         /* The server does not support OBD_CONNECT_CKSUM.
                          * Enforce CRC32 for backward compatibility*/
                         cli->cl_supp_cksum_types = OBD_CKSUM_CRC32;
-                        cli->cl_cksum_type = OBD_CKSUM_CRC32;
                 }
+                cli->cl_cksum_type =cksum_type_select(cli->cl_supp_cksum_types);
 
                 if (ocd->ocd_connect_flags & OBD_CONNECT_BRW_SIZE)
                         cli->cl_max_pages_per_rpc =