*BSD News Article 19785


Return to BSD News archive

Newsgroups: comp.os.386bsd.development
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!sol.ctr.columbia.edu!hamblin.math.byu.edu!news.byu.edu!news.provo.novell.com!park.uvcc.edu!fcom.cc.utah.edu!cs.weber.edu!terry
From: terry@cs.weber.edu (A Wizard of Earth C)
Subject: Re: a question about the mapsearch() in ufs
Message-ID: <1993Aug20.200750.21613@fcom.cc.utah.edu>
Sender: news@fcom.cc.utah.edu
Organization: Weber State University, Ogden, UT
References: <251h48$1cn@acsc.com>
Date: Fri, 20 Aug 93 20:07:50 GMT
Lines: 34

In article <251h48$1cn@acsc.com> jerry@acsc.com (Jerry Chen) writes:
>I am reading the source code of the ufs in netBSD0.8.  Here is a question:
>
>mapsearch() first scans from cg_blksfree(cgp)[n] to the end of
>cg_blksfree(cgp)[] then from cg_blksfree(cgp)[0] to cg_blksfree(cgp)[n].
>That is, cg_blksfree(cgp)[n] is scanned twice.  Why is this?  Or am I
>miss-understanding the code?  Thanks in advance for the advice.

It's not scanned twice -- it's scanned from the current rotational location
to the end, then from the start of the cylinder to the current location.

The idea is that it's cheaper to do this than to reposition the disk head
for the neaxt read.

The fallacy in this is that translated drives cylinder boundries aren't
where the file system expects, and this is much more likely to cause a
physical reposition to occur twice than it is to avoid a reposition.

The correct way to handle it is to depend on the drive electronics to
"do the right thing" by setting the track-to-track (cylinder-to-cylinder)
seek time in the disklabel to 0 so that it doesn't see any penalty in a
linear search.  Without looking at the exact code in question, I don't
know if a 0 value will help.  The other classical workaround is to say
the drive has exactly one big, long cylinder so that it never believes
seeks occur at all; if you do this, it will check toward the end of the
disk before checking toward the front, and you should watch your disk
fragmentation.


					Terry Lambert
					terry@icarus.weber.edu
---
Any opinions in this posting are my own and not those of my present
or previous employers.