From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 13:56:23 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76A93106568B; Mon, 13 Oct 2008 13:56:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 64F618FC1A; Mon, 13 Oct 2008 13:56:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DDuNwb077737; Mon, 13 Oct 2008 13:56:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DDuNhA077736; Mon, 13 Oct 2008 13:56:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200810131356.m9DDuNhA077736@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 13 Oct 2008 13:56:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183820 - head/sbin/fsck_ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 13:56:23 -0000 Author: kib Date: Mon Oct 13 13:56:23 2008 New Revision: 183820 URL: http://svn.freebsd.org/changeset/base/183820 Log: check_maps() in /usr/src/sbin/fsck_ffs/pass5.c seems to be limited to file systems less than 1 TB, due to using 32-bits integers for file system block numbers. This also causes incorrect error reporting for foreground fsck. Convert it to use ufs2_daddr_t for block numbers. PR: kern/127951 Submitted by: tegge MFC after: 1 week Modified: head/sbin/fsck_ffs/pass5.c Modified: head/sbin/fsck_ffs/pass5.c ============================================================================== --- head/sbin/fsck_ffs/pass5.c Mon Oct 13 13:00:21 2008 (r183819) +++ head/sbin/fsck_ffs/pass5.c Mon Oct 13 13:56:23 2008 (r183820) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #include "fsck.h" -static void check_maps(u_char *, u_char *, int, int, const char *, int *, int, int); +static void check_maps(u_char *, u_char *, int, ufs2_daddr_t, const char *, int *, int, int); void pass5(void) @@ -321,13 +321,17 @@ pass5(void) } if (excessdirs > 0) check_maps(cg_inosused(newcg), cg_inosused(cg), - inomapsize, cg->cg_cgx * fs->fs_ipg, "DIR", + inomapsize, + cg->cg_cgx * (ufs2_daddr_t) fs->fs_ipg, + "DIR", freedirs, 0, excessdirs); check_maps(cg_inosused(newcg), cg_inosused(cg), - inomapsize, cg->cg_cgx * fs->fs_ipg, "FILE", + inomapsize, + cg->cg_cgx * (ufs2_daddr_t) fs->fs_ipg, "FILE", freefiles, excessdirs, fs->fs_ipg); check_maps(cg_blksfree(cg), cg_blksfree(newcg), - blkmapsize, cg->cg_cgx * fs->fs_fpg, "FRAG", + blkmapsize, + cg->cg_cgx * (ufs2_daddr_t) fs->fs_fpg, "FRAG", freeblks, 0, fs->fs_fpg); } if (cursnapshot == 0 && @@ -407,7 +411,7 @@ check_maps( u_char *map1, /* map of claimed allocations */ u_char *map2, /* map of determined allocations */ int mapsize, /* size of above two maps */ - int startvalue, /* resource value for first element in map */ + ufs2_daddr_t startvalue, /* resource value for first element in map */ const char *name, /* name of resource found in maps */ int *opcode, /* sysctl opcode to free resource */ int skip, /* number of entries to skip before starting to free */ @@ -415,8 +419,8 @@ check_maps( { # define BUFSIZE 16 char buf[BUFSIZE]; - long i, j, k, l, m, n, size; - int astart, aend, ustart, uend; + long i, j, k, l, m, size; + ufs2_daddr_t n, astart, aend, ustart, uend; void (*msg)(const char *fmt, ...); if (bkgrdflag) @@ -443,10 +447,12 @@ check_maps( continue; } if (astart == aend) - (*msg)("ALLOCATED %s %d MARKED FREE\n", + (*msg)("ALLOCATED %s %" PRId64 + " MARKED FREE\n", name, astart); else - (*msg)("%s %sS %d-%d MARKED FREE\n", + (*msg)("%s %sS %" PRId64 "-%" PRId64 + " MARKED FREE\n", "ALLOCATED", name, astart, aend); astart = aend = n; } else { @@ -472,10 +478,12 @@ check_maps( if (size > limit) size = limit; if (debug && size == 1) - pwarn("%s %s %d MARKED USED\n", + pwarn("%s %s %" PRId64 + " MARKED USED\n", "UNALLOCATED", name, ustart); else if (debug) - pwarn("%s %sS %d-%ld MARKED USED\n", + pwarn("%s %sS %" PRId64 "-%" PRId64 + " MARKED USED\n", "UNALLOCATED", name, ustart, ustart + size - 1); if (bkgrdflag != 0) { @@ -497,9 +505,11 @@ check_maps( } if (astart != -1) { if (astart == aend) - (*msg)("ALLOCATED %s %d MARKED FREE\n", name, astart); + (*msg)("ALLOCATED %s %" PRId64 + " MARKED FREE\n", name, astart); else - (*msg)("ALLOCATED %sS %d-%d MARKED FREE\n", + (*msg)("ALLOCATED %sS %" PRId64 "-%" PRId64 + " MARKED FREE\n", name, astart, aend); } if (ustart != -1) { @@ -514,10 +524,12 @@ check_maps( size = limit; if (debug) { if (size == 1) - pwarn("UNALLOCATED %s %d MARKED USED\n", + pwarn("UNALLOCATED %s %" PRId64 + " MARKED USED\n", name, ustart); else - pwarn("UNALLOCATED %sS %d-%ld MARKED USED\n", + pwarn("UNALLOCATED %sS %" PRId64 "-%" PRId64 + " MARKED USED\n", name, ustart, ustart + size - 1); } if (bkgrdflag != 0) {