Whamcloud - gitweb
ORNL-8 IR: minor fixes to IR patches
[fs/lustre-release.git] / lustre / mgc / mgc_request.c
index 57f69e8..a628354 100644 (file)
@@ -413,6 +413,34 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg)
         RETURN(rc);
 }
 
+int lprocfs_mgc_rd_ir_state(char *page, char **start, off_t off,
+                            int count, int *eof, void *data)
+{
+        struct obd_device       *obd = data;
+        struct obd_import       *imp = obd->u.cli.cl_import;
+        struct obd_connect_data *ocd = &imp->imp_connect_data;
+        struct config_llog_data *cld;
+        int rc = 0;
+        ENTRY;
+
+        rc = snprintf(page, count, "imperative_recovery: %s\n",
+                      OCD_HAS_FLAG(ocd, IMP_RECOV) ? "ON" : "OFF");
+        rc += snprintf(page + rc, count - rc, "client_state:\n");
+
+        cfs_spin_lock(&config_list_lock);
+        cfs_list_for_each_entry(cld, &config_llog_list, cld_list_chain) {
+                if (cld->cld_recover == NULL)
+                        continue;
+                rc += snprintf(page + rc, count - rc,
+                               "    - { client: %s, nidtbl_version: %u }\n",
+                               cld->cld_logname,
+                               cld->cld_recover->cld_cfg.cfg_last_idx);
+        }
+        cfs_spin_unlock(&config_list_lock);
+
+        RETURN(rc);
+}
+
 /* reenqueue any lost locks */
 #define RQ_RUNNING 0x1
 #define RQ_NOW     0x2
@@ -1203,7 +1231,7 @@ enum {
         CONFIG_READ_NRPAGES      = 4
 };
 
-static int mgc_apply_recover_logs(struct obd_device *obd,
+static int mgc_apply_recover_logs(struct obd_device *mgc,
                                   struct config_llog_data *cld,
                                   __u64 max_version,
                                   void *data, int datalen)
@@ -1216,26 +1244,29 @@ static int mgc_apply_recover_logs(struct obd_device *obd,
         u64   prev_version = 0;
         char *inst;
         char *buf;
-        int   bufsz = CFS_PAGE_SIZE;
+        int   bufsz;
         int   pos;
         int   rc  = 0;
         int   off = 0;
-
-        OBD_ALLOC(buf, CFS_PAGE_SIZE);
-        if (buf == NULL)
-                return -ENOMEM;
+        ENTRY;
 
         LASSERT(cfg->cfg_instance != NULL);
         LASSERT(cfg->cfg_sb == cfg->cfg_instance);
-        inst = buf;
+
+        OBD_ALLOC(inst, CFS_PAGE_SIZE);
+        if (inst == NULL)
+                RETURN(-ENOMEM);
+
         if (!(lsi->lsi_flags & LSI_SERVER)) {
                 pos = sprintf(inst, "%p", cfg->cfg_instance);
         } else {
                 LASSERT(IS_MDT(lsi->lsi_ldd));
                 pos = sprintf(inst, "MDT%04x", lsi->lsi_ldd->ldd_svindex);
         }
-        buf   += pos + 1;
-        bufsz -= pos + 1;
+
+        ++pos;
+        buf   = inst + pos;
+        bufsz = CFS_PAGE_SIZE - pos;
 
         while (datalen > 0) {
                 int   entry_len = sizeof(*entry);
@@ -1301,7 +1332,8 @@ static int mgc_apply_recover_logs(struct obd_device *obd,
                 strcpy(obdname, cld->cld_logname);
                 cname = strrchr(obdname, '-');
                 if (cname == NULL) {
-                        CERROR("mgc: invalid logname %s\n", obdname);
+                        CERROR("mgc %s: invalid logname %s\n",
+                               mgc->obd_name, obdname);
                         break;
                 }
 
@@ -1317,8 +1349,8 @@ static int mgc_apply_recover_logs(struct obd_device *obd,
                 /* find the obd by obdname */
                 obd = class_name2obd(obdname);
                 if (obd == NULL) {
-                        CDEBUG(D_INFO, "mgc: cannot find obdname %s\n",
-                               obdname);
+                        CDEBUG(D_INFO, "mgc %s: cannot find obdname %s\n",
+                               mgc->obd_name, obdname);
 
                         /* this is a safe race, when the ost is starting up...*/
                         continue;
@@ -1370,7 +1402,7 @@ static int mgc_apply_recover_logs(struct obd_device *obd,
         }
 
         OBD_FREE(inst, CFS_PAGE_SIZE);
-        return rc;
+        RETURN(rc);
 }
 
 /**
@@ -1745,7 +1777,7 @@ out_pop:
 int mgc_process_log(struct obd_device *mgc, struct config_llog_data *cld)
 {
         struct lustre_handle lockh = { 0 };
-        int rc = 0, rcl, flags = 0;
+        int rc = 0, rcl, flags = LDLM_FL_NO_LRU;
         ENTRY;
 
         LASSERT(cld);