Module Name: src Committed By: pooka Date: Sun Jan 31 13:15:09 UTC 2010
Modified Files: src/sys/rump/librump/rumpvfs: rumpblk.c Log Message: If RUMP_BLKSECTSHIFT is set in the environment, use that as device sector size instead of DEV_BSHIFT. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/rump/librump/rumpvfs/rumpblk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/rump/librump/rumpvfs/rumpblk.c diff -u src/sys/rump/librump/rumpvfs/rumpblk.c:1.36 src/sys/rump/librump/rumpvfs/rumpblk.c:1.37 --- src/sys/rump/librump/rumpvfs/rumpblk.c:1.36 Wed Jan 27 22:03:11 2010 +++ src/sys/rump/librump/rumpvfs/rumpblk.c Sun Jan 31 13:15:08 2010 @@ -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