From 2fc4838533668135d2efe98b90e56a9ac5dadaea Mon Sep 17 00:00:00 2001 From: Giuseppe Di Natale Date: Wed, 25 May 2016 16:23:28 -0700 Subject: [PATCH] LU-7334 lprocfs: Allow default multiplier of 1 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 Change-Id: Iebf29f5d3c36e583729ea717288850729b99eeed Reviewed-on: http://review.whamcloud.com/20455 Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Christopher J. Morrone Reviewed-by: Oleg Drokin --- lustre/lod/lproc_lod.c | 4 ++-- lustre/obdclass/lprocfs_status.c | 10 ++++++---- lustre/osc/lproc_osc.c | 4 ++-- lustre/osd-ldiskfs/osd_lproc.c | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lustre/lod/lproc_lod.c b/lustre/lod/lproc_lod.c index 389ac3f..a30eba2 100644 --- a/lustre/lod/lproc_lod.c +++ b/lustre/lod/lproc_lod.c @@ -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) diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 491afcc..5913efb 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -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); } diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index 7cd40be..edc2050 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -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) diff --git a/lustre/osd-ldiskfs/osd_lproc.c b/lustre/osd-ldiskfs/osd_lproc.c index 599d7e2..8171fbe 100644 --- a/lustre/osd-ldiskfs/osd_lproc.c +++ b/lustre/osd-ldiskfs/osd_lproc.c @@ -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) -- 1.8.3.1