vnode_pager.c (7e2393ff5104607e4d0262e2a9e32c1e10c3f9bd) vnode_pager.c (222d01951f8677015e3e96c6950e809c0d983c09)
1/*-
2 * Copyright (c) 1990 University of Utah.
3 * Copyright (c) 1991 The Regents of the University of California.
4 * All rights reserved.
5 * Copyright (c) 1993, 1994 John S. Dyson
6 * Copyright (c) 1995, David Greenman
7 *
8 * This code is derived from software contributed to Berkeley by

--- 714 unchanged lines hidden (view full) ---

723 error = VOP_BMAP(vp, foff / bsize, &bo, &reqblock, NULL, NULL);
724 if (error == EOPNOTSUPP) {
725 VM_OBJECT_LOCK(object);
726 vm_page_lock_queues();
727 for (i = 0; i < count; i++)
728 if (i != reqpage)
729 vm_page_free(m[i]);
730 vm_page_unlock_queues();
1/*-
2 * Copyright (c) 1990 University of Utah.
3 * Copyright (c) 1991 The Regents of the University of California.
4 * All rights reserved.
5 * Copyright (c) 1993, 1994 John S. Dyson
6 * Copyright (c) 1995, David Greenman
7 *
8 * This code is derived from software contributed to Berkeley by

--- 714 unchanged lines hidden (view full) ---

723 error = VOP_BMAP(vp, foff / bsize, &bo, &reqblock, NULL, NULL);
724 if (error == EOPNOTSUPP) {
725 VM_OBJECT_LOCK(object);
726 vm_page_lock_queues();
727 for (i = 0; i < count; i++)
728 if (i != reqpage)
729 vm_page_free(m[i]);
730 vm_page_unlock_queues();
731 cnt.v_vnodein++;
732 cnt.v_vnodepgsin++;
731 VMCNT_ADD(vnodein, 1);
732 VMCNT_ADD(vnodepgsin, 1);
733 error = vnode_pager_input_old(object, m[reqpage]);
734 VM_OBJECT_UNLOCK(object);
735 return (error);
736 } else if (error != 0) {
737 VM_OBJECT_LOCK(object);
738 vm_page_lock_queues();
739 for (i = 0; i < count; i++)
740 if (i != reqpage)

--- 11 unchanged lines hidden (view full) ---

752 (vp->v_mount->mnt_stat.f_type != nfs_mount_type)) {
753 VM_OBJECT_LOCK(object);
754 vm_page_lock_queues();
755 for (i = 0; i < count; i++)
756 if (i != reqpage)
757 vm_page_free(m[i]);
758 vm_page_unlock_queues();
759 VM_OBJECT_UNLOCK(object);
733 error = vnode_pager_input_old(object, m[reqpage]);
734 VM_OBJECT_UNLOCK(object);
735 return (error);
736 } else if (error != 0) {
737 VM_OBJECT_LOCK(object);
738 vm_page_lock_queues();
739 for (i = 0; i < count; i++)
740 if (i != reqpage)

--- 11 unchanged lines hidden (view full) ---

752 (vp->v_mount->mnt_stat.f_type != nfs_mount_type)) {
753 VM_OBJECT_LOCK(object);
754 vm_page_lock_queues();
755 for (i = 0; i < count; i++)
756 if (i != reqpage)
757 vm_page_free(m[i]);
758 vm_page_unlock_queues();
759 VM_OBJECT_UNLOCK(object);
760 cnt.v_vnodein++;
761 cnt.v_vnodepgsin++;
760 VMCNT_ADD(vnodein, 1);
761 VMCNT_ADD(vnodepgsin, 1);
762 return vnode_pager_input_smlfs(object, m[reqpage]);
763 }
764
765 /*
766 * If we have a completely valid page available to us, we can
767 * clean up and return. Otherwise we have to re-read the
768 * media.
769 */

--- 134 unchanged lines hidden (view full) ---

904 bp->b_wcred = crhold(curthread->td_ucred);
905 bp->b_blkno = firstaddr;
906 pbgetbo(bo, bp);
907 bp->b_bcount = size;
908 bp->b_bufsize = size;
909 bp->b_runningbufspace = bp->b_bufsize;
910 atomic_add_int(&runningbufspace, bp->b_runningbufspace);
911
762 return vnode_pager_input_smlfs(object, m[reqpage]);
763 }
764
765 /*
766 * If we have a completely valid page available to us, we can
767 * clean up and return. Otherwise we have to re-read the
768 * media.
769 */

--- 134 unchanged lines hidden (view full) ---

904 bp->b_wcred = crhold(curthread->td_ucred);
905 bp->b_blkno = firstaddr;
906 pbgetbo(bo, bp);
907 bp->b_bcount = size;
908 bp->b_bufsize = size;
909 bp->b_runningbufspace = bp->b_bufsize;
910 atomic_add_int(&runningbufspace, bp->b_runningbufspace);
911
912 cnt.v_vnodein++;
913 cnt.v_vnodepgsin += count;
912 VMCNT_ADD(vnodein, 1);
913 VMCNT_ADD(vnodepgsin, 1);
914
915 /* do the input */
916 bp->b_iooffset = dbtob(bp->b_blkno);
917 bstrategy(bp);
918
919 bwait(bp, PVM, "vnread");
920
921 if ((bp->b_ioflags & BIO_ERROR) != 0)

--- 104 unchanged lines hidden (view full) ---

1026 * operation ). The swapper handles the case by limiting the amount
1027 * of asynchronous I/O, but that sort of solution doesn't scale well
1028 * for the vnode pager without a lot of work.
1029 *
1030 * Also, the backing vnode's iodone routine may not wake the pageout
1031 * daemon up. This should be probably be addressed XXX.
1032 */
1033
914
915 /* do the input */
916 bp->b_iooffset = dbtob(bp->b_blkno);
917 bstrategy(bp);
918
919 bwait(bp, PVM, "vnread");
920
921 if ((bp->b_ioflags & BIO_ERROR) != 0)

--- 104 unchanged lines hidden (view full) ---

1026 * operation ). The swapper handles the case by limiting the amount
1027 * of asynchronous I/O, but that sort of solution doesn't scale well
1028 * for the vnode pager without a lot of work.
1029 *
1030 * Also, the backing vnode's iodone routine may not wake the pageout
1031 * daemon up. This should be probably be addressed XXX.
1032 */
1033
1034 if ((cnt.v_free_count + cnt.v_cache_count) < cnt.v_pageout_free_min)
1034 if ((VMCNT_GET(free_count) + VMCNT_GET(cache_count)) <
1035 VMCNT_GET(pageout_free_min))
1035 sync |= OBJPC_SYNC;
1036
1037 /*
1038 * Call device-specific putpages function
1039 */
1040 vp = object->handle;
1041 VM_OBJECT_UNLOCK(object);
1042 if (vp->v_type != VREG)

--- 109 unchanged lines hidden (view full) ---

1152 auio.uio_iov = &aiov;
1153 auio.uio_iovcnt = 1;
1154 auio.uio_offset = poffset;
1155 auio.uio_segflg = UIO_NOCOPY;
1156 auio.uio_rw = UIO_WRITE;
1157 auio.uio_resid = maxsize;
1158 auio.uio_td = (struct thread *) 0;
1159 error = VOP_WRITE(vp, &auio, ioflags, curthread->td_ucred);
1036 sync |= OBJPC_SYNC;
1037
1038 /*
1039 * Call device-specific putpages function
1040 */
1041 vp = object->handle;
1042 VM_OBJECT_UNLOCK(object);
1043 if (vp->v_type != VREG)

--- 109 unchanged lines hidden (view full) ---

1153 auio.uio_iov = &aiov;
1154 auio.uio_iovcnt = 1;
1155 auio.uio_offset = poffset;
1156 auio.uio_segflg = UIO_NOCOPY;
1157 auio.uio_rw = UIO_WRITE;
1158 auio.uio_resid = maxsize;
1159 auio.uio_td = (struct thread *) 0;
1160 error = VOP_WRITE(vp, &auio, ioflags, curthread->td_ucred);
1160 cnt.v_vnodeout++;
1161 cnt.v_vnodepgsout += ncount;
1161 VMCNT_ADD(vnodein, 1);
1162 VMCNT_ADD(vnodepgsin, ncount);
1162
1163 if (error) {
1164 if ((ppscheck = ppsratecheck(&lastfail, &curfail, 1)))
1165 printf("vnode_pager_putpages: I/O error %d\n", error);
1166 }
1167 if (auio.uio_resid) {
1168 if (ppscheck || ppsratecheck(&lastfail, &curfail, 1))
1169 printf("vnode_pager_putpages: residual I/O %d at %lu\n",

--- 53 unchanged lines hidden ---
1163
1164 if (error) {
1165 if ((ppscheck = ppsratecheck(&lastfail, &curfail, 1)))
1166 printf("vnode_pager_putpages: I/O error %d\n", error);
1167 }
1168 if (auio.uio_resid) {
1169 if (ppscheck || ppsratecheck(&lastfail, &curfail, 1))
1170 printf("vnode_pager_putpages: residual I/O %d at %lu\n",

--- 53 unchanged lines hidden ---