Whamcloud - gitweb
LU-11233 build: support for gcc8
[fs/lustre-release.git] / lustre / lmv / lmv_obd.c
index 5a7945b..2df8aa3 100644 (file)
@@ -212,6 +212,7 @@ static int lmv_connect(const struct lu_env *env,
 
        lmv->connected = 0;
        lmv->conn_data = *data;
+       lmv->lmv_cache = localdata;
 
        lmv->lmv_tgts_kobj = kobject_create_and_add("target_obds",
                                                    &obd->obd_kset.kobj);
@@ -310,7 +311,7 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
         }
 
        rc = obd_connect(NULL, &mdc_exp, mdc_obd, &obd->obd_uuid,
-                        &lmv->conn_data, NULL);
+                        &lmv->conn_data, lmv->lmv_cache);
         if (rc) {
                 CERROR("target %s connect error %d\n", tgt->ltd_uuid.uuid, rc);
                 RETURN(rc);
@@ -659,6 +660,7 @@ repeat_fid2path:
        if (remote_gf != NULL) {
                struct getinfo_fid2path *ori_gf;
                char *ptr;
+               int len;
 
                ori_gf = (struct getinfo_fid2path *)karg;
                if (strlen(ori_gf->gf_u.gf_path) + 1 +
@@ -667,13 +669,12 @@ repeat_fid2path:
 
                ptr = ori_gf->gf_u.gf_path;
 
-               memmove(ptr + strlen(gf->gf_u.gf_path) + 1, ptr,
-                       strlen(ori_gf->gf_u.gf_path));
-
-               strncpy(ptr, gf->gf_u.gf_path,
-                       strlen(gf->gf_u.gf_path));
-               ptr += strlen(gf->gf_u.gf_path);
-               *ptr = '/';
+               len = strlen(gf->gf_u.gf_path);
+               /* move the current path to the right to release space
+                * for closer-to-root part */
+               memmove(ptr + len + 1, ptr, strlen(ori_gf->gf_u.gf_path));
+               memcpy(ptr, gf->gf_u.gf_path, len);
+               ptr[len] = '/';
        }
 
        CDEBUG(D_INFO, "%s: get path %s "DFID" rec: %llu ln: %u\n",
@@ -1373,8 +1374,11 @@ static int lmv_select_statfs_mdt(struct lmv_obd *lmv, __u32 flags)
                        break;
 
                if (LNET_NETTYP(LNET_NIDNET(lnet_id.nid)) != LOLND) {
+                       /* We dont need a full 64-bit modulus, just enough
+                        * to distribute the requests across MDTs evenly.
+                        */
                        lmv->lmv_statfs_start =
-                               lnet_id.nid % lmv->desc.ld_tgt_count;
+                               (u32)lnet_id.nid % lmv->desc.ld_tgt_count;
                        break;
                }
        }
@@ -1407,8 +1411,8 @@ static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
                rc = obd_statfs(env, lmv->tgts[idx]->ltd_exp, temp,
                                max_age, flags);
                if (rc) {
-                       CERROR("can't stat MDS #%d (%s), error %d\n", i,
-                              lmv->tgts[idx]->ltd_exp->exp_obd->obd_name,
+                       CERROR("%s: can't stat MDS #%d: rc = %d\n",
+                              lmv->tgts[idx]->ltd_exp->exp_obd->obd_name, i,
                               rc);
                        GOTO(out_free_temp, rc);
                }