Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/librump/rumpvfs If RUMP_BLKSECTSHIFT is set in the ...



details:   https://anonhg.NetBSD.org/src/rev/02e2d6307160
branches:  trunk
changeset: 751307:02e2d6307160
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sun Jan 31 13:15:08 2010 +0000

description:
If RUMP_BLKSECTSHIFT is set in the environment, use that as
device sector size instead of DEV_BSHIFT.

diffstat:

 sys/rump/librump/rumpvfs/rumpblk.c |  31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diffs (87 lines):

diff -r f994207da2fc -r 02e2d6307160 sys/rump/librump/rumpvfs/rumpblk.c
--- a/sys/rump/librump/rumpvfs/rumpblk.c        Sun Jan 31 12:20:22 2010 +0000
+++ b/sys/rump/librump/rumpvfs/rumpblk.c        Sun Jan 31 13:15:08 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpblk.c,v 1.36 2010/01/27 22:03:11 pooka Exp $       */
+/*     $NetBSD: rumpblk.c,v 1.37 2010/01/31 13:15:08 pooka Exp $       */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpblk.c,v 1.36 2010/01/27 22:03:11 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpblk.c,v 1.37 2010/01/31 13:15:08 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -156,6 +156,7 @@
 static int blkfail;
 static unsigned randstate;
 static kmutex_t rumpblk_lock;
+static int sectshift = DEV_BSHIFT;
 
 static void
 makedefaultlabel(struct disklabel *lp, off_t size, int part)
@@ -165,8 +166,8 @@
        memset(lp, 0, sizeof(*lp));
 
        lp->d_secperunit = size;
-       lp->d_secsize = DEV_BSIZE;
-       lp->d_nsectors = size >> DEV_BSHIFT;
+       lp->d_secsize = 1 << sectshift;
+       lp->d_nsectors = size >> sectshift;
        lp->d_ntracks = 1;
        lp->d_ncylinders = 1;
        lp->d_secpercyl = lp->d_nsectors;
@@ -184,7 +185,7 @@
        for (i = 0; i < part; i++) {
                lp->d_partitions[i].p_fstype = FS_UNUSED;
        }
-       lp->d_partitions[part].p_size = size >> DEV_BSHIFT;
+       lp->d_partitions[part].p_size = size >> sectshift;
        lp->d_npartitions = part+1;
        /* XXX: file system type? */
 
@@ -337,6 +338,17 @@
                        printf("invalid RUMP_BLKWINCOUNT %d, ", tmp);
                printf("using %d for memwincount\n", memwincnt);
        }
+       if (rumpuser_getenv("RUMP_BLKSECTSHIFT", buf, sizeof(buf), &error)==0){
+               printf("rumpblk: ");
+               tmp = strtoul(buf, NULL, 10);
+               if (tmp >= DEV_BSHIFT)
+                       sectshift = tmp;
+               else
+                       printf("RUMP_BLKSECTSHIFT must be least %d (now %d), ",
+                          DEV_BSHIFT, tmp); 
+               printf("using %d for sector shift (size %d)\n",
+                   sectshift, 1<<sectshift);
+       }
 
        memset(minors, 0, sizeof(minors));
        for (i = 0; i < RUMPBLK_SIZE; i++) {
@@ -594,7 +606,7 @@
                ev_bread_total.ev_count++;
        }
 
-       off = bp->b_blkno << DEV_BSHIFT;
+       off = bp->b_blkno << sectshift;
        /*
         * Do bounds checking if we're working on a file.  Otherwise
         * invalid file systems might attempt to read beyond EOF.  This
@@ -688,9 +700,10 @@
                        if (!async) {
                                /* O_DIRECT not fully automatic yet */
 #ifdef HAS_ODIRECT
-                               if ((off & (DEV_BSIZE-1)) == 0
-                                   && ((intptr_t)bp->b_data&(DEV_BSIZE-1)) == 0
-                                   && (bp->b_bcount & (DEV_BSIZE-1)) == 0)
+                               if ((off & ((1<<sectshift)-1)) == 0
+                                   && ((intptr_t)bp->b_data
+                                     & ((1<<sectshift)-1)) == 0
+                                   && (bp->b_bcount & ((1<<sectshift)-1)) == 0)
                                        fd = rblk->rblk_dfd;
                                else
 #endif



Home | Main Index | Thread Index | Old Index