The structure of the Reiser file system
Mode: S_IFREG (regular file), -rw-r--r-- Num. links: 1 Size: 239 UID: 0 GID: 0 A/M/Ctimes: 07/23/2002 21:47:01 Blocks: 8 Gen: 725
Note that the stat item contains the correct size for the file, 239 bytes. This means that byte 2979 (0xba3) of the block does not belong to the file anymore.
Example 2: file with indirect itemThe file "/var/log/SaX.log" is 7121 bytes long. It therefor cannot fit as a direct item and needs to be split either into two unformatted blocks or one unformatted block and a tail. In this case, the file will take up two unformatted blocks described by one indirect item. The key for the file is {13, 1490, 0, 0} and examining block 8482 we find out that it is contained in leaf node block number 27444. 00000040 0d 00 00 00 d2 05 00 00 ....Ò...
00000050 00 00 00 00 00 00 00 00 ff ff 2c 00 a4 0b 01 00 ........ÿÿ,.¤...
00000060 0d 00 00 00 d2 05 00 00 01 00 00 00 00 00 00 10 ....Ò...........
00000070 00 00 08 00 9c 0b 01 00 ........
Key: {13, 1490, 0, 0} Count: 0xffff Length: 44 bytes Location: byte 2980 (0xba4) Version: 1 (new)
Key: {13, 1490, 1, 1} Count: 0 Length: 8 bytes Location: byte 2972 (0xb9c) Version: 1 (new)
00000b90 12 52 00 00 .R..
00000ba0 13 52 00 00 a4 81 05 00 01 00 00 00 d1 1b 00 00 .R..¤.......Ñ...
00000bb0 00 00 00 00 00 00 00 00 00 00 00 00 3f aa 4a 3d ............?ªJ=
00000bc0 bd aa 4a 3d bd aa 4a 3d 10 00 00 00 54 05 00 00 ½ªJ=½ªJ=....T...
Mode: S_IFREG (regular file), -rw-r--r-- Num. links: 1 Size: 7121 UID: 0 GID: 0 C time: Fri Aug 2 10:50:23 2002 M/Atimes: Fri Aug 2 10:52:29 2002 Blocks: 10 Gen: 1364 Block 1: 21010 Block 2: 21011
The file is thus made up of the contents of blocks 21010 and 21011. Block 21010 contains a full 4096 bytes of data, whereas block 21011 contains only 3025 bytes. For some reason, though the item header for the indirect item (see above) doesn't contain a count of 1071 bytes as one would have expected.
Example 3: a large file The file "/var/lib/rpm/fileindex.rpm" is a file of over 11 MB in size. A single indirect item can not describe the file, as there isn't enough space in a block for such a large indirect item. The file has the key {4, 7, 0, 0}, which can be found in block 16822. This block, however, contains only the stat item for the file. The indirect items for the file span over three more blocks: Key {4, 7, 1, 1} is in block 13286, key {4, 7, 4145153, 1} in block 20171, and key {4, 7, 8290305, 1} in block 20987. Block 13286 contains one single indirect item: 00000010 04 00 00 00 07 00 00 00 ........
00000020 01 00 00 00 00 00 00 10 00 00 d0 0f 30 00 01 00 ..........Ð.0...
Key: {4, 7, 1, 1} Count: 0 Length: 4048 bytes Location: byte 48 (0x30) Version: 1 (new)
What follows are 1012 pointers to unformatted blocks. Block 20171 has the same structure. Block 20987 also holds just one indirect item, but uses only 3320 bytes for 830 pointers. Note how the offset for the next key derives directly from offset of the previous key and the number of pointers in the previous indirect item:
|