Date: Tue, 20 Aug 1996 19:57:47 +0200 (MET DST) From: Tor Egge <tegge@idt.ntnu.no> To: FreeBSD-gnats-submit@freebsd.org Subject: kern/1516: vm_fault.c contains dead code or too many underscores. Message-ID: <199608201757.TAA22004@ikke.idt.unit.no> Resent-Message-ID: <199608201920.MAA26540@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 1516
>Category: kern
>Synopsis: vm_fault.c contains dead code or too many underscores.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Aug 20 12:20:01 PDT 1996
>Last-Modified:
>Originator: Tor Egge
>Organization:
Norwegian University of Science and Technology, Trondheim, Norway
>Release: FreeBSD 2.2-CURRENT i386
>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.
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199608201757.TAA22004>
