Whamcloud - gitweb
- export handling for VBR
authortappro <tappro>
Wed, 3 Sep 2008 08:11:36 +0000 (08:11 +0000)
committertappro <tappro>
Wed, 3 Sep 2008 08:11:36 +0000 (08:11 +0000)
  b:15391
  i:rread, bzzz

lustre/obdclass/lprocfs_status.c

index ff78f14..9ab2c46 100644 (file)
@@ -1883,6 +1883,77 @@ int lprocfs_obd_wr_recovery_maxtime(struct file *file, const char *buffer,
 EXPORT_SYMBOL(lprocfs_obd_wr_recovery_maxtime);
 #endif /* CRAY_XT3 */
 
+int lprocfs_obd_rd_stale_export_age(char *page, char **start, off_t off,
+                                    int count, int *eof, void *data)
+{
+        struct obd_device *obd = (struct obd_device *)data;
+        LASSERT(obd != NULL);
+
+        return snprintf(page, count, "%u\n",
+                        obd->u.obt.obt_stale_export_age);
+}
+EXPORT_SYMBOL(lprocfs_obd_rd_stale_export_age);
+
+int lprocfs_obd_wr_stale_export_age(struct file *file, const char *buffer,
+                                    unsigned long count, void *data)
+{
+        struct obd_device *obd = (struct obd_device *)data;
+        int val, rc;
+        LASSERT(obd != NULL);
+
+        rc = lprocfs_write_helper(buffer, count, &val);
+        if (rc)
+                return rc;
+
+        obd->u.obt.obt_stale_export_age = val;
+        return count;
+}
+EXPORT_SYMBOL(lprocfs_obd_wr_stale_export_age);
+
+static int obd_stale_exports_seq_show(struct seq_file *seq, void *v)
+{
+        struct obd_device *obd = seq->private;
+        struct obd_export *exp;
+
+        spin_lock(&obd->obd_dev_lock);
+        list_for_each_entry(exp, &obd->obd_delayed_exports,
+                            exp_obd_chain) {
+                seq_printf(seq, "%s: %ld seconds ago%s\n",
+                           obd_uuid2str(&exp->exp_client_uuid),
+                           cfs_time_current_sec() - exp->exp_last_request_time,
+                           exp_expired(exp, obd->u.obt.obt_stale_export_age) ?
+                                       " [EXPIRED]" : "");
+        }
+        spin_unlock(&obd->obd_dev_lock);
+        return 0;
+}
+
+LPROC_SEQ_FOPS_RO(obd_stale_exports);
+
+int lprocfs_obd_attach_stale_exports(struct obd_device *dev)
+{
+        return lprocfs_obd_seq_create(dev, "stale_exports", 0444,
+                                      &obd_stale_exports_fops, dev);
+}
+EXPORT_SYMBOL(lprocfs_obd_attach_stale_exports);
+
+int lprocfs_obd_wr_flush_stale_exports(struct file *file, const char *buffer,
+                                       unsigned long count, void *data)
+{
+        struct obd_device *obd = (struct obd_device *)data;
+        int val, rc;
+        LASSERT(obd != NULL);
+
+        rc = lprocfs_write_helper(buffer, count, &val);
+        if (rc)
+                return rc;
+
+        class_disconnect_expired_exports(obd);
+        return count;
+}
+EXPORT_SYMBOL(lprocfs_obd_wr_flush_stale_exports);
+
+
 EXPORT_SYMBOL(lprocfs_register);
 EXPORT_SYMBOL(lprocfs_srch);
 EXPORT_SYMBOL(lprocfs_remove);