From: Matt Ezell Date: Mon, 17 Oct 2011 14:43:22 +0000 (-0400) Subject: LU-715 lov: fix procfs reporting for qos values X-Git-Tag: 2.1.52~31 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=0d0b8d65d84c644290f938a43fdcb0d68015c519 LU-715 lov: fix procfs reporting for qos values When writing to /proc/fs/lustre/lov/-mdtlov/{qos_prio_free,qos_threshold_rr}, the values read back are often one less than the values written. This happens because internally the value is stored as a number from 0-255 but accessed by the user with 0-100. Integer truncation in the storage and retrieval stages causes this to often show lower. Adding 255 to an internal step causes the bit-shift to "round up". Signed-off-by: Matt Ezell Change-Id: I9050aadb55bfa82d14b94a78e399d315249ac48f Reviewed-on: http://review.whamcloud.com/1532 Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c index d9d3d91..c831e98 100644 --- a/lustre/lov/lproc_lov.c +++ b/lustre/lov/lproc_lov.c @@ -213,7 +213,7 @@ static int lov_rd_qos_priofree(char *page, char **start, off_t off, int count, lov = &dev->u.lov; *eof = 1; return snprintf(page, count, "%d%%\n", - (lov->lov_qos.lq_prio_free * 100) >> 8); + (lov->lov_qos.lq_prio_free * 100 + 255) >> 8); } static int lov_wr_qos_priofree(struct file *file, const char *buffer, @@ -247,7 +247,7 @@ static int lov_rd_qos_thresholdrr(char *page, char **start, off_t off, lov = &dev->u.lov; *eof = 1; return snprintf(page, count, "%d%%\n", - (lov->lov_qos.lq_threshold_rr * 100) >> 8); + (lov->lov_qos.lq_threshold_rr * 100 + 255) >> 8); } static int lov_wr_qos_thresholdrr(struct file *file, const char *buffer,