From owner-freebsd-current Tue Feb 21 07:04:11 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id HAA02586 for current-outgoing; Tue, 21 Feb 1995 07:04:11 -0800 Received: from ParC03.MI.Uni-Koeln.DE (ParC03.MI.Uni-Koeln.DE [134.95.212.43]) by freefall.cdrom.com (8.6.9/8.6.6) with SMTP id HAA02536 for ; Tue, 21 Feb 1995 07:04:01 -0800 Received: by ParC03.MI.Uni-Koeln.DE id AA14424 (5.67b/IDA-1.5 for current@freebsd.org); Tue, 21 Feb 1995 16:03:36 +0100 Message-Id: <199502211503.AA14424@ParC03.MI.Uni-Koeln.DE> From: se@MI.Uni-Koeln.DE (Stefan Esser) Date: Tue, 21 Feb 1995 16:03:36 +0100 In-Reply-To: "Rodney W. Grimes" "Re: newfs: sectors per cylinder (4096) disagrees with disk label (36)" (Feb 20, 17:25) X-Mailer: Mail User's Shell (7.2.5 10/14/92) To: current@FreeBSD.org Subject: Re: newfs: sectors per cylinder (4096) disagrees with disk label (36) Sender: current-owner@FreeBSD.org Precedence: bulk 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 -- Stefan Esser Internet: Zentrum fuer Paralleles Rechnen Tel: +49 221 4706019 Universitaet zu Koeln FAX: +49 221 4705160 Weyertal 80 50931 Koeln