From owner-freebsd-bugs Tue Aug 20 12:20:04 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id MAA26571 for bugs-outgoing; Tue, 20 Aug 1996 12:20:04 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id MAA26540; Tue, 20 Aug 1996 12:20:02 -0700 (PDT) Resent-Date: Tue, 20 Aug 1996 12:20:02 -0700 (PDT) Resent-Message-Id: <199608201920.MAA26540@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, tegge@idt.ntnu.no Received: from ref.tfs.com ([206.245.251.1]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id MAA26060 for ; 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 ; 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 ; 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 Reply-To: tegge@idt.ntnu.no To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/1516: vm_fault.c contains dead code or too many underscores. Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >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: