Source-Changes-HG archive

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

[src/trunk]: src/sys Store physical block numbers in superblock that point to...



details:   https://anonhg.NetBSD.org/src/rev/4d4d6e479cf2
branches:  trunk
changeset: 752478:4d4d6e479cf2
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Feb 27 12:04:19 2010 +0000

description:
Store physical block numbers in superblock that point to the journal.
Calculate position of both commit headers correctly for disks with
large sectors.
Correct calculation of circular buffer size.

diffstat:

 sys/kern/vfs_wapbl.c    |  17 +++++++++++++----
 sys/ufs/ffs/ffs_wapbl.c |  12 ++++++++++--
 2 files changed, 23 insertions(+), 6 deletions(-)

diffs (99 lines):

diff -r a0d071b29d17 -r 4d4d6e479cf2 sys/kern/vfs_wapbl.c
--- a/sys/kern/vfs_wapbl.c      Sat Feb 27 11:17:05 2010 +0000
+++ b/sys/kern/vfs_wapbl.c      Sat Feb 27 12:04:19 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_wapbl.c,v 1.32 2010/02/26 22:24:07 mlelstv Exp $   */
+/*     $NetBSD: vfs_wapbl.c,v 1.33 2010/02/27 12:04:19 mlelstv Exp $   */
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.32 2010/02/26 22:24:07 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.33 2010/02/27 12:04:19 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/bitops.h>
@@ -344,6 +344,10 @@
        if (blksize % DEV_BSIZE)
                return EINVAL;
 
+       /* Kernel uses DEV_BSIZE units */
+       off = btodb(off << log_dev_bshift);
+       count = btodb(count << log_dev_bshift);
+
        /* XXXTODO: verify that the full load is writable */
 
        /*
@@ -379,7 +383,7 @@
 
        /* Reserve two log device blocks for the commit headers */
        wl->wl_circ_off = 2<<wl->wl_log_dev_bshift;
-       wl->wl_circ_size = ((count * blksize) - wl->wl_circ_off);
+       wl->wl_circ_size = ((count * DEV_BSIZE) - wl->wl_circ_off);
        /* truncate the log usage to a multiple of log_dev_bshift */
        wl->wl_circ_size >>= wl->wl_log_dev_bshift;
        wl->wl_circ_size <<= wl->wl_log_dev_bshift;
@@ -1855,7 +1859,8 @@
         */
 
        error = wapbl_write(wc, wc->wc_len, wl->wl_devvp,
-           wl->wl_logpbn + wc->wc_generation % 2);
+           wl->wl_logpbn +
+           ((wc->wc_generation % 2) << (wc->wc_log_dev_bshift - DEV_BSHIFT)));
        if (error)
                return error;
 
@@ -2256,6 +2261,10 @@
                return EINVAL;
 
 #ifdef _KERNEL
+       /* Kernel uses DEV_BSIZE units */
+       off = btodb(off << log_dev_bshift);
+       count = btodb(count << log_dev_bshift);
+
 #if 0
        /* XXX vp->v_size isn't reliably set for VBLK devices,
         * especially root.  However, we might still want to verify
diff -r a0d071b29d17 -r 4d4d6e479cf2 sys/ufs/ffs/ffs_wapbl.c
--- a/sys/ufs/ffs/ffs_wapbl.c   Sat Feb 27 11:17:05 2010 +0000
+++ b/sys/ufs/ffs/ffs_wapbl.c   Sat Feb 27 12:04:19 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_wapbl.c,v 1.14 2010/02/23 20:41:41 mlelstv Exp $   */
+/*     $NetBSD: ffs_wapbl.c,v 1.15 2010/02/27 12:04:19 mlelstv Exp $   */
 
 /*-
  * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.14 2010/02/23 20:41:41 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.15 2010/02/27 12:04:19 mlelstv Exp $");
 
 #define WAPBL_INTERNAL
 
@@ -553,6 +553,10 @@
                *countp = (logend - logstart);
                *extradatap = 0;
 
+               /* convert to physical block numbers */
+               *startp = dbtob(*startp) / secsize;
+               *countp = dbtob(*countp) / secsize;
+
                fs->fs_journallocs[UFS_WAPBL_EPART_ADDR] = *startp;
                fs->fs_journallocs[UFS_WAPBL_EPART_COUNT] = *countp;
                fs->fs_journallocs[UFS_WAPBL_EPART_BLKSZ] = *blksizep;
@@ -568,6 +572,10 @@
                                  startp, countp, extradatap);
                ffs_sync(mp, MNT_WAIT, FSCRED);
 
+               /* convert to physical block numbers */
+               *startp = dbtob(*startp) / secsize;
+               *countp = dbtob(*countp) / secsize;
+
                fs->fs_journallocs[UFS_WAPBL_INFS_ADDR] = *startp;
                fs->fs_journallocs[UFS_WAPBL_INFS_COUNT] = *countp;
                fs->fs_journallocs[UFS_WAPBL_INFS_BLKSZ] = *blksizep;



Home | Main Index | Thread Index | Old Index