Whamcloud - gitweb
LU-2371 ptlrpc: get new xid for resend on EINPROGRESS
[fs/lustre-release.git] / lustre / ofd / lproc_ofd.c
index c40774b..414e7f2 100644 (file)
@@ -41,7 +41,6 @@
 #include <obd.h>
 #include <lprocfs_status.h>
 #include <linux/seq_file.h>
-#include <lquota.h>
 
 #include "ofd_internal.h"
 
@@ -135,9 +134,41 @@ static int lprocfs_ofd_wr_grant_ratio(struct file *file, const char *buffer,
                      "a huge part of the free space is now reserved for "
                      "grants\n", obd->obd_name);
 
-       cfs_spin_lock(&ofd->ofd_grant_lock);
+       spin_lock(&ofd->ofd_grant_lock);
        ofd->ofd_grant_ratio = ofd_grant_ratio_conv(val);
-       cfs_spin_unlock(&ofd->ofd_grant_lock);
+       spin_unlock(&ofd->ofd_grant_lock);
+       return count;
+}
+
+static int lprocfs_ofd_rd_precreate_batch(char *page, char **start, off_t off,
+                                         int count, int *eof, void *data)
+{
+       struct obd_device *obd = (struct obd_device *)data;
+       struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+       LASSERT(obd != NULL);
+       *eof = 1;
+       return snprintf(page, count, "%d\n", ofd->ofd_precreate_batch);
+}
+
+static int lprocfs_ofd_wr_precreate_batch(struct file *file, const char *buffer,
+                                         unsigned long count, void *data)
+{
+       struct obd_device *obd = (struct obd_device *)data;
+       struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+       int val;
+       int rc;
+
+       rc = lprocfs_write_helper(buffer, count, &val);
+       if (rc)
+               return rc;
+
+       if (val < 1)
+               return -EINVAL;
+
+       spin_lock(&ofd->ofd_objid_lock);
+       ofd->ofd_precreate_batch = val;
+       spin_unlock(&ofd->ofd_objid_lock);
        return count;
 }
 
@@ -286,9 +317,9 @@ int lprocfs_ofd_wr_degraded(struct file *file, const char *buffer,
        if (rc)
                return rc;
 
-       cfs_spin_lock(&ofd->ofd_flags_lock);
+       spin_lock(&ofd->ofd_flags_lock);
        ofd->ofd_raid_degraded = !!val;
-       cfs_spin_unlock(&ofd->ofd_flags_lock);
+       spin_unlock(&ofd->ofd_flags_lock);
 
        return count;
 }
@@ -332,10 +363,10 @@ int lprocfs_ofd_wr_syncjournal(struct file *file, const char *buffer,
        if (val < 0)
                return -EINVAL;
 
-       cfs_spin_lock(&ofd->ofd_flags_lock);
+       spin_lock(&ofd->ofd_flags_lock);
        ofd->ofd_syncjournal = !!val;
        ofd_slc_set(ofd);
-       cfs_spin_unlock(&ofd->ofd_flags_lock);
+       spin_unlock(&ofd->ofd_flags_lock);
 
        return count;
 }
@@ -382,9 +413,9 @@ int lprocfs_ofd_wr_sync_lock_cancel(struct file *file, const char *buffer,
        if (val < 0 || val > 2)
                return -EINVAL;
 
-       cfs_spin_lock(&ofd->ofd_flags_lock);
+       spin_lock(&ofd->ofd_flags_lock);
        ofd->ofd_sync_lock_cancel = val;
-       cfs_spin_unlock(&ofd->ofd_flags_lock);
+       spin_unlock(&ofd->ofd_flags_lock);
        return count;
 }
 
@@ -414,9 +445,9 @@ int lprocfs_ofd_wr_grant_compat_disable(struct file *file, const char *buffer,
        if (val < 0)
                return -EINVAL;
 
-       cfs_spin_lock(&ofd->ofd_flags_lock);
+       spin_lock(&ofd->ofd_flags_lock);
        ofd->ofd_grant_compat_disable = !!val;
-       cfs_spin_unlock(&ofd->ofd_flags_lock);
+       spin_unlock(&ofd->ofd_flags_lock);
 
        return count;
 }
@@ -438,6 +469,8 @@ static struct lprocfs_vars lprocfs_ofd_obd_vars[] = {
        { "grant_precreate",     lprocfs_ofd_rd_grant_precreate, 0, 0 },
        { "grant_ratio",         lprocfs_ofd_rd_grant_ratio,
                                 lprocfs_ofd_wr_grant_ratio, 0, 0 },
+       { "precreate_batch",     lprocfs_ofd_rd_precreate_batch,
+                                lprocfs_ofd_wr_precreate_batch, 0 },
        { "recovery_status",     lprocfs_obd_rd_recovery_status, 0, 0 },
        { "recovery_time_soft",  lprocfs_obd_rd_recovery_time_soft,
                                 lprocfs_obd_wr_recovery_time_soft, 0},