Module Name: src Committed By: pooka Date: Thu Feb 3 10:06:07 UTC 2011
Modified Files: src/sys/rump/librump/rumpvfs: rumpblk.c Log Message: * fix blkno->offset calculation for simulated non-512 devices * allows transfers only in multiples of block size * g/c unused struct member To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 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.43 src/sys/rump/librump/rumpvfs/rumpblk.c:1.44 --- src/sys/rump/librump/rumpvfs/rumpblk.c:1.43 Wed Feb 2 15:55:22 2011 +++ src/sys/rump/librump/rumpvfs/rumpblk.c Thu Feb 3 10:06:06 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpblk.c,v 1.43 2011/02/02 15:55:22 pooka Exp $ */ +/* $NetBSD: rumpblk.c,v 1.44 2011/02/03 10:06:06 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.43 2011/02/02 15:55:22 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rumpblk.c,v 1.44 2011/02/03 10:06:06 pooka Exp $"); #include <sys/param.h> #include <sys/buf.h> @@ -99,7 +99,6 @@ static struct rblkdev { char *rblk_path; int rblk_fd; - int rblk_opencnt; #ifdef HAS_ODIRECT int rblk_dfd; #endif @@ -467,7 +466,6 @@ rblk = &minors[i]; KASSERT(rblk->rblk_fd == -1); - KASSERT(rblk->rblk_opencnt == 0); wincleanup(rblk); free(rblk->rblk_path, M_TEMP); @@ -632,6 +630,11 @@ int async = bp->b_flags & B_ASYNC; int error; + if (bp->b_bcount % (1<<sectshift) != 0) { + rump_biodone(bp, 0, EINVAL); + return; + } + /* collect statistics */ ev_io_total.ev_count++; if (async) @@ -644,7 +647,13 @@ ev_bread_total.ev_count++; } - off = bp->b_blkno << sectshift; + /* + * b_blkno is always in terms of DEV_BSIZE, and since we need + * to translate to a byte offset for the host read, this + * calculation does not need sectshift. + */ + off = bp->b_blkno << DEV_BSHIFT; + /* * Do bounds checking if we're working on a file. Otherwise * invalid file systems might attempt to read beyond EOF. This