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.
This commit is contained in:
Poul-Henning Kamp 2004-07-04 12:49:04 +00:00
parent 91a4826a49
commit 1cbb1e02c4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=131565
3 changed files with 7 additions and 0 deletions

View File

@ -2570,6 +2570,11 @@ getblk(struct vnode * vp, daddr_t blkno, int size, int slpflag, int slptimeo,
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);

View File

@ -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);
}

View File

@ -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