Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Use accessors in DEBUG and DIAGNOSTIC code as well



details:   https://anonhg.NetBSD.org/src/rev/cec64915d776
branches:  trunk
changeset: 339498:cec64915d776
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Jul 25 10:40:35 2015 +0000

description:
Use accessors in DEBUG and DIAGNOSTIC code as well

diffstat:

 sys/ufs/lfs/lfs_bio.c     |   8 ++--
 sys/ufs/lfs/lfs_debug.c   |  86 +++++++++++++++++++++++-----------------------
 sys/ufs/lfs/lfs_pages.c   |  12 +++---
 sys/ufs/lfs/lfs_segment.c |   6 +-
 sys/ufs/lfs/lfs_vnops.c   |   6 +-
 5 files changed, 59 insertions(+), 59 deletions(-)

diffs (277 lines):

diff -r 0a89b3fedbb2 -r cec64915d776 sys/ufs/lfs/lfs_bio.c
--- a/sys/ufs/lfs/lfs_bio.c     Sat Jul 25 10:37:22 2015 +0000
+++ b/sys/ufs/lfs/lfs_bio.c     Sat Jul 25 10:40:35 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_bio.c,v 1.130 2015/07/24 06:59:32 dholland Exp $   */
+/*     $NetBSD: lfs_bio.c,v 1.131 2015/07/25 10:40:35 martin Exp $     */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.130 2015/07/24 06:59:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.131 2015/07/25 10:40:35 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -231,7 +231,7 @@
                        DLOG((DLOG_AVAIL, "lfs_reserve: waiting for %ld (bfree = %d,"
                              " est_bfree = %d)\n",
                              fsb + fs->lfs_ravail + fs->lfs_favail,
-                             fs->lfs_bfree, LFS_EST_BFREE(fs)));
+                             lfs_sb_getbfree(fs), LFS_EST_BFREE(fs)));
                }
                ++slept;
 
@@ -367,7 +367,7 @@
 #ifdef DEBUG
                DLOG((DLOG_AVAIL, "lfs_fits: no fit: fsb = %ld, uinodes = %ld, "
                      "needed = %jd, avail = %jd\n",
-                     (long)fsb, (long)fs->lfs_uinodes, (intmax_t)needed,
+                     (long)fsb, (long)lfs_sb_getuinodes(fs), (intmax_t)needed,
                      (intmax_t)lfs_sb_getavail(fs)));
 #endif
                return 0;
diff -r 0a89b3fedbb2 -r cec64915d776 sys/ufs/lfs/lfs_debug.c
--- a/sys/ufs/lfs/lfs_debug.c   Sat Jul 25 10:37:22 2015 +0000
+++ b/sys/ufs/lfs/lfs_debug.c   Sat Jul 25 10:40:35 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_debug.c,v 1.43 2013/06/18 18:18:58 christos Exp $  */
+/*     $NetBSD: lfs_debug.c,v 1.44 2015/07/25 10:40:35 martin Exp $    */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.43 2013/06/18 18:18:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.44 2015/07/25 10:40:35 martin Exp $");
 
 #ifdef DEBUG
 
@@ -129,62 +129,62 @@
        printf("%s%x\t%s%x\t%s%d\t%s%d\n",
               "magic    ", lfsp->lfs_magic,
               "version  ", lfsp->lfs_version,
-              "size     ", lfsp->lfs_size,
-              "ssize    ", lfsp->lfs_ssize);
+              "size     ", lfs_sb_getsize(lfsp),
+              "ssize    ", lfs_sb_getssize(lfsp));
        printf("%s%d\t%s%d\t%s%d\t%s%d\n",
-              "dsize    ", lfsp->lfs_dsize,
-              "bsize    ", lfsp->lfs_bsize,
-              "fsize    ", lfsp->lfs_fsize,
-              "frag     ", lfsp->lfs_frag);
+              "dsize    ", lfs_sb_getdsize(lfsp),
+              "bsize    ", lfs_sb_getbsize(lfsp),
+              "fsize    ", lfs_sb_getfsize(lfsp),
+              "frag     ", lfs_sb_getfrag(lfsp));
 
        printf("%s%d\t%s%d\t%s%d\t%s%d\n",
-              "minfree  ", lfsp->lfs_minfree,
-              "inopb    ", lfsp->lfs_inopb,
-              "ifpb     ", lfsp->lfs_ifpb,
-              "nindir   ", lfsp->lfs_nindir);
+              "minfree  ", lfs_sb_getminfree(lfsp),
+              "inopb    ", lfs_sb_getinopb(lfsp),
+              "ifpb     ", lfs_sb_getifpb(lfsp),
+              "nindir   ", lfs_sb_getnindir(lfsp));
 
        printf("%s%d\t%s%d\t%s%d\t%s%d\n",
-              "nseg     ", lfsp->lfs_nseg,
-              "nspf     ", lfsp->lfs_nspf,
-              "cleansz  ", lfsp->lfs_cleansz,
-              "segtabsz ", lfsp->lfs_segtabsz);
+              "nseg     ", lfs_sb_getnseg(lfsp),
+              "nspf     ", lfs_sb_getnspf(lfsp),
+              "cleansz  ", lfs_sb_getcleansz(lfsp),
+              "segtabsz ", lfs_sb_getsegtabsz(lfsp));
 
        printf("%s%x\t%s%d\t%s%lx\t%s%d\n",
-              "segmask  ", lfsp->lfs_segmask,
-              "segshift ", lfsp->lfs_segshift,
-              "bmask    ", (unsigned long)lfsp->lfs_bmask,
-              "bshift   ", lfsp->lfs_bshift);
+              "segmask  ", lfs_sb_getsegmask(lfsp),
+              "segshift ", lfs_sb_getsegshift(lfsp),
+              "bmask    ", (unsigned long)lfs_sb_getbmask(lfsp),
+              "bshift   ", lfs_sb_getbshift(lfsp));
 
        printf("%s%lu\t%s%d\t%s%lx\t%s%u\n",
-              "ffmask   ", (unsigned long)lfsp->lfs_ffmask,
-              "ffshift  ", lfsp->lfs_ffshift,
-              "fbmask   ", (unsigned long)lfsp->lfs_fbmask,
-              "fbshift  ", lfsp->lfs_fbshift);
+              "ffmask   ", (unsigned long)lfs_sb_getffmask(lfsp),
+              "ffshift  ", lfs_sb_getffshift(lfsp),
+              "fbmask   ", (unsigned long)lfs_sb_getfbmask(lfsp),
+              "fbshift  ", lfs_sb_getfbshift(lfsp));
 
        printf("%s%d\t%s%d\t%s%x\t%s%qx\n",
-              "sushift  ", lfsp->lfs_sushift,
-              "fsbtodb  ", lfsp->lfs_fsbtodb,
-              "cksum    ", lfsp->lfs_cksum,
-              "maxfilesize ", (long long)lfsp->lfs_maxfilesize);
+              "sushift  ", lfs_sb_getsushift(lfsp),
+              "fsbtodb  ", lfs_sb_getfsbtodb(lfsp),
+              "cksum    ", lfs_sb_getcksum(lfsp),
+              "maxfilesize ", (long long)lfs_sb_getmaxfilesize(lfsp));
 
        printf("Superblock disk addresses:");
        for (i = 0; i < LFS_MAXNUMSB; i++)
-               printf(" %x", lfsp->lfs_sboffs[i]);
+               printf(" %x", lfs_sb_getsboff(lfsp, i));
        printf("\n");
 
        printf("Checkpoint Info\n");
        printf("%s%d\t%s%x\t%s%d\n",
-              "freehd   ", lfsp->lfs_freehd,
-              "idaddr   ", lfsp->lfs_idaddr,
-              "ifile    ", lfsp->lfs_ifile);
+              "freehd   ", lfs_sb_getfreehd(lfsp),
+              "idaddr   ", lfs_sb_getidaddr(lfsp),
+              "ifile    ", lfs_sb_getifile(lfsp));
        printf("%s%x\t%s%d\t%s%x\t%s%x\t%s%x\t%s%x\n",
-              "bfree    ", lfsp->lfs_bfree,
-              "nfiles   ", lfsp->lfs_nfiles,
-              "lastseg  ", lfsp->lfs_lastseg,
-              "nextseg  ", lfsp->lfs_nextseg,
-              "curseg   ", lfsp->lfs_curseg,
-              "offset   ", lfsp->lfs_offset);
-       printf("tstamp   %llx\n", (long long)lfsp->lfs_tstamp);
+              "bfree    ", lfs_sb_getbfree(lfsp),
+              "nfiles   ", lfs_sb_getnfiles(lfsp),
+              "lastseg  ", lfs_sb_getlastseg(lfsp),
+              "nextseg  ", lfs_sb_getnextseg(lfsp),
+              "curseg   ", lfs_sb_getcurseg(lfsp),
+              "offset   ", lfs_sb_getoffset(lfsp));
+       printf("tstamp   %llx\n", (long long)lfs_sb_gettstamp(lfsp));
 }
 
 void
@@ -232,11 +232,11 @@
 
        if (sp->sum_bytes_left > 484) {
                printf("%s:%d: bad value (%d = -%d) for sum_bytes_left\n",
-                      file, line, sp->sum_bytes_left, fs->lfs_sumsize-sp->sum_bytes_left);
+                      file, line, sp->sum_bytes_left, lfs_sb_getsumsize(fs)-sp->sum_bytes_left);
                panic("too many bytes");
        }
 
-       actual = fs->lfs_sumsize
+       actual = lfs_sb_getsumsize(fs)
                /* amount taken up by FINFOs */
                - ((char *)&(sp->fip->fi_blocks[sp->fip->fi_nblocks]) - (char *)(sp->segsum))
                        /* amount taken up by inode blocks */
@@ -258,12 +258,12 @@
                       actual);
 #endif
        if (sp->sum_bytes_left > 0
-          && ((char *)(sp->segsum))[fs->lfs_sumsize
+          && ((char *)(sp->segsum))[lfs_sb_getsumsize(fs)
                                     - sizeof(int32_t) * ((sp->ninodes+LFS_INOPB(fs)-1) / LFS_INOPB(fs))
                                     - sp->sum_bytes_left] != '\0') {
                printf("%s:%d: warning: segsum overwrite at %d (-%d => %d)\n",
                       file, line, sp->sum_bytes_left,
-                      fs->lfs_sumsize-sp->sum_bytes_left,
+                      lfs_sb_getsumsize(fs)-sp->sum_bytes_left,
                       actual);
 #ifdef DDB
                Debugger();
diff -r 0a89b3fedbb2 -r cec64915d776 sys/ufs/lfs/lfs_pages.c
--- a/sys/ufs/lfs/lfs_pages.c   Sat Jul 25 10:37:22 2015 +0000
+++ b/sys/ufs/lfs/lfs_pages.c   Sat Jul 25 10:40:35 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_pages.c,v 1.3 2015/07/24 06:59:32 dholland Exp $   */
+/*     $NetBSD: lfs_pages.c,v 1.4 2015/07/25 10:40:35 martin Exp $     */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.3 2015/07/24 06:59:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.4 2015/07/25 10:40:35 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -784,8 +784,8 @@
                if (error == EDEADLK || error == EAGAIN) {
                        DLOG((DLOG_PAGE, "lfs_putpages: genfs_putpages returned"
                              " %d ino %d off %x (seg %d)\n", error,
-                             ip->i_number, fs->lfs_offset,
-                             lfs_dtosn(fs, fs->lfs_offset)));
+                             ip->i_number, lfs_sb_getoffset(fs),
+                             lfs_dtosn(fs, lfs_sb_getoffset(fs))));
 
                        if (oreclaim) {
                                mutex_enter(vp->v_interlock);
@@ -799,8 +799,8 @@
                } else if (error) {
                        DLOG((DLOG_PAGE, "lfs_putpages: genfs_putpages returned"
                              " %d ino %d off %x (seg %d)\n", error,
-                             (int)ip->i_number, fs->lfs_offset,
-                             lfs_dtosn(fs, fs->lfs_offset)));
+                             (int)ip->i_number, lfs_sb_getoffset(fs),
+                             lfs_dtosn(fs, lfs_sb_getoffset(fs))));
                }
                /* genfs_do_putpages loses the interlock */
 #ifdef DEBUG
diff -r 0a89b3fedbb2 -r cec64915d776 sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Sat Jul 25 10:37:22 2015 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Sat Jul 25 10:40:35 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_segment.c,v 1.243 2015/07/24 06:59:32 dholland Exp $       */
+/*     $NetBSD: lfs_segment.c,v 1.244 2015/07/25 10:40:35 martin Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.243 2015/07/24 06:59:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.244 2015/07/25 10:40:35 martin Exp $");
 
 #define _VFS_VNODE_PRIVATE     /* XXX: check for VI_MARKER, this has to go */
 
@@ -2247,7 +2247,7 @@
                    / sizeof(int32_t)) {
                        panic("lfs_writeseg: real bpp overwrite");
                }
-               if (bpp - sp->bpp > lfs_segsize(fs) / fs->lfs_fsize) {
+               if (bpp - sp->bpp > lfs_segsize(fs) / lfs_sb_getfsize(fs)) {
                        panic("lfs_writeseg: theoretical bpp overwrite");
                }
 #endif
diff -r 0a89b3fedbb2 -r cec64915d776 sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c   Sat Jul 25 10:37:22 2015 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c   Sat Jul 25 10:40:35 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vnops.c,v 1.275 2015/07/24 06:59:32 dholland Exp $ */
+/*     $NetBSD: lfs_vnops.c,v 1.276 2015/07/25 10:40:35 martin Exp $   */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.275 2015/07/24 06:59:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.276 2015/07/25 10:40:35 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1870,7 +1870,7 @@
                LFS_CLEANERINFO(cip, fs, bp);
                DLOG((DLOG_CLEAN, "lfs_fcntl: reclaim wrote %" PRId64
                      " blocks, cleaned %" PRId32 " segments (activesb %d)\n",
-                     fs->lfs_offset - off, cip->clean - oclean,
+                     lfs_sb_getoffset(fs) - off, cip->clean - oclean,
                      fs->lfs_activesb));
                LFS_SYNC_CLEANERINFO(cip, fs, bp, 0);
 #else



Home | Main Index | Thread Index | Old Index