From b52c81e5db821f2344b775a5b98a58a7797433e4 Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 4 Jul 2004 12:49:04 +0000 Subject: Blocksize for I/O should be a property of the vnode and not found by groping around in the vnodes surroundings when we allocate a block. Assign a blocksize when we create a vnode, and yell a warning (and ignore it) if we got the wrong size. Please email all such warnings to me. --- sys/kern/vfs_bio.c | 5 +++++ sys/kern/vfs_subr.c | 1 + sys/sys/vnode.h | 1 + 3 files changed, 7 insertions(+) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 9b44e9b..b6c1caa 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -2570,6 +2570,11 @@ loop: else bsize = size; + if (vp->v_bsize != bsize) { + printf("WARNING: Wrong block size on vnode: %d should be %d\n", vp->v_bsize, bsize); + vprint("Please email phk@FreeBSD.org this info\n", vp); + } + offset = blkno * bsize; vmio = (VOP_GETVOBJECT(vp, NULL) == 0) && (vp->v_vflag & VV_OBJBUF); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index daef020..a1cfdaa 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -841,6 +841,7 @@ getnewvnode(tag, mp, vops, vpp) delmntque(vp); if (mp != NULL) insmntque(vp, mp); + vp->v_bsize = mp->mnt_stat.f_iosize; return (0); } diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 3fc66c4e..723e1b0 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -155,6 +155,7 @@ struct vnode { #endif dev_t v_cachedfs; /* cached fs id */ ino_t v_cachedid; /* cached file id */ + int v_bsize; /* block size for I/O */ }; #define v_mountedhere v_un.vu_mountedhere #define v_socket v_un.vu_socket -- cgit v1.1