From da1f43d88fec1f27ff9f18974b0f59b963820de8 Mon Sep 17 00:00:00 2001 From: tsutsui Date: Mon, 26 Nov 2007 15:41:03 +0000 Subject: [PATCH] Account e2fs_reserved_ngdb blocks accordingly in ext2fs_statvfs(). --- sys/ufs/ext2fs/ext2fs_vfsops.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index d57b7fb0ad03..7f2b3d7847a9 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_vfsops.c,v 1.120 2007/10/17 17:34:25 ad Exp $ */ +/* $NetBSD: ext2fs_vfsops.c,v 1.121 2007/11/26 15:41:03 tsutsui Exp $ */ /* * Copyright (c) 1989, 1991, 1993, 1994 @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.120 2007/10/17 17:34:25 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.121 2007/11/26 15:41:03 tsutsui Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -781,7 +781,7 @@ ext2fs_statvfs(struct mount *mp, struct statvfs *sbp, struct lwp *l) { struct ufsmount *ump; struct m_ext2fs *fs; - u_int32_t overhead, overhead_per_group; + u_int32_t overhead, overhead_per_group, ngdb; int i, ngroups; ump = VFSTOUFS(mp); @@ -806,7 +806,11 @@ ext2fs_statvfs(struct mount *mp, struct statvfs *sbp, struct lwp *l) } else { ngroups = fs->e2fs_ncg; } - overhead += ngroups * (1 + fs->e2fs_ngdb); + ngdb = fs->e2fs_ngdb; + if (fs->e2fs.e2fs_rev > E2FS_REV0 && + fs->e2fs.e2fs_features_compat & EXT2F_COMPAT_RESIZE) + ngdb += fs->e2fs.e2fs_reserved_ngdb; + overhead += ngroups * (1 + ngdb); sbp->f_bsize = fs->e2fs_bsize; sbp->f_frsize = 1024 << fs->e2fs.e2fs_fsize;