Whamcloud - gitweb
LU-7160 mgs: Skip processing .bak files on MGS
[fs/lustre-release.git] / lustre / mdc / lproc_mdc.c
index 023b779..6a11414 100644 (file)
 static int mdc_active_seq_show(struct seq_file *m, void *v)
 {
        struct obd_device *dev = m->private;
-       int rc;
 
        LPROCFS_CLIMP_CHECK(dev);
-       rc = seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
+       seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
        LPROCFS_CLIMP_EXIT(dev);
-       return rc;
+       return 0;
 }
 
 static ssize_t mdc_active_seq_write(struct file *file,
@@ -59,10 +58,11 @@ static ssize_t mdc_active_seq_write(struct file *file,
                                    size_t count, loff_t *off)
 {
        struct obd_device *dev;
-       int val, rc;
+       int rc;
+       __s64 val;
 
        dev = ((struct seq_file *)file->private_data)->private;
-       rc = lprocfs_write_helper(buffer, count, &val);
+       rc = lprocfs_str_to_s64(buffer, count, &val);
        if (rc)
                return rc;
        if (val < 0 || val > 1)
@@ -72,7 +72,8 @@ static ssize_t mdc_active_seq_write(struct file *file,
        if (dev->u.cli.cl_import->imp_deactive == val)
                rc = ptlrpc_set_import_active(dev->u.cli.cl_import, val);
        else
-               CDEBUG(D_CONFIG, "activate %d: ignoring repeat request\n", val);
+               CDEBUG(D_CONFIG, "activate %llu: ignoring repeat request\n",
+                      val);
 
        return count;
 }
@@ -82,12 +83,11 @@ static int mdc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
 {
        struct obd_device *dev = m->private;
        __u32 max;
-       int rc;
 
        max = obd_get_max_rpcs_in_flight(&dev->u.cli);
-       rc = seq_printf(m, "%u\n", max);
+       seq_printf(m, "%u\n", max);
 
-       return rc;
+       return 0;
 }
 
 static ssize_t mdc_max_rpcs_in_flight_seq_write(struct file *file,
@@ -96,15 +96,19 @@ static ssize_t mdc_max_rpcs_in_flight_seq_write(struct file *file,
                                                loff_t *off)
 {
        struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
-       int val;
+       __s64 val;
        int rc;
 
-       rc = lprocfs_write_helper(buffer, count, &val);
-       if (rc == 0)
-               rc = obd_set_max_rpcs_in_flight(&dev->u.cli, val);
+       rc = lprocfs_str_to_s64(buffer, count, &val);
+       if (rc)
+               return rc;
 
-       if (rc != 0)
-               count = rc;
+       if (val < 0 || val > UINT_MAX)
+               return -ERANGE;
+
+       rc = obd_set_max_rpcs_in_flight(&dev->u.cli, val);
+       if (rc)
+               return rc;
 
        return count;
 }
@@ -115,12 +119,11 @@ static int mdc_max_mod_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
 {
        struct obd_device *dev = m->private;
        __u16 max;
-       int rc;
 
        max = obd_get_max_mod_rpcs_in_flight(&dev->u.cli);
-       rc = seq_printf(m, "%hu\n", max);
+       seq_printf(m, "%hu\n", max);
 
-       return rc;
+       return 0;
 }
 
 static ssize_t mdc_max_mod_rpcs_in_flight_seq_write(struct file *file,
@@ -130,18 +133,18 @@ static ssize_t mdc_max_mod_rpcs_in_flight_seq_write(struct file *file,
 {
        struct obd_device *dev =
                        ((struct seq_file *)file->private_data)->private;
-       int val;
+       __s64 val;
        int rc;
 
-       rc = lprocfs_write_helper(buffer, count, &val);
-       if (rc != 0)
+       rc = lprocfs_str_to_s64(buffer, count, &val);
+       if (rc)
                return rc;
 
        if (val < 0 || val > USHRT_MAX)
                return -ERANGE;
 
        rc = obd_set_max_mod_rpcs_in_flight(&dev->u.cli, val);
-       if (rc != 0)
+       if (rc)
                count = rc;
 
        return count;