From owner-svn-src-all@FreeBSD.ORG Sun Mar 24 13:57:26 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C2F6098; Sun, 24 Mar 2013 13:57:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail36.syd.optusnet.com.au (mail36.syd.optusnet.com.au [211.29.133.76]) by mx1.freebsd.org (Postfix) with ESMTP id 62860BD7; Sun, 24 Mar 2013 13:57:26 +0000 (UTC) Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106]) by mail36.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r2ODvLH1022917 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 25 Mar 2013 00:57:22 +1100 Date: Mon, 25 Mar 2013 00:57:20 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans Subject: Re: svn commit: r248680 - head/sbin/fsck_ffs In-Reply-To: <20130324232715.L959@besplex.bde.org> Message-ID: <20130325003122.N1398@besplex.bde.org> References: <201303241041.r2OAfTr1033109@svn.freebsd.org> <20130324232715.L959@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=D5QfsYtj c=1 sm=1 a=jO6rb6iV1_cA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=0pm9H42DGT4A:10 a=AS4WCpWeJh8pi0vQyyIA:9 a=CjuIK1q_8ugA:10 a=TEtd8y5WR3g2ypngnwZWYw==:117 Cc: svn-src-head@freebsd.org, Sean Bruno , src-committers@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Mar 2013 13:57:26 -0000 On Sun, 24 Mar 2013, Bruce Evans wrote: > ... >> - printf("%21s:%8ld %2ld.%ld%% %4ld.%03ld sec %2lld.%lld%%\n", >> + printf("%21s:%8ld %2ld.%ld%% %4jd.%03ld sec %2lld.%lld%%\n", >> buftype[i], readcnt[i], readcnt[i] * 100 / diskreads, >> (readcnt[i] * 1000 / diskreads) % 10, >> - readtime[i].tv_sec, readtime[i].tv_nsec / 1000000, >> + (intmax_t)readtime[i].tv_sec, readtime[i].tv_nsec / >> 1000000, >> msec * 100 / totalmsec, (msec * 1000 / totalmsec) % 10); > ... > I don't like the poor man's floating point calculations. Everything is > easier using floating point. Don't say that this would use too many resources on embedded systems :-). In FreeBSD-2, fsck_ffs has always used floating point for printing the percentages in its primary statistics (the % fragmentation lines that are printed for every file system checked by fsck_ffs). This wasn't in 4.4BSD (poor man's floating point calculations are used there too), but it was one of the first things changed in FreeBSD-2 in 1994. The FreeBSD version used a remnant of the poor man's floating point calculations at first (a decimal multiplication by 100) at first, but I changed it in 1997 to do a floating point multiplication. The decimal multiplication could have overflowed with today's sized disk on ffs1 (this takes 21+ million frags). Bruce