+static int lprocfs_mds_rd_evictostnids(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, "%d\n", obd->u.mds.mds_evict_ost_nids);
+}
+
+static int lprocfs_mds_wr_evictostnids(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ int val, rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ obd->u.mds.mds_evict_ost_nids = !!val;
+
+ return count;
+}
+
+static int lprocfs_mds_wr_evict_client(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ struct mds_obd *mds = &obd->u.mds;
+ char tmpbuf[sizeof(struct obd_uuid)];
+ struct ptlrpc_request_set *set;
+ int rc;
+
+ sscanf(buffer, "%40s", tmpbuf);
+
+ if (strncmp(tmpbuf, "nid:", 4) != 0)
+ return lprocfs_wr_evict_client(file, buffer, count, data);
+
+ set = ptlrpc_prep_set();
+ if (!set)
+ return -ENOMEM;
+
+ if (obd->u.mds.mds_evict_ost_nids) {
+ rc = obd_set_info_async(mds->mds_osc_exp,
+ sizeof(KEY_EVICT_BY_NID),
+ KEY_EVICT_BY_NID, strlen(tmpbuf + 4) + 1,
+ tmpbuf + 4, set);
+ if (rc)
+ CERROR("Failed to evict nid %s from OSTs: rc %d\n",
+ tmpbuf + 4, rc);
+
+ ptlrpc_check_set(NULL, set);
+ }
+
+ /* See the comments in function lprocfs_wr_evict_client()
+ * in ptlrpc/lproc_ptlrpc.c for details. - jay */
+ class_incref(obd, __FUNCTION__, cfs_current());
+ LPROCFS_EXIT();
+
+ obd_export_evict_by_nid(obd, tmpbuf+4);
+
+
+ rc = ptlrpc_set_wait(set);
+ if (rc)
+ CERROR("Failed to evict nid %s from OSTs: rc %d\n", tmpbuf + 4,
+ rc);
+
+ LPROCFS_ENTRY();
+ class_decref(obd, __FUNCTION__, cfs_current());
+
+ ptlrpc_set_destroy(set);
+ return count;
+}
+
+static int lprocfs_wr_atime_diff(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ struct mds_obd *mds = &obd->u.mds;
+ char kernbuf[20], *end;
+ unsigned long diff = 0;
+
+ if (count > (sizeof(kernbuf) - 1))
+ return -EINVAL;
+
+ if (copy_from_user(kernbuf, buffer, count))
+ return -EFAULT;
+
+ kernbuf[count] = '\0';
+
+ diff = simple_strtoul(kernbuf, &end, 0);
+ if (kernbuf == end)
+ return -EINVAL;
+
+ mds->mds_atime_diff = diff;
+ return count;
+}
+
+static int lprocfs_rd_atime_diff(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = data;
+ struct mds_obd *mds = &obd->u.mds;
+
+ *eof = 1;
+ return snprintf(page, count, "%lu\n", mds->mds_atime_diff);
+}
+