From owner-freebsd-hackers Mon Aug 31 15:08:20 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA12718 for freebsd-hackers-outgoing; Mon, 31 Aug 1998 15:08:20 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from dingo.cdrom.com (dingo.cdrom.com [204.216.28.145]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA12697 for ; Mon, 31 Aug 1998 15:08:17 -0700 (PDT) (envelope-from mike@dingo.cdrom.com) Received: from dingo.cdrom.com (localhost.cdrom.com [127.0.0.1]) by dingo.cdrom.com (8.9.1/8.8.8) with ESMTP id PAA01368; Mon, 31 Aug 1998 15:03:27 GMT (envelope-from mike@dingo.cdrom.com) Message-Id: <199808311503.PAA01368@dingo.cdrom.com> X-Mailer: exmh version 2.0.2 2/24/98 To: zhihuizhang cc: Mike Smith , hackers Subject: Re: FFS questions In-reply-to: Your message of "Mon, 31 Aug 1998 17:36:41 -0400." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 31 Aug 1998 15:03:27 +0000 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Again, bear in mind that the techniques we're discussing here are deprecated, that is, they are no longer useful and we do our best to avoid using them whenever possible. > > > The comment says it is the number of cylinders per *cycle* in position > > > table. What does the "cycle" mean? > > > > It's the size of the rotational offset table. Starting from position 0 > > on the disk, there are N cycles of fastest-next-block locations as you > > move across the disk. You only need to store one cycle in the offset > > table. > > >From your explanation, it seems that the table is for entire disk (not > constrained to one cylinder) and according to comment in mkfs.c, each > cycle is a rotational pattern. So I guess that each pattern covers fs_cpc > cylinders, or after fs_cpc cylinders the pattern will repeat (on the next > cylinder boundary or immediately?) The pattern repeats every fs_cpc cylinders, which is why you only store that much of it. The pattern always covers a whole number of cylinders, so the repeat is always on a cylinder boundary. > So how is the pattern represented anyway? Is there any relationship > between fs_cpc and fs_nrpos (should be number of rotational positions *per > cylinder*). I guess that in a pattern (cycle), there are fs_cpc * > fs_nrpos different positions. How are these positions represented, by > block numbers or by increments? Each entry in the pattern gives an offset to the next optimally located rotational position, ie. allowing for head/track switch delays, skipping over spares at the end of the track/cylinder, etc. > The macro cbtorpos() converts a block number to a rotational position in a > single cylinder. This position is used to index position table to get > another block number. This block number is in turn used to index the > rotational table to get an increase of it. After increase, the block > number is used again to index the positional table until a free file block > is found.... The use of fs_postbl() and fs_rotbl() seems to construct a > list of blocks available at each rotational position. But they confuses > me. If you have allocated a block, and wish to allocate another to follow it, the ideal case is to find a block that can be read as quickly as possible. This block will be located somewhere after the block that you have just allocated; it may be on the same track, on another track on the same cylinder, or on another cylinder. In each case, you need to consider different factors when calculating this block. The position table contains a precalculated set of block offsets, rather than repeating the calculations each time. When trying to understand why these calculations were necessary, understand that the disk drives being used when this code was developed had no "intelligence" as such; all optimisations for disk behaviour had to be embedded into the filesystem. It is difficult to explain the justification for these optimisations without a lengthy explanation of: - sector interleave - track interleave - command overhead - head switch time - track-to-track time and a number of other subtle factors which modify these and related parameters. Modern disks do not behave like these old disks, which is why we disable these old "optimisations" where possible. > I hope someone can clarify for me on how those blocks for one rotational > position are organized. Blocks in each rotational position are logically contiguous. By default, there were 8 rotational positions on the disk, so for a disk with 32 sectors per track, there would be 4 blocks in each rotational position, 0-3 in #0, 4-7 in #1, etc. These sectors might not be arranged contigously on the disk however. > Any help is appreciated. In studying this code, it's important to remember what I've tried to point out above; it was designed to optimise performance on old hardware, and only worked well if *all* parameters were correct. Modern disk hardware attempts to second-guess the operating system, and usually does a better job. We improve performance by allocating contigous space on the disk wherever possible (no interleave, only one rotational position); this takes advantage of the read-ahead/write behind performed by most modern disks rather than wasting space in the disk cache with intervening blocks that we will not use. -- \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\ msmith@cdrom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message