Date: Tue, 21 Feb 1995 16:03:36 +0100 From: se@MI.Uni-Koeln.DE (Stefan Esser) To: current@FreeBSD.org Subject: Re: newfs: sectors per cylinder (4096) disagrees with disk label (36) Message-ID: <199502211503.AA14424@ParC03.MI.Uni-Koeln.DE> In-Reply-To: "Rodney W. Grimes" <rgrimes@gndrsh.aac.dev.com> "Re: newfs: sectors per cylinder (4096) disagrees with disk label (36)" (Feb 20, 17:25)
next in thread | previous in thread | raw e-mail | index | archive | help
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: <se@ZPR.Uni-Koeln.DE> Zentrum fuer Paralleles Rechnen Tel: +49 221 4706019 Universitaet zu Koeln FAX: +49 221 4705160 Weyertal 80 50931 Koeln
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199502211503.AA14424>