Source-Changes-HG archive

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

[src/trunk]: src Second batch of 64 -> 32 truncations in lfs, along with more...



details:   https://anonhg.NetBSD.org/src/rev/eb60201741f9
branches:  trunk
changeset: 809801:eb60201741f9
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Aug 02 18:10:07 2015 +0000

description:
Second batch of 64 -> 32 truncations in lfs, along with more minor
tidyups and corrections in passing.

diffstat:

 libexec/lfs_cleanerd/cleaner.h      |   1 -
 libexec/lfs_cleanerd/lfs_cleanerd.c |  35 +++++++++++++++++++----------------
 sbin/fsck_lfs/lfs.c                 |  12 ++++++------
 sbin/fsck_lfs/setup.c               |  25 +++++++++++++------------
 sbin/newfs_lfs/make_lfs.c           |   5 +++--
 sys/ufs/lfs/lfs.h                   |   8 ++++----
 sys/ufs/lfs/lfs_accessors.h         |  16 ++++++++--------
 sys/ufs/lfs/lfs_debug.c             |  24 ++++++++++++------------
 sys/ufs/lfs/lfs_extern.h            |   4 ++--
 sys/ufs/lfs/lfs_pages.c             |  12 ++++++------
 sys/ufs/lfs/lfs_segment.c           |   7 ++++---
 sys/ufs/lfs/lfs_vfsops.c            |   6 +++---
 usr.sbin/dumplfs/dumplfs.c          |  30 +++++++++++++++---------------
 13 files changed, 95 insertions(+), 90 deletions(-)

diffs (truncated from 591 to 300 lines):

diff -r f4b2412a4998 -r eb60201741f9 libexec/lfs_cleanerd/cleaner.h
--- a/libexec/lfs_cleanerd/cleaner.h    Sun Aug 02 18:08:12 2015 +0000
+++ b/libexec/lfs_cleanerd/cleaner.h    Sun Aug 02 18:10:07 2015 +0000
@@ -63,7 +63,6 @@
 void lfs_ientry(IFILE **, struct clfs *, ino_t, struct ubuf **);
 int load_segment(struct clfs *, int, BLOCK_INFO **, int *);
 int needs_cleaning(struct clfs *, CLEANERINFO *);
-int32_t parse_pseg(struct clfs *, daddr_t, BLOCK_INFO **, int *);
 int reinit_fs(struct clfs *);
 void reload_ifile(struct clfs *);
 void toss_old_blocks(struct clfs *, BLOCK_INFO **, int *, int *);
diff -r f4b2412a4998 -r eb60201741f9 libexec/lfs_cleanerd/lfs_cleanerd.c
--- a/libexec/lfs_cleanerd/lfs_cleanerd.c       Sun Aug 02 18:08:12 2015 +0000
+++ b/libexec/lfs_cleanerd/lfs_cleanerd.c       Sun Aug 02 18:10:07 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.41 2015/07/28 05:14:23 dholland Exp $    */
+/* $NetBSD: lfs_cleanerd.c,v 1.42 2015/08/02 18:10:07 dholland Exp $    */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -380,13 +380,14 @@
  * Parse the partial segment at daddr, adding its information to
  * bip.         Return the address of the next partial segment to read.
  */
-int32_t
+static daddr_t
 parse_pseg(struct clfs *fs, daddr_t daddr, BLOCK_INFO **bipp, int *bic)
 {
        SEGSUM *ssp;
        IFILE *ifp;
        BLOCK_INFO *bip, *nbip;
-       int32_t *iaddrp, idaddr, odaddr;
+       int32_t *iaddrp;
+       daddr_t idaddr, odaddr;
        FINFO *fip;
        struct ubuf *ifbp;
        struct ulfs1_dinode *dip;
@@ -405,6 +406,7 @@
         */
        cp = fd_ptrget(fs->clfs_devvp, daddr);
        ssp = (SEGSUM *)cp;
+       /* XXX ondisk32 */
        iaddrp = ((int32_t *)(cp + lfs_sb_getibsize(fs))) - 1;
        fip = (FINFO *)(cp + sizeof(SEGSUM));
 
@@ -412,16 +414,16 @@
         * Check segment header magic and checksum
         */
        if (ssp->ss_magic != SS_MAGIC) {
-               syslog(LOG_WARNING, "%s: sumsum magic number bad at 0x%x:"
+               syslog(LOG_WARNING, "%s: sumsum magic number bad at 0x%jx:"
                       " read 0x%x, expected 0x%x", lfs_sb_getfsmnt(fs),
-                      (int32_t)daddr, ssp->ss_magic, SS_MAGIC);
+                      (intmax_t)daddr, ssp->ss_magic, SS_MAGIC);
                return 0x0;
        }
        ck = cksum(&ssp->ss_datasum, lfs_sb_getsumsize(fs) - sizeof(ssp->ss_sumsum));
        if (ck != ssp->ss_sumsum) {
-               syslog(LOG_WARNING, "%s: sumsum checksum mismatch at 0x%x:"
+               syslog(LOG_WARNING, "%s: sumsum checksum mismatch at 0x%jx:"
                       " read 0x%x, computed 0x%x", lfs_sb_getfsmnt(fs),
-                      (int32_t)daddr, ssp->ss_sumsum, ck);
+                      (intmax_t)daddr, ssp->ss_sumsum, ck);
                return 0x0;
        }
 
@@ -443,8 +445,8 @@
                 * If we don't have either one, it's an error.
                 */
                if (fic >= ssp->ss_nfinfo && *iaddrp != daddr) {
-                       syslog(LOG_WARNING, "%s: bad pseg at %x (seg %d)",
-                              lfs_sb_getfsmnt(fs), odaddr, lfs_dtosn(fs, odaddr));
+                       syslog(LOG_WARNING, "%s: bad pseg at %jx (seg %d)",
+                              lfs_sb_getfsmnt(fs), (intmax_t)odaddr, lfs_dtosn(fs, odaddr));
                        *bipp = bip;
                        return 0x0;
                }
@@ -517,8 +519,8 @@
                        struct ubuf *nbp;
                        SEGSUM *nssp;
 
-                       syslog(LOG_WARNING, "fixing short FINFO at %x (seg %d)",
-                              odaddr, lfs_dtosn(fs, odaddr));
+                       syslog(LOG_WARNING, "fixing short FINFO at %jx (seg %d)",
+                              (intmax_t)odaddr, lfs_dtosn(fs, odaddr));
                        bread(fs->clfs_devvp, odaddr, lfs_sb_getfsize(fs),
                            0, &nbp);
                        nssp = (SEGSUM *)nbp->b_data;
@@ -527,8 +529,8 @@
                                lfs_sb_getsumsize(fs) - sizeof(nssp->ss_sumsum));
                        bwrite(nbp);
 #endif
-                       syslog(LOG_WARNING, "zero-length FINFO at %x (seg %d)",
-                              odaddr, lfs_dtosn(fs, odaddr));
+                       syslog(LOG_WARNING, "zero-length FINFO at %jx (seg %d)",
+                              (intmax_t)odaddr, lfs_dtosn(fs, odaddr));
                        continue;
                }
 
@@ -590,8 +592,9 @@
 
 #ifndef REPAIR_ZERO_FINFO
        if (ssp->ss_datasum != ck) {
-               syslog(LOG_WARNING, "%s: data checksum bad at 0x%x:"
-                      " read 0x%x, computed 0x%x", lfs_sb_getfsmnt(fs), odaddr,
+               syslog(LOG_WARNING, "%s: data checksum bad at 0x%jx:"
+                      " read 0x%x, computed 0x%x", lfs_sb_getfsmnt(fs),
+                      (intmax_t)odaddr,
                       ssp->ss_datasum, ck);
                *bic = obic;
                return 0x0;
@@ -637,7 +640,7 @@
 int
 load_segment(struct clfs *fs, int sn, BLOCK_INFO **bipp, int *bic)
 {
-       int32_t daddr;
+       daddr_t daddr;
        int i, npseg;
 
        daddr = lfs_sntod(fs, sn);
diff -r f4b2412a4998 -r eb60201741f9 sbin/fsck_lfs/lfs.c
--- a/sbin/fsck_lfs/lfs.c       Sun Aug 02 18:08:12 2015 +0000
+++ b/sbin/fsck_lfs/lfs.c       Sun Aug 02 18:10:07 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.c,v 1.49 2015/08/02 18:08:12 dholland Exp $ */
+/* $NetBSD: lfs.c,v 1.50 2015/08/02 18:10:08 dholland Exp $ */
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -644,7 +644,7 @@
                        break;
                }
                if (debug)
-                       pwarn("summary good: 0x%x/%d\n", (int)daddr,
+                       pwarn("summary good: 0x%x/%d\n", (uintmax_t)daddr,
                              (int)sp->ss_serial);
                assert (bc > 0);
                odaddr = daddr;
@@ -818,15 +818,15 @@
        }
 
        if (datac != nblocks) {
-               pwarn("Partial segment at 0x%llx expected %d blocks counted %d\n",
-                   (long long) pseg_addr, nblocks, datac);
+               pwarn("Partial segment at 0x%jx expected %d blocks counted %d\n",
+                   (intmax_t)pseg_addr, nblocks, datac);
        }
        ccksum = cksum(datap, nblocks * sizeof(u_int32_t));
        /* Check the data checksum */
        if (ccksum != sp->ss_datasum) {
-               pwarn("Partial segment at 0x%" PRIx32 " data checksum"
+               pwarn("Partial segment at 0x%jx data checksum"
                      " mismatch: given 0x%x, computed 0x%x\n",
-                     pseg_addr, sp->ss_datasum, ccksum);
+                     (uintmax_t)pseg_addr, sp->ss_datasum, ccksum);
                free(datap);
                return 0;
        }
diff -r f4b2412a4998 -r eb60201741f9 sbin/fsck_lfs/setup.c
--- a/sbin/fsck_lfs/setup.c     Sun Aug 02 18:08:12 2015 +0000
+++ b/sbin/fsck_lfs/setup.c     Sun Aug 02 18:10:07 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: setup.c,v 1.50 2015/08/02 17:56:24 dholland Exp $ */
+/* $NetBSD: setup.c,v 1.51 2015/08/02 18:10:08 dholland Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
 #include "fsutil.h"
 
 extern u_int32_t cksum(void *, size_t);
-static uint64_t calcmaxfilesize(int);
+static uint64_t calcmaxfilesize(unsigned);
 
 ulfs_daddr_t *din_table;
 SEGUSE *seg_table;
@@ -118,11 +118,12 @@
  * calculate the maximum file size allowed with the specified block shift.
  */
 static uint64_t
-calcmaxfilesize(int bshift)
+calcmaxfilesize(unsigned bshift)
 {
        uint64_t nptr; /* number of block pointers per block */
        uint64_t maxblock;
 
+       /* XXX ondisk32 */
        nptr = (1 << bshift) / sizeof(uint32_t);
        maxblock = ULFS_NDADDR + nptr + nptr * nptr + nptr * nptr * nptr;
 
@@ -237,8 +238,8 @@
                int bc;
 
                if (debug)
-                       pwarn("adjusting offset, serial for -i 0x%lx\n",
-                               (unsigned long)idaddr);
+                       pwarn("adjusting offset, serial for -i 0x%jx\n",
+                               (uintmax_t)idaddr);
                tdaddr = lfs_sntod(fs, lfs_dtosn(fs, idaddr));
                if (lfs_sntod(fs, lfs_dtosn(fs, tdaddr)) == tdaddr) {
                        if (tdaddr == lfs_sb_gets0addr(fs))
@@ -265,8 +266,8 @@
                                                   sizeof(sp->ss_sumsum))) {
                                brelse(bp, 0);
                                if (debug)
-                                       printf("bad cksum at %x\n",
-                                              (unsigned)tdaddr);
+                                       printf("bad cksum at %jx\n",
+                                              (uintmax_t)tdaddr);
                                break;
                        }
                        fp = (FINFO *)(sp + 1);
@@ -311,9 +312,9 @@
                ++fs->lfs_nactive;
                lfs_sb_setnextseg(fs, lfs_sntod(fs, sn));
                if (debug) {
-                       pwarn("offset = 0x%" PRIx32 ", serial = %" PRIu64 "\n",
+                       pwarn("offset = 0x%" PRIx64 ", serial = %" PRIu64 "\n",
                                lfs_sb_getoffset(fs), lfs_sb_getserial(fs));
-                       pwarn("curseg = %" PRIx32 ", nextseg = %" PRIx32 "\n",
+                       pwarn("curseg = %" PRIx64 ", nextseg = %" PRIx64 "\n",
                                lfs_sb_getcurseg(fs), lfs_sb_getnextseg(fs));
                }
 
@@ -381,9 +382,9 @@
        }
        if (lfs_sb_getmaxfilesize(fs) != maxfilesize) {
                pwarn(
-                   "INCORRECT MAXFILESIZE=%llu IN SUPERBLOCK (SHOULD BE %llu WITH BSHIFT %u)",
-                   (unsigned long long) lfs_sb_getmaxfilesize(fs),
-                   (unsigned long long) maxfilesize, lfs_sb_getbshift(fs));
+                   "INCORRECT MAXFILESIZE=%ju IN SUPERBLOCK (SHOULD BE %ju WITH BSHIFT %u)",
+                   (uintmax_t) lfs_sb_getmaxfilesize(fs),
+                   (uintmax_t) maxfilesize, lfs_sb_getbshift(fs));
                if (preen)
                        printf(" (FIXED)\n");
                if (preen || reply("FIX") == 1) {
diff -r f4b2412a4998 -r eb60201741f9 sbin/newfs_lfs/make_lfs.c
--- a/sbin/newfs_lfs/make_lfs.c Sun Aug 02 18:08:12 2015 +0000
+++ b/sbin/newfs_lfs/make_lfs.c Sun Aug 02 18:10:07 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make_lfs.c,v 1.35 2015/08/02 18:08:12 dholland Exp $   */
+/*     $NetBSD: make_lfs.c,v 1.36 2015/08/02 18:10:08 dholland Exp $   */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 #if 0
 static char sccsid[] = "@(#)lfs.c      8.5 (Berkeley) 5/24/95";
 #else
-__RCSID("$NetBSD: make_lfs.c,v 1.35 2015/08/02 18:08:12 dholland Exp $");
+__RCSID("$NetBSD: make_lfs.c,v 1.36 2015/08/02 18:10:08 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -209,6 +209,7 @@
        uint64_t nptr; /* number of block pointers per block */
        uint64_t maxblock;
 
+       /* XXX ondisk32 */
        nptr = (1 << bshift) / sizeof(uint32_t);
        maxblock = ULFS_NDADDR + nptr + nptr * nptr + nptr * nptr * nptr;
 
diff -r f4b2412a4998 -r eb60201741f9 sys/ufs/lfs/lfs.h
--- a/sys/ufs/lfs/lfs.h Sun Aug 02 18:08:12 2015 +0000
+++ b/sys/ufs/lfs/lfs.h Sun Aug 02 18:10:07 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs.h,v 1.168 2015/08/02 18:08:13 dholland Exp $       */
+/*     $NetBSD: lfs.h,v 1.169 2015/08/02 18:10:08 dholland Exp $       */
 
 /*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
 /*  from NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp  */
@@ -554,7 +554,7 @@
        u_int32_t ss_sumsum;            /* 0: check sum of summary block */
        u_int32_t ss_datasum;           /* 4: check sum of data */
        u_int32_t ss_magic;             /* 8: segment summary magic number */
-       int32_t   ss_next;              /* 12: next segment */
+       int32_t   ss_next;              /* 12: next segment (disk address) */
        u_int32_t ss_ident;             /* 16: roll-forward fsid */
 #define ss_ocreate ss_ident /* ident is where create was in v1 */
        u_int16_t ss_nfinfo;            /* 20: number of file info structures */
@@ -587,7 +587,7 @@
        u_int32_t dlfs_frag;      /* 28: number of frags in a block in fs */
 
 /* Checkpoint region. */
-       u_int32_t dlfs_freehd;    /* 32: start of the free list */
+       u_int32_t dlfs_freehd;    /* 32: start of the free inode list */
        int32_t   dlfs_bfree;     /* 36: number of free frags */
        u_int32_t dlfs_nfiles;    /* 40: number of allocated inodes */
        int32_t   dlfs_avail;     /* 44: blocks available for writing */
@@ -730,7 +730,7 @@
        int lfs_wrappass;               /* Allow first log wrap requester to pass */
        int lfs_wrapstatus;             /* Wrap status */
        int lfs_reclino;                /* Inode being reclaimed */
-       int lfs_startseg;               /* Segment we started writing at */
+       daddr_t lfs_startseg;           /* Segment we started writing at */
        LIST_HEAD(, segdelta) lfs_segdhd;       /* List of pending trunc accounting events */
 
 #ifdef _KERNEL
diff -r f4b2412a4998 -r eb60201741f9 sys/ufs/lfs/lfs_accessors.h



Home | Main Index | Thread Index | Old Index