atom feed12 messages in org.freebsd.freebsd-currentRe: newfs: sectors per cylinder (4096...
FromSent OnAttachments
Julian Howard StaceyFeb 19, 1995 12:45 pm 
Ollivier ROBERTFeb 20, 1995 3:58 pm 
Rodney W. GrimesFeb 20, 1995 5:25 pm 
Poul-Henning KampFeb 20, 1995 5:53 pm 
Rodney W. GrimesFeb 20, 1995 6:22 pm 
Poul-Henning KampFeb 20, 1995 6:25 pm 
Gene StarkFeb 21, 1995 4:27 am 
Stefan EsserFeb 21, 1995 7:03 am 
Julian Howard StaceyFeb 21, 1995 3:33 pm 
Bruce EvansFeb 22, 1995 12:57 am 
Gene StarkFeb 22, 1995 3:48 am 
Bruce EvansFeb 23, 1995 8:12 am 
Subject:Re: newfs: sectors per cylinder (4096) disagrees with disk label (36)
From:Stefan Esser (se@MI.Uni-Koeln.DE)
Date:Feb 21, 1995 7:03:17 am
List:org.freebsd.freebsd-current

On Feb 20, 17:25, "Rodney W. Grimes" wrote: } Subject: Re: newfs: sectors per cylinder (4096) disagrees with disk label } This is caused by phk's changes to the behavior of newfs, it now } uses 1 head/cylinder, 4096 sectors/track by default. This was an } attempt to increase performace. I have found that it does nothing } for any disks I use and just leads to problems while newfsing several } of them.

Not surprising. There has been some changes to the default file system parameters, but no change to the block allocation code to reflect this.

Since there is only one rotational position now by default (a GOOD thing !), the code that ought to choose a rotational near block, in fact returns a RANDOM block on the (virtual) cylinder (i.e. in a 2MB range with current parameters). This means, a random block within a range of a few (up to 10) cylinders is chosen, if the block succeeding the last one of a file is not free when a file is grown.

This can easily be circumvented by a slight modification of the alloc code:

Index: ffs_alloc.c =================================================================== RCS file: /usr/cvs/src/sys/ufs/ffs/ffs_alloc.c,v retrieving revision 1.7 diff -C2 -r1.7 ffs_alloc.c *** 1.7 1995/02/14 06:14:28 --- ffs_alloc.c 1995/02/21 14:49:18 *************** *** 913,920 **** * check for a block available on the same cylinder */ ! cylno = cbtocylno(fs, bpref); ! if (cg_blktot(cgp)[cylno] == 0) ! goto norot; ! if (fs->fs_cpc == 0) { /* * Block layout information is not available. --- 913,917 ---- * check for a block available on the same cylinder */ ! if (fs->fs_nrpos <= 1 || fs->fs_cpc == 0) { /* * Block layout information is not available. *************** *** 927,930 **** --- 924,930 ---- goto norot; } + cylno = cbtocylno(fs, bpref); + if (cg_blktot(cgp)[cylno] == 0) + goto norot; /* * check the summary information to see if a block is

If there is only one rotational position, then the best strategy is to use the next free logical block succeeding "bpref".

(In fact, I've put "#ifdef USE_ROTPOS" around this line and the "#endif" just above the "norot:" label. It's extremely unlikely, that I'll ever connect a device that would use the rot. optimisation code. This results in a slight reduction in code size and avoids an unnecessary test and jump ...)

I'd like to apply the above patch (or the "#ifdef" version) to FreeBSD-current. (A similar patch was applied to NetBSD some time ago as a reaction to me pointing the above out in a news group article.)

Regards, STefan