Author: mckusick
Date: Sun Feb 24 06:44:29 2013
New Revision: 247212
URL: http://svnweb.freebsd.org/changeset/base/247212

Log:
  When running with the -d option, instrument fsck_ffs to track the number,
  data type, and running time of its I/O operations.
  
  No functional changes.

Modified:
  head/sbin/fsck_ffs/dir.c
  head/sbin/fsck_ffs/ea.c
  head/sbin/fsck_ffs/fsck.h
  head/sbin/fsck_ffs/fsutil.c
  head/sbin/fsck_ffs/inode.c
  head/sbin/fsck_ffs/main.c
  head/sbin/fsck_ffs/setup.c

Modified: head/sbin/fsck_ffs/dir.c
==============================================================================
--- head/sbin/fsck_ffs/dir.c    Sun Feb 24 05:48:59 2013        (r247211)
+++ head/sbin/fsck_ffs/dir.c    Sun Feb 24 06:44:29 2013        (r247212)
@@ -708,6 +708,6 @@ getdirblk(ufs2_daddr_t blkno, long size)
 
        if (pdirbp != 0)
                pdirbp->b_flags &= ~B_INUSE;
-       pdirbp = getdatablk(blkno, size);
+       pdirbp = getdatablk(blkno, size, BT_DIRDATA);
        return (pdirbp);
 }

Modified: head/sbin/fsck_ffs/ea.c
==============================================================================
--- head/sbin/fsck_ffs/ea.c     Sun Feb 24 05:48:59 2013        (r247211)
+++ head/sbin/fsck_ffs/ea.c     Sun Feb 24 06:44:29 2013        (r247212)
@@ -73,7 +73,7 @@ eascan(struct inodesc *idesc, struct ufs
        else
                blksiz = sblock.fs_bsize;
        printf("blksiz = %ju\n", (intmax_t)blksiz);
-       bp = getdatablk(dp->di_extb[0], blksiz);
+       bp = getdatablk(dp->di_extb[0], blksiz, BT_EXTATTR);
        cp = (u_char *)bp->b_un.b_buf;
        for (n = 0; n < blksiz; n++) {
                printf("%02x", cp[n]);

Modified: head/sbin/fsck_ffs/fsck.h
==============================================================================
--- head/sbin/fsck_ffs/fsck.h   Sun Feb 24 05:48:59 2013        (r247211)
+++ head/sbin/fsck_ffs/fsck.h   Sun Feb 24 06:44:29 2013        (r247212)
@@ -138,6 +138,7 @@ struct bufarea {
        int b_size;
        int b_errs;
        int b_flags;
+       int b_type;
        union {
                char *b_buf;                    /* buffer space */
                ufs1_daddr_t *b_indir1;         /* UFS1 indirect block */
@@ -165,6 +166,36 @@ struct bufarea {
  * Buffer flags
  */
 #define        B_INUSE         0x00000001      /* Buffer is in use */
+/*
+ * Type of data in buffer
+ */
+#define        BT_UNKNOWN       0      /* Buffer holds a superblock */
+#define        BT_SUPERBLK      1      /* Buffer holds a superblock */
+#define        BT_CYLGRP        2      /* Buffer holds a cylinder group map */
+#define        BT_LEVEL1        3      /* Buffer holds single level indirect */
+#define        BT_LEVEL2        4      /* Buffer holds double level indirect */
+#define        BT_LEVEL3        5      /* Buffer holds triple level indirect */
+#define        BT_EXTATTR       6      /* Buffer holds external attribute data 
*/
+#define        BT_INODES        7      /* Buffer holds external attribute data 
*/
+#define        BT_DIRDATA       8      /* Buffer holds directory data */
+#define        BT_DATA          9      /* Buffer holds user data */
+#define BT_NUMBUFTYPES 10
+#define BT_NAMES {                     \
+       "unknown",                      \
+       "Superblock",                   \
+       "Cylinder Group",               \
+       "Single Level Indirect",        \
+       "Double Level Indirect",        \
+       "Triple Level Indirect",        \
+       "External Attribute",           \
+       "Inode Block",                  \
+       "Directory Contents",           \
+       "User Data" }
+long readcnt[BT_NUMBUFTYPES];
+long totalreadcnt[BT_NUMBUFTYPES];
+struct timespec readtime[BT_NUMBUFTYPES];
+struct timespec totalreadtime[BT_NUMBUFTYPES];
+struct timespec startprog;
 
 struct bufarea sblk;           /* file system superblock */
 struct bufarea cgblk;          /* cylinder group blocks */
@@ -177,10 +208,11 @@ struct bufarea *pbp;              /* current inode b
        else \
                (bp)->b_dirty = 1; \
 } while (0)
-#define        initbarea(bp) do { \
+#define        initbarea(bp, type) do { \
        (bp)->b_dirty = 0; \
        (bp)->b_bno = (ufs2_daddr_t)-1; \
        (bp)->b_flags = 0; \
+       (bp)->b_type = type; \
 } while (0)
 
 #define        sbdirty()       dirty(&sblk)
@@ -357,6 +389,7 @@ int         dirscan(struct inodesc *);
 int            dofix(struct inodesc *, const char *msg);
 int            eascan(struct inodesc *, struct ufs2_dinode *dp);
 void           fileerror(ino_t cwd, ino_t ino, const char *errmesg);
+void           finalIOstats(void);
 int            findino(struct inodesc *);
 int            findname(struct inodesc *);
 void           flush(int fd, struct bufarea *bp);
@@ -365,7 +398,7 @@ void                freeino(ino_t ino);
 void           freeinodebuf(void);
 int            ftypeok(union dinode *dp);
 void           getblk(struct bufarea *bp, ufs2_daddr_t blk, long size);
-struct bufarea *getdatablk(ufs2_daddr_t blkno, long size);
+struct bufarea *getdatablk(ufs2_daddr_t blkno, long size, int type);
 struct inoinfo *getinoinfo(ino_t inumber);
 union dinode   *getnextinode(ino_t inumber, int rebuildcg);
 void           getpathname(char *namebuf, ino_t curdir, ino_t ino);
@@ -375,6 +408,7 @@ void                alarmhandler(int sig);
 void           inocleanup(void);
 void           inodirty(void);
 struct inostat *inoinfo(ino_t inum);
+void           IOstats(char *what);
 int            linkup(ino_t orphan, ino_t parentdir, char *name);
 int            makeentry(ino_t parent, ino_t ino, const char *name);
 void           panic(const char *fmt, ...) __printflike(1, 2);

Modified: head/sbin/fsck_ffs/fsutil.c
==============================================================================
--- head/sbin/fsck_ffs/fsutil.c Sun Feb 24 05:48:59 2013        (r247211)
+++ head/sbin/fsck_ffs/fsutil.c Sun Feb 24 06:44:29 2013        (r247212)
@@ -56,19 +56,23 @@ __FBSDID("$FreeBSD$");
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <time.h>
 #include <unistd.h>
 
 #include "fsck.h"
 
 static void slowio_start(void);
 static void slowio_end(void);
+static void printIOstats(void);
 
-long   diskreads, totalreads;  /* Disk cache statistics */
+static long diskreads, totaldiskreads, totalreads; /* Disk cache statistics */
+static struct timespec startpass, finishpass;
 struct timeval slowio_starttime;
 int slowio_delay_usec = 10000; /* Initial IO delay for background fsck */
 int slowio_pollcnt;
 static TAILQ_HEAD(buflist, bufarea) bufhead;   /* head of buffer cache list */
 static int numbufs;                            /* size of buffer cache */
+static char *buftype[BT_NUMBUFTYPES] = BT_NAMES;
 
 int
 ftypeok(union dinode *dp)
@@ -163,7 +167,7 @@ bufinit(void)
        if (bufp == 0)
                errx(EEXIT, "cannot allocate buffer pool");
        cgblk.b_un.b_buf = bufp;
-       initbarea(&cgblk);
+       initbarea(&cgblk, BT_CYLGRP);
        TAILQ_INIT(&bufhead);
        bufcnt = MAXBUFS;
        if (bufcnt < MINBUFS)
@@ -178,16 +182,21 @@ bufinit(void)
                }
                bp->b_un.b_buf = bufp;
                TAILQ_INSERT_HEAD(&bufhead, bp, b_list);
-               initbarea(bp);
+               initbarea(bp, BT_UNKNOWN);
        }
        numbufs = i;    /* save number of buffers */
+       for (i = 0; i < BT_NUMBUFTYPES; i++) {
+               readtime[i].tv_sec = totalreadtime[i].tv_sec = 0;
+               readtime[i].tv_nsec = totalreadtime[i].tv_nsec = 0;
+               readcnt[i] = totalreadcnt[i] = 0;
+       }
 }
 
 /*
  * Manage a cache of directory blocks.
  */
 struct bufarea *
-getdatablk(ufs2_daddr_t blkno, long size)
+getdatablk(ufs2_daddr_t blkno, long size, int type)
 {
        struct bufarea *bp;
 
@@ -199,26 +208,62 @@ getdatablk(ufs2_daddr_t blkno, long size
                        break;
        if (bp == NULL)
                errx(EEXIT, "deadlocked buffer pool");
+       bp->b_type = type;
        getblk(bp, blkno, size);
        /* fall through */
 foundit:
+       if (debug && bp->b_type != type)
+               printf("Buffer type changed from %s to %s\n",
+                   buftype[bp->b_type], buftype[type]);
        TAILQ_REMOVE(&bufhead, bp, b_list);
        TAILQ_INSERT_HEAD(&bufhead, bp, b_list);
        bp->b_flags |= B_INUSE;
        return (bp);
 }
 
+/*
+ * Timespec operations (from <sys/time.h>).
+ */
+#define        timespecsub(vvp, uvp)                                           
\
+       do {                                                            \
+               (vvp)->tv_sec -= (uvp)->tv_sec;                         \
+               (vvp)->tv_nsec -= (uvp)->tv_nsec;                       \
+               if ((vvp)->tv_nsec < 0) {                               \
+                       (vvp)->tv_sec--;                                \
+                       (vvp)->tv_nsec += 1000000000;                   \
+               }                                                       \
+       } while (0)
+#define        timespecadd(vvp, uvp)                                           
\
+       do {                                                            \
+               (vvp)->tv_sec += (uvp)->tv_sec;                         \
+               (vvp)->tv_nsec += (uvp)->tv_nsec;                       \
+               if ((vvp)->tv_nsec >= 1000000000) {                     \
+                       (vvp)->tv_sec++;                                \
+                       (vvp)->tv_nsec -= 1000000000;                   \
+               }                                                       \
+       } while (0)
+
 void
 getblk(struct bufarea *bp, ufs2_daddr_t blk, long size)
 {
        ufs2_daddr_t dblk;
+       struct timespec start, finish;
 
-       totalreads++;
        dblk = fsbtodb(&sblock, blk);
-       if (bp->b_bno != dblk) {
+       if (bp->b_bno == dblk) {
+               totalreads++;
+       } else {
                flush(fswritefd, bp);
-               diskreads++;
+               if (debug) {
+                       readcnt[bp->b_type]++;
+                       clock_gettime(CLOCK_REALTIME_PRECISE, &start);
+               }
                bp->b_errs = blread(fsreadfd, bp->b_un.b_buf, dblk, size);
+               if (debug) {
+                       clock_gettime(CLOCK_REALTIME_PRECISE, &finish);
+                       timespecsub(&finish, &start);
+                       timespecadd(&readtime[bp->b_type], &finish);
+               }
                bp->b_bno = dblk;
                bp->b_size = size;
        }
@@ -292,8 +337,8 @@ ckfini(int markclean)
        }
        if (debug && totalreads > 0)
                printf("cache with %d buffers missed %ld of %ld (%d%%)\n",
-                   numbufs, diskreads, totalreads,
-                   (int)(diskreads * 100 / totalreads));
+                   numbufs, totaldiskreads, totalreads,
+                   (int)(totaldiskreads * 100 / totalreads));
        if (fswritefd < 0) {
                (void)close(fsreadfd);
                return;
@@ -347,6 +392,82 @@ ckfini(int markclean)
        (void)close(fswritefd);
 }
 
+/*
+ * Print out I/O statistics.
+ */
+void
+IOstats(char *what)
+{
+       int i;
+
+       if (debug == 0)
+               return;
+       if (diskreads == 0) {
+               printf("%s: no I/O\n\n", what);
+               return;
+       }
+       if (startpass.tv_sec == 0)
+               startpass = startprog;
+       printf("%s: I/O statistics\n", what);
+       printIOstats();
+       totaldiskreads += diskreads;
+       diskreads = 0;
+       for (i = 0; i < BT_NUMBUFTYPES; i++) {
+               timespecadd(&totalreadtime[i], &readtime[i]);
+               totalreadcnt[i] += readcnt[i];
+               readtime[i].tv_sec = readtime[i].tv_nsec = 0;
+               readcnt[i] = 0;
+       }
+       clock_gettime(CLOCK_REALTIME_PRECISE, &startpass);
+}
+
+void
+finalIOstats(void)
+{
+       int i;
+
+       if (debug == 0)
+               return;
+       printf("Final I/O statistics\n");
+       totaldiskreads += diskreads;
+       diskreads = totaldiskreads;
+       startpass = startprog;
+       for (i = 0; i < BT_NUMBUFTYPES; i++) {
+               timespecadd(&totalreadtime[i], &readtime[i]);
+               totalreadcnt[i] += readcnt[i];
+               readtime[i] = totalreadtime[i];
+               readcnt[i] = totalreadcnt[i];
+       }
+       printIOstats();
+}
+
+static void printIOstats(void)
+{
+       long long msec, totalmsec;
+       int i;
+
+       clock_gettime(CLOCK_REALTIME_PRECISE, &finishpass);
+       timespecsub(&finishpass, &startpass);
+       printf("Running time: %ld msec\n",
+               finishpass.tv_sec * 1000 + finishpass.tv_nsec / 1000000);
+       printf("buffer reads by type:\n");
+       for (totalmsec = 0, i = 0; i < BT_NUMBUFTYPES; i++)
+               totalmsec += readtime[i].tv_sec * 1000 +
+                   readtime[i].tv_nsec / 1000000;
+       if (totalmsec == 0)
+               totalmsec = 1;
+       for (i = 0; i < BT_NUMBUFTYPES; i++) {
+               if (readcnt[i] == 0)
+                       continue;
+               msec = readtime[i].tv_sec * 1000 + readtime[i].tv_nsec / 
1000000;
+               printf("%21s:%8ld %2ld.%ld%% %8lld msec %2lld.%lld%%\n",
+                   buftype[i], readcnt[i], readcnt[i] * 100 / diskreads,
+                   (readcnt[i] * 1000 / diskreads) % 10, msec,
+                   msec * 100 / totalmsec, (msec * 1000 / totalmsec) % 10);
+       }
+       printf("\n");
+}
+
 int
 blread(int fd, char *buf, ufs2_daddr_t blk, long size)
 {
@@ -358,6 +479,8 @@ blread(int fd, char *buf, ufs2_daddr_t b
        offset *= dev_bsize;
        if (bkgrdflag)
                slowio_start();
+       totalreads++;
+       diskreads++;
        if (lseek(fd, offset, 0) < 0)
                rwerror("SEEK BLK", blk);
        else if (read(fd, buf, (int)size) == size) {

Modified: head/sbin/fsck_ffs/inode.c
==============================================================================
--- head/sbin/fsck_ffs/inode.c  Sun Feb 24 05:48:59 2013        (r247211)
+++ head/sbin/fsck_ffs/inode.c  Sun Feb 24 06:44:29 2013        (r247212)
@@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$");
 
 static ino_t startinum;
 
-static int iblock(struct inodesc *, long ilevel, off_t isize);
+static int iblock(struct inodesc *, long ilevel, off_t isize, int type);
 
 int
 ckinode(union dinode *dp, struct inodesc *idesc)
@@ -121,7 +121,7 @@ ckinode(union dinode *dp, struct inodesc
                sizepb *= NINDIR(&sblock);
                if (DIP(&dino, di_ib[i])) {
                        idesc->id_blkno = DIP(&dino, di_ib[i]);
-                       ret = iblock(idesc, i + 1, remsize);
+                       ret = iblock(idesc, i + 1, remsize, BT_LEVEL1 + i);
                        if (ret & STOP)
                                return (ret);
                } else {
@@ -151,7 +151,7 @@ ckinode(union dinode *dp, struct inodesc
 }
 
 static int
-iblock(struct inodesc *idesc, long ilevel, off_t isize)
+iblock(struct inodesc *idesc, long ilevel, off_t isize, int type)
 {
        struct bufarea *bp;
        int i, n, (*func)(struct inodesc *), nif;
@@ -168,7 +168,7 @@ iblock(struct inodesc *idesc, long ileve
                func = dirscan;
        if (chkrange(idesc->id_blkno, idesc->id_numfrags))
                return (SKIP);
-       bp = getdatablk(idesc->id_blkno, sblock.fs_bsize);
+       bp = getdatablk(idesc->id_blkno, sblock.fs_bsize, type);
        ilevel--;
        for (sizepb = sblock.fs_bsize, i = 0; i < ilevel; i++)
                sizepb *= NINDIR(&sblock);
@@ -199,7 +199,7 @@ iblock(struct inodesc *idesc, long ileve
                        if (ilevel == 0)
                                n = (*func)(idesc);
                        else
-                               n = iblock(idesc, ilevel, isize);
+                               n = iblock(idesc, ilevel, isize, type);
                        if (n & STOP) {
                                bp->b_flags &= ~B_INUSE;
                                return (n);
@@ -292,7 +292,7 @@ ginode(ino_t inumber)
                iblk = ino_to_fsba(&sblock, inumber);
                if (pbp != 0)
                        pbp->b_flags &= ~B_INUSE;
-               pbp = getdatablk(iblk, sblock.fs_bsize);
+               pbp = getdatablk(iblk, sblock.fs_bsize, BT_INODES);
                startinum = (inumber / INOPB(&sblock)) * INOPB(&sblock);
        }
        if (sblock.fs_magic == FS_UFS1_MAGIC)
@@ -306,8 +306,8 @@ ginode(ino_t inumber)
  * over all the inodes in numerical order.
  */
 static ino_t nextino, lastinum, lastvalidinum;
-static long readcnt, readpercg, fullcnt, inobufsize, partialcnt, partialsize;
-static caddr_t inodebuf;
+static long readcount, readpercg, fullcnt, inobufsize, partialcnt, partialsize;
+static struct bufarea inobuf;
 
 union dinode *
 getnextinode(ino_t inumber, int rebuildcg)
@@ -315,7 +315,7 @@ getnextinode(ino_t inumber, int rebuildc
        int j;
        long size;
        mode_t mode;
-       ufs2_daddr_t ndb, dblk;
+       ufs2_daddr_t ndb, blk;
        union dinode *dp;
        static caddr_t nextinop;
 
@@ -323,9 +323,9 @@ getnextinode(ino_t inumber, int rebuildc
                errx(EEXIT, "bad inode number %ju to nextinode",
                    (uintmax_t)inumber);
        if (inumber >= lastinum) {
-               readcnt++;
-               dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum));
-               if (readcnt % readpercg == 0) {
+               readcount++;
+               blk = ino_to_fsba(&sblock, lastinum);
+               if (readcount % readpercg == 0) {
                        size = partialsize;
                        lastinum += partialcnt;
                } else {
@@ -333,14 +333,14 @@ getnextinode(ino_t inumber, int rebuildc
                        lastinum += fullcnt;
                }
                /*
-                * If blread returns an error, it will already have zeroed
+                * If getblk encounters an error, it will already have zeroed
                 * out the buffer, so we do not need to do so here.
                 */
-               (void)blread(fsreadfd, inodebuf, dblk, size);
-               nextinop = inodebuf;
+               getblk(&inobuf, blk, size);
+               nextinop = inobuf.b_un.b_buf;
        }
        dp = (union dinode *)nextinop;
-       if (rebuildcg && nextinop == inodebuf) {
+       if (rebuildcg && nextinop == inobuf.b_un.b_buf) {
                /*
                 * Try to determine if we have reached the end of the
                 * allocated inodes.
@@ -406,8 +406,8 @@ setinodebuf(ino_t inum)
        startinum = 0;
        nextino = inum;
        lastinum = inum;
-       readcnt = 0;
-       if (inodebuf != NULL)
+       readcount = 0;
+       if (inobuf.b_un.b_buf != NULL)
                return;
        inobufsize = blkroundup(&sblock, INOBUFSIZE);
        fullcnt = inobufsize / ((sblock.fs_magic == FS_UFS1_MAGIC) ?
@@ -422,7 +422,8 @@ setinodebuf(ino_t inum)
                partialcnt = fullcnt;
                partialsize = inobufsize;
        }
-       if ((inodebuf = malloc((unsigned)inobufsize)) == NULL)
+       initbarea(&inobuf, BT_INODES);
+       if ((inobuf.b_un.b_buf = malloc((unsigned)inobufsize)) == NULL)
                errx(EEXIT, "cannot allocate space for inode buffer");
 }
 
@@ -430,9 +431,9 @@ void
 freeinodebuf(void)
 {
 
-       if (inodebuf != NULL)
-               free((char *)inodebuf);
-       inodebuf = NULL;
+       if (inobuf.b_un.b_buf != NULL)
+               free((char *)inobuf.b_un.b_buf);
+       inobuf.b_un.b_buf = NULL;
 }
 
 /*

Modified: head/sbin/fsck_ffs/main.c
==============================================================================
--- head/sbin/fsck_ffs/main.c   Sun Feb 24 05:48:59 2013        (r247211)
+++ head/sbin/fsck_ffs/main.c   Sun Feb 24 06:44:29 2013        (r247212)
@@ -424,7 +424,9 @@ checkfilesys(char *filesys)
                        printf("** Root file system\n");
                printf("** Phase 1 - Check Blocks and Sizes\n");
        }
+       clock_gettime(CLOCK_REALTIME_PRECISE, &startprog);
        pass1();
+       IOstats("Pass1");
 
        /*
         * 1b: locate first references to duplicates, if any
@@ -437,6 +439,7 @@ checkfilesys(char *filesys)
                            usedsoftdep ? "softupdates" : "");
                printf("** Phase 1b - Rescan For More DUPS\n");
                pass1b();
+               IOstats("Pass1b");
        }
 
        /*
@@ -445,6 +448,7 @@ checkfilesys(char *filesys)
        if (preen == 0)
                printf("** Phase 2 - Check Pathnames\n");
        pass2();
+       IOstats("Pass2");
 
        /*
         * 3: scan inodes looking for disconnected directories
@@ -452,6 +456,7 @@ checkfilesys(char *filesys)
        if (preen == 0)
                printf("** Phase 3 - Check Connectivity\n");
        pass3();
+       IOstats("Pass3");
 
        /*
         * 4: scan inodes looking for disconnected files; check reference counts
@@ -459,6 +464,7 @@ checkfilesys(char *filesys)
        if (preen == 0)
                printf("** Phase 4 - Check Reference Counts\n");
        pass4();
+       IOstats("Pass4");
 
        /*
         * 5: check and repair resource counts in cylinder groups
@@ -466,6 +472,7 @@ checkfilesys(char *filesys)
        if (preen == 0)
                printf("** Phase 5 - Check Cyl groups\n");
        pass5();
+       IOstats("Pass5");
 
        /*
         * print out summary statistics
@@ -519,6 +526,7 @@ checkfilesys(char *filesys)
        }
        if (rerun)
                resolved = 0;
+       finalIOstats();
 
        /*
         * Check to see if the file system is mounted read-write.

Modified: head/sbin/fsck_ffs/setup.c
==============================================================================
--- head/sbin/fsck_ffs/setup.c  Sun Feb 24 05:48:59 2013        (r247211)
+++ head/sbin/fsck_ffs/setup.c  Sun Feb 24 06:44:29 2013        (r247212)
@@ -249,6 +249,7 @@ setup(char *dev)
        for (i = 0, j = 0; i < sblock.fs_cssize; i += sblock.fs_bsize, j++) {
                size = sblock.fs_cssize - i < sblock.fs_bsize ?
                    sblock.fs_cssize - i : sblock.fs_bsize;
+               readcnt[sblk.b_type]++;
                if (blread(fsreadfd, (char *)sblock.fs_csp + i,
                    fsbtodb(&sblock, sblock.fs_csaddr + j * sblock.fs_frag),
                    size) != 0 && !asked) {
@@ -322,6 +323,7 @@ readsb(int listerr)
 
        if (bflag) {
                super = bflag;
+               readcnt[sblk.b_type]++;
                if ((blread(fsreadfd, (char *)&sblock, super, 
(long)SBLOCKSIZE)))
                        return (0);
                if (sblock.fs_magic == FS_BAD_MAGIC) {
@@ -337,6 +339,7 @@ readsb(int listerr)
        } else {
                for (i = 0; sblock_try[i] != -1; i++) {
                        super = sblock_try[i] / dev_bsize;
+                       readcnt[sblk.b_type]++;
                        if ((blread(fsreadfd, (char *)&sblock, super,
                            (long)SBLOCKSIZE)))
                                return (0);
@@ -439,8 +442,8 @@ sblock_init(void)
        fswritefd = -1;
        fsmodified = 0;
        lfdir = 0;
-       initbarea(&sblk);
-       initbarea(&asblk);
+       initbarea(&sblk, BT_SUPERBLK);
+       initbarea(&asblk, BT_SUPERBLK);
        sblk.b_un.b_buf = malloc(SBLOCKSIZE);
        asblk.b_un.b_buf = malloc(SBLOCKSIZE);
        if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to