home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / question / 10842 < prev    next >
Encoding:
Text File  |  1992-09-08  |  5.5 KB  |  123 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!spool.mu.edu!decwrl!pa.dec.com!nntpd2.cxo.dec.com!nabeth!alan
  3. From: alan@nabeth.enet.dec.com (Alan Rollow - Alan's Home for Wayward Tumbleweeds.)
  4. Subject: Re: Berkely Fast File System
  5. Message-ID: <1992Sep9.025316.19275@nntpd2.cxo.dec.com>
  6. Lines: 110
  7. Sender: alan@nabeth (Alan Rollow - Alan's Home for Wayward Tumbleweeds.)
  8. Reply-To: alan@nabeth.enet.dec.com (Alan Rollow - Alan's Home for Wayward Tumbleweeds.)
  9. Organization: Digital Equipment Corporation
  10. References:  <1992Sep7.085336.22530@nntp.uoregon.edu>
  11. Date: Wed, 9 Sep 1992 02:53:16 GMT
  12.  
  13.  
  14. In article <1992Sep7.085336.22530@nntp.uoregon.edu>, swynne@cie.uoregon.edu.uoregon.edu (Stephen Wynne) writes:
  15. >
  16. >I'm having difficulties understanding the Berkeley Fast File System.
  17. >I can see how fragmentation would be a problem under the old method, 
  18. >but I'm getting lost in the details of cylinder groups, bitmaps, etc...
  19. >Would anyone care to start a discussion on this topic with me?
  20.  
  21. Sure.
  22.  
  23. The Fast File System offers a variety of solutions to a variety
  24. of problems not all related.  Two of the more prominent problems
  25. solved were:
  26.  
  27. A.  Low bandwidth used compared to what was available.
  28. B.  Very low locality of reference.
  29.  
  30. The solution to A was straight forward, increase the block
  31. size.  This presented the problem of wasting space on files
  32. that used very little of a block.  Hence file fragments were
  33. born.  This presented the additional problem of how to quickly
  34. find a good fragment of the right size when you needed one.
  35. By keeping each free block list in a table on a per cylinder
  36. group basis, one you had decided what cylinder group to put
  37. a block in, it was easy to do a pattern search for the a
  38. fragment that matched the one you wanted.  This was aided by
  39. a VAX instructions that did this search very well.
  40.  
  41. Problem B had lots of pieces of solutions.  In the old file
  42. system blocks were allocated off the free list in the simplest
  43. way possible.  When block were freed, they were put back on the
  44. list in the simplest way possible (I'm doing this from memory,
  45. if I'm wrong please correct me).  As the result the free list
  46. got quickly scrambled.
  47.  
  48. There was also another problem with the old file system.  The
  49. arrangement of the superblock, inode table and data block was:
  50.  
  51.     +------------+
  52.     | Superblock |
  53.     +------------+
  54.     |   Inodes   |
  55.     +------------+
  56.     |    Data    |
  57.     +------------+
  58.  
  59. If the data you were using happened to be at the far end of the
  60. disk from the inodes, any update to the inode result in a LONG
  61. seek.  Now the invention of cylinder groups.
  62.  
  63. A cylinder group resembles the old file system, with the addition
  64. of the cylinder group data.  The file system is a collection of
  65. these groups of cylinders.  The file allocation algorithms were
  66. changed so that when a new directory was created it was created
  67. in a cylinder with an above average amount of free space.  As files
  68. were created in this directory the preference was to allocate them
  69. in the same cylinder group as the directory.  As blocks were allocated
  70. it was preferred to allocate them in the same cylinder group as the
  71. file, except when the file was very large.  In this way most files
  72. would be kept close together and if they were small enough in a
  73. single contiguous block.  Even today a large percentage of files
  74. will fit in an 8 KB block.
  75.  
  76. Large files would be scattered across the disk, in such a way that
  77. big pieces of the file would be close together, but these pieces
  78. might scattered completely across the disk.  Further the blocks
  79. were allocated in such a way that they would be in a rotationally
  80. optimal location.  One of the problems with many disk controllers
  81. is that two separate I/O requests for block next to each other
  82. will probably result in getting the first one, and having to wait
  83. a rotation for the 2nd block.  In this case it is better to put the
  84. later block in a location such that the I/O has a chance to get to
  85. the controller before the block rotates by.  The affect is very
  86. pronounced on DEC MSCP controllers with SDI disks.  The rotational
  87. delay can sometimes double the bandwidth being used for sequential
  88. I/Os.  This is not as much a problem with disks that have their own
  89. read-ahead caches.
  90.  
  91. These block and file allocation methods greatly improved the locality
  92. of reference for a single user, especially if the applications used
  93. followed the assumptions under which the improvements were designed.
  94. The next problem that came up was what to do on a multi-user system.
  95. While one user may see most of his disk activity in one little area
  96. of the disk a number of user would cause the activity to be scattered
  97. all over the disk.  The obvious solution was the to do seek ordering.
  98. I/O requests would be put on queues handled by the disk driver.  When
  99. an entry was added the location would be noted so that it could be
  100. added with other requests for the same area of the disk.
  101.  
  102. As long as many I/O requests are going to the disk, this will allow
  103. an through-put improvement.  If there aren't many outstanding I/O
  104. requests, then disk probably isn't busy enough to worry about.
  105.  
  106. This particular optimization was disabled for the DEC MSCP controllers
  107. that did their own seek ordering.  I don't know of any performance
  108. tests to compare the two.  I have heard one or two complaints from
  109. people that would have preferred the controller seek order feature
  110. be disabled and the Berkeley disksort kept.
  111.  
  112. Well, I guess that's enough for now.  I should probably go re-read the
  113. Fast File System paper and see how much I got wrong. 
  114.  
  115. >
  116. >Thanks,
  117. >
  118. >STEVE
  119. >
  120. --
  121. Alan Rollow                alan@nabeth.cxo.dec.com
  122.  
  123.