Whamcloud - gitweb
LU-7334 lprocfs: Allow default multiplier of 1 55/20455/7
authorGiuseppe Di Natale <dinatale2@llnl.gov>
Wed, 25 May 2016 23:23:28 +0000 (16:23 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 5 Jul 2016 23:51:39 +0000 (23:51 +0000)
A new default unit '1' is accepted by lprocfs_str_with_units_to_s64
to indicate a default multiplier of 1.

Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Change-Id: Iebf29f5d3c36e583729ea717288850729b99eeed
Reviewed-on: http://review.whamcloud.com/20455
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Christopher J. Morrone <morrone2@llnl.gov>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lod/lproc_lod.c
lustre/obdclass/lprocfs_status.c
lustre/osc/lproc_osc.c
lustre/osd-ldiskfs/osd_lproc.c

index 389ac3f..a30eba2 100644 (file)
@@ -95,7 +95,7 @@ lod_stripesize_seq_write(struct file *file, const char __user *buffer,
 
        LASSERT(dev != NULL);
        lod  = lu2lod_dev(dev->obd_lu_dev);
-       rc = lprocfs_str_to_s64(buffer, count, &val);
+       rc = lprocfs_str_with_units_to_s64(buffer, count, &val, '1');
        if (rc)
                return rc;
        if (val < 0)
@@ -155,7 +155,7 @@ lod_stripeoffset_seq_write(struct file *file, const char __user *buffer,
 
        LASSERT(dev != NULL);
        lod  = lu2lod_dev(dev->obd_lu_dev);
-       rc = lprocfs_str_to_s64(buffer, count, &val);
+       rc = lprocfs_str_with_units_to_s64(buffer, count, &val, '1');
        if (rc)
                return rc;
        if (val < 0)
index 491afcc..5913efb 100644 (file)
@@ -1924,12 +1924,14 @@ EXPORT_SYMBOL(lprocfs_str_to_s64);
 int lprocfs_str_with_units_to_s64(const char __user *buffer,
                                  unsigned long count, __s64 *val, char defunit)
 {
-       __u64 mult;
+       __u64 mult = 1;
        int rc;
 
-       rc = get_mult(defunit, &mult);
-       if (rc)
-               return rc;
+       if (defunit != '1') {
+               rc = get_mult(defunit, &mult);
+               if (rc)
+                       return rc;
+       }
 
        return str_to_s64_internal(buffer, count, val, mult, true);
 }
index 7cd40be..edc2050 100644 (file)
@@ -273,7 +273,7 @@ static ssize_t osc_cur_grant_bytes_seq_write(struct file *file,
        if (obd == NULL)
                return 0;
 
-       rc = lprocfs_str_to_s64(buffer, count, &val);
+       rc = lprocfs_str_with_units_to_s64(buffer, count, &val, '1');
        if (rc)
                return rc;
        if (val < 0)
@@ -556,7 +556,7 @@ static ssize_t osc_obd_max_pages_per_rpc_seq_write(struct file *file,
        int chunk_mask, rc;
        __s64 val;
 
-       rc = lprocfs_str_to_s64(buffer, count, &val);
+       rc = lprocfs_str_with_units_to_s64(buffer, count, &val, '1');
        if (rc)
                return rc;
        if (val < 0)
index 599d7e2..8171fbe 100644 (file)
@@ -557,7 +557,7 @@ ldiskfs_osd_readcache_seq_write(struct file *file, const char __user *buffer,
        if (unlikely(osd->od_mnt == NULL))
                return -EINPROGRESS;
 
-       rc = lprocfs_str_to_s64(buffer, count, &val);
+       rc = lprocfs_str_with_units_to_s64(buffer, count, &val, '1');
        if (rc)
                return rc;
        if (val < 0)