Whamcloud - gitweb
LU-4379 procfs: dont always check max_pages_per_rpc alignement
[fs/lustre-release.git] / lustre / ldlm / ldlm_lib.c
index 8360290..47279ba 100644 (file)
@@ -270,34 +270,41 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
         char *name = obddev->obd_type->typ_name;
         ldlm_ns_type_t ns_type = LDLM_NS_TYPE_UNKNOWN;
         int rc;
-       char    *cli_name = lustre_cfg_buf(lcfg, 0);
         ENTRY;
 
         /* In a more perfect world, we would hang a ptlrpc_client off of
          * obd_type and just use the values from there. */
-       if (!strcmp(name, LUSTRE_OSC_NAME) ||
-           (!(strcmp(name, LUSTRE_OSP_NAME)) &&
-            (is_osp_on_mdt(cli_name) &&
-              strstr(lustre_cfg_buf(lcfg, 1), "OST") != NULL))) {
-               /* OSC or OSP_on_MDT for OSTs */
-                rq_portal = OST_REQUEST_PORTAL;
-                rp_portal = OSC_REPLY_PORTAL;
-                connect_op = OST_CONNECT;
-                cli->cl_sp_me = LUSTRE_SP_CLI;
-                cli->cl_sp_to = LUSTRE_SP_OST;
-                ns_type = LDLM_NS_TYPE_OSC;
+       if (!strcmp(name, LUSTRE_OSC_NAME)) {
+               rq_portal = OST_REQUEST_PORTAL;
+               rp_portal = OSC_REPLY_PORTAL;
+               connect_op = OST_CONNECT;
+               cli->cl_sp_me = LUSTRE_SP_CLI;
+               cli->cl_sp_to = LUSTRE_SP_OST;
+               ns_type = LDLM_NS_TYPE_OSC;
        } else if (!strcmp(name, LUSTRE_MDC_NAME) ||
-                  !strcmp(name, LUSTRE_LWP_NAME) ||
-                  (!strcmp(name, LUSTRE_OSP_NAME) &&
-                   (is_osp_on_mdt(cli_name) &&
-                    strstr(lustre_cfg_buf(lcfg, 1), "OST") == NULL))) {
-               /* MDC or OSP_on_MDT for other MDTs */
-                rq_portal = MDS_REQUEST_PORTAL;
-                rp_portal = MDC_REPLY_PORTAL;
-                connect_op = MDS_CONNECT;
-                cli->cl_sp_me = LUSTRE_SP_CLI;
-                cli->cl_sp_to = LUSTRE_SP_MDT;
-                ns_type = LDLM_NS_TYPE_MDC;
+                  !strcmp(name, LUSTRE_LWP_NAME)) {
+               rq_portal = MDS_REQUEST_PORTAL;
+               rp_portal = MDC_REPLY_PORTAL;
+               connect_op = MDS_CONNECT;
+               cli->cl_sp_me = LUSTRE_SP_CLI;
+               cli->cl_sp_to = LUSTRE_SP_MDT;
+               ns_type = LDLM_NS_TYPE_MDC;
+       } else if (!strcmp(name, LUSTRE_OSP_NAME)) {
+               if (strstr(lustre_cfg_buf(lcfg, 1), "OST") == NULL) {
+                       /* OSP_on_MDT for other MDTs */
+                       connect_op = MDS_CONNECT;
+                       cli->cl_sp_to = LUSTRE_SP_MDT;
+                       ns_type = LDLM_NS_TYPE_MDC;
+                       rq_portal = OUT_PORTAL;
+               } else {
+                       /* OSP on MDT for OST */
+                       connect_op = OST_CONNECT;
+                       cli->cl_sp_to = LUSTRE_SP_OST;
+                       ns_type = LDLM_NS_TYPE_OSC;
+                       rq_portal = OST_REQUEST_PORTAL;
+               }
+               rp_portal = OSC_REPLY_PORTAL;
+               cli->cl_sp_me = LUSTRE_SP_CLI;
         } else if (!strcmp(name, LUSTRE_MGC_NAME)) {
                 rq_portal = MGS_REQUEST_PORTAL;
                 rp_portal = MGC_REPLY_PORTAL;
@@ -393,6 +400,10 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
        cli->cl_max_pages_per_rpc = min_t(int, PTLRPC_MAX_BRW_PAGES,
                                          LNET_MTU >> PAGE_CACHE_SHIFT);
 
+       /* set cl_chunkbits default value to PAGE_CACHE_SHIFT,
+        * it will be updated at OSC connection time. */
+       cli->cl_chunkbits = PAGE_CACHE_SHIFT;
+
        if (!strcmp(name, LUSTRE_MDC_NAME)) {
                cli->cl_max_rpcs_in_flight = MDC_MAX_RIF_DEFAULT;
        } else if (totalram_pages >> (20 - PAGE_CACHE_SHIFT) <= 128 /* MB */) {