Whamcloud - gitweb
LU-1187 mdt: Only create remote dir on MDT0
[fs/lustre-release.git] / lustre / mdt / mdt_lproc.c
index 1560ec1..deae5bb 100644 (file)
@@ -948,6 +948,34 @@ out:
         return count;
 }
 
+static int lprocfs_rd_enable_remote_dir(char *page, char **start, off_t off,
+                                       int count, int *eof, void *data)
+{
+       struct obd_device *obd = data;
+       struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+
+       return snprintf(page, count, "%u\n", mdt->mdt_enable_remote_dir);
+}
+
+static int lprocfs_wr_enable_remote_dir(struct file *file, const char *buffer,
+                                       unsigned long count, void *data)
+{
+       struct obd_device *obd = data;
+       struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+       __u32 val;
+       int rc;
+
+       rc = lprocfs_write_helper(buffer, count, &val);
+       if (rc)
+               return rc;
+
+       if (val < 0 || val > 1)
+               return -ERANGE;
+
+       mdt->mdt_enable_remote_dir = val;
+       return count;
+}
+
 static struct lprocfs_vars lprocfs_mdt_obd_vars[] = {
         { "uuid",                       lprocfs_rd_uuid,                 0, 0 },
         { "recovery_status",            lprocfs_obd_rd_recovery_status,  0, 0 },
@@ -985,6 +1013,8 @@ static struct lprocfs_vars lprocfs_mdt_obd_vars[] = {
                                         lprocfs_obd_wr_ir_factor,           0 },
        { "job_cleanup_interval",       lprocfs_rd_job_interval,
                                        lprocfs_wr_job_interval, 0 },
+       { "enable_remote_dir",          lprocfs_rd_enable_remote_dir,
+                                       lprocfs_wr_enable_remote_dir,       0},
         { 0 }
 };