Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fsck_lfs Fix bug: for format version 1, the superblock ...



details:   https://anonhg.NetBSD.org/src/rev/a27112301215
branches:  trunk
changeset: 339656:a27112301215
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Aug 02 17:56:24 2015 +0000

description:
Fix bug: for format version 1, the superblock "size" field is measured
in blocks instead of frags, so use lfs_blkstofrags to correct it.

This code was instead multiplying by the block size divided by
DEV_BSIZE to get the number of disk blocks rather than the number of
frags. (I gather that originally these were the same, but they're not
necessarily any more.)

diffstat:

 sbin/fsck_lfs/setup.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 2fd105d1493c -r a27112301215 sbin/fsck_lfs/setup.c
--- a/sbin/fsck_lfs/setup.c     Sun Aug 02 16:46:12 2015 +0000
+++ b/sbin/fsck_lfs/setup.c     Sun Aug 02 17:56:24 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: setup.c,v 1.49 2015/07/28 05:09:34 dholland Exp $ */
+/* $NetBSD: setup.c,v 1.50 2015/08/02 17:56:24 dholland Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -334,7 +334,7 @@
                pwarn("lfs_inopb = %lu\n", (unsigned long) lfs_sb_getinopb(fs));
        }
        if (fs->lfs_version == 1)
-               maxfsblock = lfs_sb_getsize(fs) * (lfs_sb_getbsize(fs) / dev_bsize);
+               maxfsblock = lfs_blkstofrags(fs, lfs_sb_getsize(fs));
        else
                maxfsblock = lfs_sb_getsize(fs);
        maxfilesize = calcmaxfilesize(lfs_sb_getbshift(fs));



Home | Main Index | Thread Index | Old Index