Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/miscfs/specfs Hang a warning banner on some nasty code I...
details: https://anonhg.NetBSD.org/src/rev/93f9d115fc9e
branches: trunk
changeset: 787416:93f9d115fc9e
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Jun 16 20:46:24 2013 +0000
description:
Hang a warning banner on some nasty code I just found.
diffstat:
sys/miscfs/specfs/spec_vnops.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diffs (47 lines):
diff -r 0631f05c1ccc -r 93f9d115fc9e sys/miscfs/specfs/spec_vnops.c
--- a/sys/miscfs/specfs/spec_vnops.c Sun Jun 16 19:05:00 2013 +0000
+++ b/sys/miscfs/specfs/spec_vnops.c Sun Jun 16 20:46:24 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spec_vnops.c,v 1.137 2013/02/13 14:03:48 hannken Exp $ */
+/* $NetBSD: spec_vnops.c,v 1.138 2013/06/16 20:46:24 dholland Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.137 2013/02/13 14:03:48 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.138 2013/06/16 20:46:24 dholland Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -683,12 +683,28 @@
if (uio->uio_offset < 0)
return (EINVAL);
bsize = BLKDEV_IOSIZE;
+
+ /*
+ * dholland 20130616: XXX this logic should not be
+ * here. It is here because the old buffer cache
+ * demands that all accesses to the same blocks need
+ * to be the same size; but it only works for FFS and
+ * nowadays I think it'll fail silently if the size
+ * info in the disklabel is wrong. (Or missing.) The
+ * buffer cache needs to be smarter; or failing that
+ * we need a reliable way here to get the right block
+ * size; or a reliable way to guarantee that (a) the
+ * fs is not mounted when we get here and (b) any
+ * buffers generated here will get purged when the fs
+ * does get mounted.
+ */
if (bdev_ioctl(vp->v_rdev, DIOCGPART, &dpart, FREAD, l) == 0) {
if (dpart.part->p_fstype == FS_BSDFFS &&
dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
bsize = dpart.part->p_frag *
dpart.part->p_fsize;
}
+
bscale = bsize >> DEV_BSHIFT;
do {
bn = (uio->uio_offset >> DEV_BSHIFT) &~ (bscale - 1);
Home |
Main Index |
Thread Index |
Old Index