From f0ae064b8706563c38fd835e3b08963a75848c3e Mon Sep 17 00:00:00 2001 From: Rahul Deshmukh Date: Thu, 14 Oct 2010 18:59:45 +0530 Subject: [PATCH] b=21135 errors seen running llverfs (full mode) at 94% full with lustre fs with three 16TB OST's o=andreas i=girish i=simmonsja --- lustre/utils/lfs.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 41d2342..0875b93 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -974,8 +974,8 @@ static int showdf(char *mntdir, struct obd_statfs *stat, total = (stat->os_blocks * stat->os_bsize) >> shift; } - if (total > 0) - ratio = (double)used / (double)total; + if ((used + avail) > 0) + ratio = (double)used / (double)(used + avail); if (cooked) { int i; @@ -1007,7 +1007,7 @@ static int showdf(char *mntdir, struct obd_statfs *stat, sprintf(abuf, CDF, avail); } - sprintf(rbuf, RDF, (int)(ratio * 100)); + sprintf(rbuf, RDF, (int)(ratio * 100 + 0.5)); printf(UUF" "CSF" "CSF" "CSF" "RSF" %-s", uuid, tbuf, ubuf, abuf, rbuf, mntdir); if (type) @@ -1082,18 +1082,14 @@ static int mntdf(char *mntdir, char *fsname, char *pool, int ishow, int cooked) /* the llapi_obd_statfs() call may have returned with * an error, but if it filled in uuid_buf we will at * lease use that to print out a message for that OBD. - * If we didn't even fill in uuid_buf something is - * definitely incorrect and no point in continuing. */ - if (uuid_buf.uuid[0] != '\0') { - showdf(mntdir,&stat_buf,obd_uuid2str(&uuid_buf), - ishow, cooked, tp->st_name, index, rc); - } else { - char tmp_uuid[12]; + * If we didn't get anything in the uuid_buf, then fill + * it in so that we can print an error message. */ + if (uuid_buf.uuid[0] == '\0') + sprintf(uuid_buf.uuid, "%s%04x", + tp->st_name, index); + showdf(mntdir,&stat_buf,obd_uuid2str(&uuid_buf), + ishow, cooked, tp->st_name, index, rc); - sprintf(tmp_uuid, "%s%04x", tp->st_name, index); - showdf(mntdir, &stat_buf, tmp_uuid, - ishow, cooked, tp->st_name, index, rc); - } if (rc == 0) { if (tp->st_op == LL_STATFS_MDC) { sum.os_ffree += stat_buf.os_ffree; -- 1.8.3.1