1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00

Fixed bug where a read-behind to a negative offset would occur if the

fault was at offset 0 in the object. This resulted in more overhead but
was othewise benign. Added incore() check in vnode_pager_has_page()
to work around a problem with LFS...other than slightly higher overhead,
this change has no affect on UFS.
This commit is contained in:
David Greenman 1994-11-13 22:48:55 +00:00
parent 0dc02ef480
commit 317205ca28
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=4446
2 changed files with 25 additions and 19 deletions

View File

@ -66,7 +66,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: vm_fault.c,v 1.11 1994/10/23 06:15:03 davidg Exp $
* $Id: vm_fault.c,v 1.12 1994/11/06 09:55:29 davidg Exp $
*/
/*
@ -1246,18 +1246,22 @@ vm_fault_additional_pages(first_object, first_offset, m, rbehind, raheada, marra
* in memory or on disk not in same object
*/
toffset = offset - NBPG;
if( rbehind*NBPG > offset)
rbehind = offset / NBPG;
startoffset = offset - rbehind*NBPG;
while (toffset >= startoffset) {
if (!vm_fault_page_lookup(first_object, toffset - offsetdiff, &rtobject, &rtoffset, &rtm) ||
rtm != 0 || rtobject != object) {
startoffset = toffset + NBPG;
break;
if( toffset < offset) {
if( rbehind*NBPG > offset)
rbehind = offset / NBPG;
startoffset = offset - rbehind*NBPG;
while (toffset >= startoffset) {
if (!vm_fault_page_lookup(first_object, toffset - offsetdiff, &rtobject, &rtoffset, &rtm) ||
rtm != 0 || rtobject != object) {
startoffset = toffset + NBPG;
break;
}
if( toffset == 0)
break;
toffset -= NBPG;
}
if( toffset == 0)
break;
toffset -= NBPG;
} else {
startoffset = offset;
}
/*

View File

@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* from: @(#)vnode_pager.c 7.5 (Berkeley) 4/20/91
* $Id: vnode_pager.c,v 1.14 1994/10/15 13:33:09 davidg Exp $
* $Id: vnode_pager.c,v 1.15 1994/11/06 09:55:31 davidg Exp $
*/
/*
@ -286,23 +286,24 @@ vnode_pager_haspage(pager, offset)
register vn_pager_t vnp = (vn_pager_t) pager->pg_data;
daddr_t bn;
int err;
daddr_t block;
/*
* Offset beyond end of file, do not have the page
*/
if (offset >= vnp->vnp_size) {
if (offset >= vnp->vnp_size)
return (FALSE);
}
block = offset / vnp->vnp_vp->v_mount->mnt_stat.f_iosize;
if (incore(vnp->vnp_vp, block))
return TRUE;
/*
* Read the index to find the disk block to read from. If there is no
* block, report that we don't have this data.
*
* Assumes that the vnode has whole page or nothing.
*/
err = VOP_BMAP(vnp->vnp_vp,
offset / vnp->vnp_vp->v_mount->mnt_stat.f_iosize,
(struct vnode **) 0, &bn, 0);
err = VOP_BMAP(vnp->vnp_vp, block, (struct vnode **) 0, &bn, 0);
/*
printf("vnode_pager_haspage: (%d)0x%x: err: %d, bn: %d\n",
offset, offset, err, bn);
@ -803,7 +804,8 @@ vnode_pager_input(vnp, m, count, reqpage)
/*
* if we can't bmap, use old VOP code
*/
if (VOP_BMAP(vp, foff, &dp, 0, 0)) {
if (/* (vp->v_mount && vp->v_mount->mnt_stat.f_type == MOUNT_LFS) || */
VOP_BMAP(vp, foff, &dp, 0, 0)) {
for (i = 0; i < count; i++) {
if (i != reqpage) {
vnode_pager_freepage(m[i]);