@@ -792,10 +792,14 @@ \section{Disk Space Allocation}\label{disk-allocation-section}
792792virtual addresses within address spaces to physical addresses within
793793memory. In a file system, the mapping is from positions within files
794794to locations in persistent storage. For efficiency, the mapping is done at a coarse
795- granularity, several kilobytes at a time. In virtual memory, each
795+ granularity, several kibibytes at a time. In virtual memory, each
796796page is mapped into a page frame; in a file system, each block of a
797- file is mapped into a storage block. (You will see that blocks are
798- typically several kilobytes in size, spanning multiple sectors.)
797+ file is mapped into a storage block. (Recall from Section~\ref {vm-reps }
798+ that `` kibi'' is the binary unit for 1024. You will see that blocks are
799+ typically several kibibytes in size, spanning multiple sectors.
800+ Note, however, that transfer speeds and \emph {sizes } of hard disks are
801+ usually advertised based on powers of ten. In particular, a 1-TB disk is
802+ way too small to store 1 TiB.)
799803
800804When discussing virtual memory, I remarked that the operating system
801805was free to assign any unused page frame of physical memory to hold
@@ -850,9 +854,9 @@ \subsection{Fragmentation}\label{fragmentation-section}
850854
851855One source of waste is that space is allocated only in integer
852856multiples of some file system block size. For example, a file system
853- might allocate space only in units of 4~KB . A file that is too big to
854- fit in a single 4-KB unit will be allocated 8~KB of space---even if it
855- is only a single byte larger than 4~KB . The unused space in the last
857+ might allocate space only in units of 4~KiB . A file that is too big to
858+ fit in a single 4-KiB unit will be allocated 8~KiB of space---even if it
859+ is only a single byte larger than 4~KiB . The unused space in the last
856860file block is called \foldvocab {internal}{fragmentation}. The
857861amount of internal fragmentation depends not only on the desired file sizes,
858862but also on the file system block size. As an analogy, consider
@@ -866,7 +870,7 @@ \subsection{Fragmentation}\label{fragmentation-section}
866870disk drive's sector size; no file system ever subdivides the space
867871within a single disk sector. Generally the file system blocks span
868872several consecutive disk sectors; for example, eight disk sectors of 512
869- bytes each might be grouped into each 4-KB file system block. Larger
873+ bytes each might be grouped into each 4-KiB file system block. Larger
870874file system blocks cause more internal fragmentation, but are
871875advantageous from other perspectives. In particular, you will see that
872876a larger block size tends to reduce
@@ -882,9 +886,9 @@ \subsection{Fragmentation}\label{fragmentation-section}
882886absolute requirement. Later, I will consider relaxing it.
883887
884888Continuing with my earlier example, suppose you need space for a file
885- that is just one byte larger than 4~KB and hence has been rounded up
886- to two 4-KB blocks. The new requirement of contiguity means that you
887- are looking for somewhere on the disk where two consecutive 4-KB blocks
889+ that is just one byte larger than 4~KiB and hence has been rounded up
890+ to two 4-KiB blocks. The new requirement of contiguity means that you
891+ are looking for somewhere on the disk where two consecutive 4-KiB blocks
888892are free. Perhaps you are out of luck. Maybe the disk is only half
889893full, but the half that is full consists of every even-numbered file
890894system block with all the odd-numbered ones available for use. This
@@ -1043,8 +1047,8 @@ \subsection{Fragmentation}\label{fragmentation-section}
10431047fragmentation. The reason for this is that with a larger block size,
10441048there is less variability in the amount of space being allocated.
10451049Files that might have different sizes when rounded up to the next
1046- kilobyte (say, 14~KB and 15~KB ) may have the same size when rounded to
1047- the next multiple of 4~KB (in this case, 16~KB and 16~KB ). Reduced
1050+ kibibyte (say, 14~KiB and 15~KiB ) may have the same size when rounded to
1051+ the next multiple of 4~KiB (in this case, 16~KiB and 16~KiB ). Reduced
10481052variability reduces external fragmentation; in the extreme case, no
10491053external fragmentation at all occurs if the files are all allocated
10501054the same amount of space.
@@ -1147,8 +1151,8 @@ \subsection{Allocation Policies and Mechanisms}
11471151Many UNIX and Linux file systems use a slight variant on the bitmap
11481152approach. Linux's ext3fs file system can serve as an example. The
11491153overall disk space is divided into modest-sized chunks known as
1150- \vocabs {block group}. On a system with 4-KB disk blocks,
1151- a block group might encompass 128~MB . Each block group has its own
1154+ \vocabs {block group}. On a system with 4-KiB disk blocks,
1155+ a block group might encompass 128~MiB . Each block group has its own
11521156bitmap, indicating which blocks within that group are free. (In
11531157Exercise~\ref {block-group-bitmap-exercise }, you can show that in the example given, each block group's
11541158bitmap fits within a single block.) Summary information for the file
@@ -1391,8 +1395,8 @@ \subsubsection{Inodes and Indirect Blocks}
13911395\foldvocab {indirect}{block}. This provides room for many more
13921396block numbers, as shown in Figure~\ref {single-indirect-inode }. The
13931397exact number of additional block numbers depends on how big blocks and
1394- block numbers are. With 4-KB blocks and 4-byte block numbers, an
1395- indirect block could hold 1~K block numbers (that is, 1024 block
1398+ block numbers are. With 4-KiB blocks and 4-byte block numbers, an
1399+ indirect block could hold 1~Ki block numbers (that is, 1024 block
13961400numbers), as shown in the figure. This kind of indirect block is more
13971401specifically called a \foldvocab {single}{indirect block}, because it
13981402adds only a single layer of indirection: the inode points to it, and
@@ -1414,8 +1418,8 @@ \subsubsection{Inodes and Indirect Blocks}
14141418\label {single-indirect-inode }
14151419\end {figure }
14161420
1417- In this example with 4-KB blocks, the single indirect block allows you
1418- to accommodate files slightly more than 4~MB in size. To handle
1421+ In this example with 4-KiB blocks, the single indirect block allows you
1422+ to accommodate files slightly more than 4~MiB in size. To handle
14191423yet-larger files, you can use a multilevel tree scheme, analogous to
14201424multilevel page tables. The inode can contain a block number for a
14211425double indirect block, which contains block numbers for many more
@@ -1612,7 +1616,7 @@ \subsubsection{Extent Maps}
16121616
16131617At first, it may not be obvious why extent maps are a big improvement.
16141618A typical block map system might use a 4-byte block number to refer
1615- to each 4-KB block. This is less than one-tenth of one percent space
1619+ to each 4-KiB block. This is less than one-tenth of one percent space
16161620overhead, surely affordable with today's cheap disk storage. What
16171621reason do file system designers have to try to further reduce such an already small
16181622overhead? (I will ignore the possibility that the extent map takes
@@ -1641,7 +1645,7 @@ \subsubsection{Extent Maps}
16411645handful of extents (by far the most common case), all three store the
16421646sequence of extent map entries in the inode or (in Windows and Mac
16431647OS~X) in the corresponding inode-like structure. The analogs of inodes in
1644- NTFS are large enough (1~KB ) that they can directly store entire
1648+ NTFS are large enough (1~KiB ) that they can directly store entire
16451649extent maps for most files, even those with more than a few extents. The other
16461650two file systems use smaller inodes (or inode-like structures) and so
16471651provide an interesting comparison of techniques for handling the
@@ -1733,7 +1737,7 @@ \subsubsection{B-Trees}\label{B-trees}
17331737next subtree contains keys between the first and second root keys,
17341738and so forth. The last subtree contains keys larger than the last root key.
17351739
1736- If a multi-kilobyte disk block is used to hold a B-tree node, the
1740+ If a multi-kibibyte disk block is used to hold a B-tree node, the
17371741value of $ N$ can be quite large, resulting in a broad, shallow tree.
17381742In fact, even if a disk block were only half full with root keys and
17391743subtree pointers, it would still provide a substantial branching
@@ -2683,7 +2687,7 @@ \section*{Exercises}
26832687consequences for system performance. Based on the description in this
26842688chapter, what would you expect the performance problem to be?
26852689\item \label {block-group-bitmap-exercise }
2686- Show that if a file system uses 4-KB disk blocks and 128-MB block
2690+ Show that if a file system uses 4-KiB disk blocks and 128-MiB block
26872691groups, the bitmap for a block group fits within a single block.
26882692\item \label {best-fit-first-fit-exercise }
26892693Best-fit allocation sounds superior to first-fit, but in actuality,
@@ -2698,7 +2702,7 @@ \section*{Exercises}
26982702\item \label {largest-double-indirect-exercise }
26992703Assume an inode contains 12 direct block numbers, as well as single,
27002704double, and triple indirect block numbers. Further, assume that each
2701- block is 4~KB , and that each block number is 4 bytes. What is the
2705+ block is 4~KiB , and that each block number is 4 bytes. What is the
27022706largest a file can be without needing to use the triple indirect block?
27032707\item
27042708Draw two alternative `` after'' pictures for Figure~\ref {B-tree-split }
@@ -2975,8 +2979,8 @@ \section*{Notes}
29752979
29762980I mentioned that the analogs of inodes in Microsoft's NTFS are large
29772981enough to contain the entire extent maps for most files. In the rare
2978- case that the extent map does not fit in a single 1-KB record, NTFS
2979- expands the metadata into multiple 1-KB records, but unlike other file
2982+ case that the extent map does not fit in a single 1-KiB record, NTFS
2983+ expands the metadata into multiple 1-KiB records, but unlike other file
29802984systems, it continues to use a linear extent map rather than a B$ ^+$ -tree.
29812985
29822986B-trees were introduced by \index {Bayer, R.}Bayer and \index {McCreight, E.}McCreight~\cite {max1114 }. A
0 commit comments