NetBSD Problem Report #50422
From kre@munnari.OZ.AU Thu Nov 12 17:24:01 2015
Return-Path: <kre@munnari.OZ.AU>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id CB517A65C3
for <gnats-bugs@gnats.NetBSD.org>; Thu, 12 Nov 2015 17:24:00 +0000 (UTC)
Message-Id: <201511121722.tACHMP8C010822@andromeda.noi.kre.to>
Date: Fri, 13 Nov 2015 00:22:25 +0700 (ICT)
From: kre@munnari.OZ.AU
To: gnats-bugs@gnats.NetBSD.org
Subject: df -G prints the wrong value for fragsize (+FIX)
X-Send-Pr-Version: 3.95
>Number: 50422
>Category: bin
>Synopsis: df -G prints the wrong value for fragsize (+FIX)
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: christos
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 12 17:25:00 +0000 2015
>Closed-Date: Sun Aug 08 20:47:25 +0000 2021
>Last-Modified: Sun Aug 08 20:47:25 +0000 2021
>Originator: Robert Elz
>Release: NetBSD 7.99.21 (all versions since NetBSD 5)
>Organization:
Prince of Songkla University
>Environment:
System: NetBSD andromeda.noi.kre.to 7.99.21 NetBSD 7.99.21 (VBOX64-1.1-20150829) #3: Sun Aug 30 07:16:17 ICT 2015 kre@andromeda.noi.kre.to:/home/kre/src/current-kernel/usr/src/sys/arch/amd64/compile/VBOX64 amd64
Architecture: x86_64
Machine: amd64
>Description:
df -G prints the file system block size as both the block
size and the frag size (OK, it gets the value from two different
fields of the statvfs struct, but they are both set to the same
value in the kernel for all cases I saw...)
>How-To-Repeat:
df -G /
Expect to see something like ...
/ (/dev/wd0a ): 8192 block size 8192 frag size
246959 total blocks 132363 free blocks 120016 available
57021 total files 61822 free files 0 filesys id
ffs fstype 0x2005000 flag 255 filename length
0 owner 0 syncwrites 20712 asyncwrites
Yet (from dumpfs) ...
file system: /dev/rwd0a
format FFSv2
endian little-endian
location 65536 (-b 128)
magic 19540119 time Fri Nov 13 00:15:31 2015
superblock location 65536 id [ 5497bb3d 3df723af ]
cylgrp dynamic inodes FFSv2 sblock FFSv2 fslevel 5
nbfree 16535 ndir 628 nifree 57021 nffree 83
ncg 6 size 262584 blocks 246959
bsize 8192 shift 13 mask 0xffffe000
fsize 1024 shift 10 mask 0xfffffc00
frag 8 shift 3 fsbtodb 1
bpg 5471 fpg 43768 ipg 10304
>Fix:
Apply the patch included below. With that, expect to see ...
/ (/dev/wd0a ): 8192 block size 1024 frag size
246959 total blocks 132363 free blocks 120016 available
57021 total files 61822 free files 0 filesys id
ffs fstype 0x2005000 flag 255 filename length
0 owner 0 syncwrites 20789 asyncwrites
In the patch, the change from f_iosize to f_bsize is almost
gratuitous, I made it because if the aim is to print the
file system block size, that's what we should print, rather
than the optimal I/O size ... if the latter is wanted, which
might be a good idea, it should be added as a new field.
The second change is the one that fixes things.
This fix should be pulled up everywhere (pity we're a couple of
days too late to correct the netbsd-5 series ... that's the
first release that had df -G, so the first to contain the bug.)
--- df.c.BUG 2012-01-08 01:45:13.000000000 +0700
+++ df.c 2015-11-13 00:06:20.000000000 +0700
@@ -379,13 +379,13 @@
*/
(void)printf("%10s (%-12s): %7ld block size %12ld frag size\n",
sfsp->f_mntonname, sfsp->f_mntfromname,
- sfsp->f_iosize, /* On UFS/FFS systems this is
+ sfsp->f_bsize, /* On UFS/FFS systems this is
* also called the "optimal
* transfer block size" but it
* is of course the file
* system's block size too.
*/
- sfsp->f_bsize); /* not so surprisingly the
+ sfsp->f_frsize); /* not so surprisingly the
* "fundamental file system
* block size" is the frag
* size.
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/50422 CVS commit: src/bin/df
Date: Thu, 12 Nov 2015 12:59:21 -0500
Module Name: src
Committed By: christos
Date: Thu Nov 12 17:59:21 UTC 2015
Modified Files:
src/bin/df: df.c
Log Message:
PR/50422: Robert Elz: df -G prints the wrong value for fragsize (+FIX)
For df -G, print the block and fragment size instead of the iosize
and the blocksize. If we need to print the iosize, it should be done
in a different field. Nevertheless printing the blocksize in the fragment
size field is just wrong.
XXX: pullup-6, pullup-7
To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/bin/df/df.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Responsible-Changed-From-To: bin-bug-people->christos
Responsible-Changed-By: mrg@NetBSD.org
Responsible-Changed-When: Sat, 28 Nov 2015 22:51:38 +0000
Responsible-Changed-Why:
xtos fixed it.
State-Changed-From-To: open->pending-pullups
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Sat, 28 Nov 2015 22:51:38 +0000
State-Changed-Why:
we need pullups.
State-Changed-From-To: pending-pullups->open
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 28 Nov 2015 23:42:26 +0000
State-Changed-Why:
the state for "pullups are needed" is, alas, "open"
State-Changed-From-To: open->needs-pullups
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Wed, 20 May 2020 22:20:54 +0000
State-Changed-Why:
and nowadays there's a state for pullups needed.
State-Changed-From-To: needs-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 08 Aug 2021 20:47:25 +0000
State-Changed-Why:
...but pullups to -6 and -7 are no longer relevant.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.