home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / bsd / 10429 < prev    next >
Encoding:
Text File  |  1992-12-21  |  3.6 KB  |  75 lines

  1. Newsgroups: comp.unix.bsd
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!bogus.sura.net!pandora.pix.com!stripes
  3. From: stripes@pix.com (Josh Osborne)
  4. Subject: Re: Dumb Question: Why 512 byte block?
  5. Message-ID: <BzIEv1.G7G@pix.com>
  6. Sender: news@pix.com (The News Subsystem)
  7. Nntp-Posting-Host: pandora.pix.com
  8. Organization: Pix Technologies -- The company with no adult supervision
  9. References: <1992Dec18.030833.7395@fcom.cc.utah.edu> <1gt736INNjje@menudo.uh.edu> <1992Dec18.235623.27538@fcom.cc.utah.edu>
  10. Date: Sat, 19 Dec 1992 13:59:23 GMT
  11. Lines: 62
  12.  
  13. In article <1992Dec18.235623.27538@fcom.cc.utah.edu> terry@cs.weber.edu (A Wizard of Earth C) writes:
  14. [...]
  15. >>If you have 6 1.5K files using 1K blocks,
  16. >>   6 1k blocks will take each 1K from each file, and 
  17. >>   3 1k blocks will take 0.5k from each file.
  18. >>This was my understading from the famous FUFS paper.
  19. >
  20. >You can't split blocks between files.  A block is, by definition, the
  21. >smallest possible allocation unit.  Thin about the case where you have
  22.  
  23. Under the FFS the fragment is the smallest allocation unit, and fragments are
  24. only allocated at the end of a file.  The rest of the file is in blocks.
  25.  
  26. >a 1 byte file and a 1 block - 1 byte file; what would you do when
  27. >adding one or two characters to the first (1 Byte)?  TReallocate?  Shift
  28. >and reallocate for the last byte of the second file?
  29.  
  30. When you extend a file that ends in a fragment it is relocated.  That is one
  31. reason to go through stdio (which with normal block and fragment sizes only
  32. writes one or more whole blocks except on a ffluch(), or fclose()).
  33.  
  34. >But... you're right that it doesn't work the way I've shown... thought
  35. >for sure I'd get bombarded on this one:
  36. >>>Obviously, if I have 6 1.6K files, both blocking factors take up 512K.
  37. >should have read:
  38. >>>Obviously, if I have 6 1.6K files, both blocking factors take up 12K.
  39. >
  40. >1.6K rounded to a both a 512b and 1K boundry is 2K, and 2k * 6 = 12k.
  41. [...]
  42. >Consider the most ridiculous possible situation:  I have a 1G disk with
  43. >a 1G blocking factor (impossible without rewriting the buffering code).
  44. >
  45. >How many files can I have on the disk? (Ignore the blocks allocated to inodes
  46. >and directoryies 8-P).
  47.  
  48. With the frags per block set at 8 (I beleve the normal, and highest setting),
  49. you could have 8 files, but only if you were root (the avail-free space for
  50. non-root users may be done only in blocks, and count a block with 1 frag
  51. "used").
  52.  
  53. I think the BSD FFS is normally configured with 8K blocks, and 1K fragments,
  54. or 4K blocks and 512b fragments.  So the figures for 1.6K files you gave
  55. are correct for the 4K/512b system, and low for the 8K/1K system.  However
  56. I don't think anything prevents you from having a 1K/128b filesystem (except
  57. the block device drivers for disks, and mabie the buffer cache).
  58.  
  59. I would like to see the number of frags/block uped to 32 so we can have
  60. 32K/1K, or 16K/512b filesystems, which after stdio is changed to use bigger
  61. buffers should improve disk read/write speed without effecting the amount
  62. of disk we can make use of.
  63.  
  64. (info from The Design and Impl. of the 4.3BSD OS, Leffler, McKusick, Karels,
  65. Quarterman; '89 printing, ISBN 0-201-06196-1, chapeter 7, page 198
  66. "Optimizing Storage Utilization", and 203 "Filesystem Data Structures", and
  67. a few more sections of chapeter 7.  Any mistakes or misconceptions are mine
  68. and mine alone, not that of the authors)
  69. -- 
  70.            stripes@pix.com              "Security for Unix is like
  71.       Josh_Osborne@Real_World,The          Multitasking for MS-DOS"
  72.       "The dyslexic porgramer"                  - Kevin Lockwood
  73. We all agree on the necessity of compromise.  We just can't agree on
  74. when it's necessary to compromise.       - Larry Wall
  75.