From tegge@pat.idt.unit.no  Tue Aug 20 12:10:55 1996
Received: from ref.tfs.com ([206.245.251.1])
          by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id MAA26060
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 20 Aug 1996 12:10:49 -0700 (PDT)
Received: from pat.idt.unit.no (pat.idt.unit.no [129.241.103.5]) by ref.tfs.com (8.7.5/8.7.3) with ESMTP id MAA25784 for <FreeBSD-gnats-submit@freebsd.org>; Tue, 20 Aug 1996 12:10:25 -0700 (PDT)
Received: from ikke.idt.unit.no (ikke.idt.unit.no [129.241.111.65]) by pat.idt.unit.no (8.7.5/8.7.3) with ESMTP id TAA29879 for <FreeBSD-gnats-submit@freebsd.org>; Tue, 20 Aug 1996 19:57:48 +0200 (MET DST)
Received: (from tegge@localhost) by ikke.idt.unit.no (8.7.5/8.7.3) id TAA22004; Tue, 20 Aug 1996 19:57:47 +0200 (MET DST)
Message-Id: <199608201757.TAA22004@ikke.idt.unit.no>
Date: Tue, 20 Aug 1996 19:57:47 +0200 (MET DST)
From: Tor Egge <tegge@idt.ntnu.no>
Reply-To: tegge@idt.ntnu.no
To: FreeBSD-gnats-submit@freebsd.org
Subject: vm_fault.c contains dead code or too many underscores.
X-Send-Pr-Version: 3.2

>Number:         1516
>Category:       kern
>Synopsis:       vm_fault.c contains dead code or too many underscores.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    peter
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 20 12:20:01 PDT 1996
>Closed-Date:    Thu Jun 10 16:06:13 PDT 1999
>Last-Modified:  Thu Jun 10 16:07:17 PDT 1999
>Originator:     Tor Egge
>Release:        FreeBSD 2.2-CURRENT i386
>Organization:
Norwegian University of Science and Technology, Trondheim, Norway
>Environment:

FreeBSD ikke.idt.unit.no 2.2-CURRENT FreeBSD 2.2-CURRENT #5: Mon Aug 19 16:14:50 MET DST 1996     root@ikke.idt.unit.no:/usr/src/sys/compile/TEGGE  i386

>Description:

/usr/src/sys/vm/vm_fault.c contains the following code
---- 
			if ((first_object->type != OBJT_DEVICE) &&
				(first_object->behavior == OBJ_SEQUENTIAL)) {
				vm_pindex_t firstpindex, tmppindex;
				if (first_pindex <
					2*(VM_FAULT_READ_BEHIND + VM_FAULT_READ_AHEAD + 1))
					firstpindex = 0;
				else
					firstpindex = first_pindex -
						2*(VM_FAULT_READ_BEHIND + VM_FAULT_READ_AHEAD + 1);

				for(tmppindex = first_pindex - 1;
					tmppindex >= first_pindex;
					--tmppindex) {
					vm_page_t mt;
					mt = vm_page_lookup( first_object, tmppindex);
					if (mt == NULL || (mt->valid != VM_PAGE_BITS_ALL))
						break;
					if (mt->busy ||
						(mt->flags & (PG_BUSY|PG_FICTITIOUS)) ||
						mt->hold_count ||
						mt->wire_count) 
						continue;
					if (mt->dirty == 0)
						vm_page_test_dirty(mt);
					if (mt->dirty) {
						vm_page_protect(mt, VM_PROT_NONE);
						vm_page_deactivate(mt);
					} else {
						vm_page_cache(mt);
					}
				}

				ahead += behind;
				behind = 0;
			}
------

which can be reduced to:
----
			if ((first_object->type != OBJT_DEVICE) &&
				(first_object->behavior == OBJ_SEQUENTIAL)) {
				ahead += behind;
				behind = 0;
			}
----

Maybe a first_pindex should be converted to a firstpindex. At least, this
is confusing use of variable names.

>How-To-Repeat:

	Look at the source code.

>Fix:
	
	Change the source code.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->dyson 
Responsible-Changed-By: peter 
Responsible-Changed-When: Fri Aug 23 20:06:09 PDT 1996 
Responsible-Changed-Why:  
This is John's area. 
Responsible-Changed-From-To: dyson->dg 
Responsible-Changed-By: wosch 
Responsible-Changed-When: Wed Jun 17 15:12:24 MEST 1998 
Responsible-Changed-Why:  
John Dyson has resigned from the FreeBSD project. 
State-Changed-From-To: open->feedback 
State-Changed-By: sheldonh 
State-Changed-When: Thu Jun 10 07:55:25 PDT 1999 
State-Changed-Why:  
Tor, could you look at vm_fault.c rev 1.102 and feedback on whether or not 
you think your patch is still appropriate? 
State-Changed-From-To: feedback->closed 
State-Changed-By: sheldonh 
State-Changed-When: Thu Jun 10 16:06:13 PDT 1999 
State-Changed-Why:  
Fixed in revision 1.68 of vm_fault.c 


Responsible-Changed-From-To: dg->peter 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Thu Jun 10 16:06:13 PDT 1999 
Responsible-Changed-Why:  
His fix. 
>Unformatted:
