File Storage vs. File Transfer

6.2.5 Filesystem Performance Issues

Once the filesystem is in place, UNIX starts to use the same filesystem very intensively. Thus the filesystem efficiency is very important for an overall UNIX behavior. Throughout all these years, the UNIX filesystem has been developed and improved significantly. Some of the improvements have been integrated into the filesystem itself. Other optional issues have been left to UNIX administrators to be implemented on an as−needed basis. We will address a few filesystem performance issues.

6.2.5.1 File Storage vs. File Transfer

A disk block is the basic unit of data that the filesystem manages. Data are always transferred, written and read in blocks. Thus the block size determines: The storage efficiency — blocks cannot be used partially for data storage, regardless of the actual size of the data to be stored • The data transfer efficiency i.e., IO throughput — larger blocks cause smaller overhead in the data transfer • Two performance issues are related differently toward the block size. A large block size increases transfer efficiency, but decreases storage efficiency. The original System V filesystem supported block sizes of 512B and 1KB, or sometimes 2 KB. The Berkeley filesystem supported 4, 8, 16, 32, or 64 KB. The difference in the block size was obvious. To avoid wasting disk space, the Berkeley−style filesystem introduced block fragmentation: each block could be split into 2, 4, or typically 8 fragments. Block fragments could then be used separately to store data from different files. The transfer efficiency remained unchanged because a whole block was still used in the transfer of data. However, the storage efficiency was improved because a block, partially used by one file, could be shared with other files. At the end, each disk block is fully utilized. Of course nothing is free. The price paid for this storage improvement is the need to identify individual block fragments within a specific block. Earlier, it was enough to identify only the block; now the block fragments are also in play. The concept of block fragmentation is presented in Figure 6.5. 152 Figure 6.5: Berkeley−style filesystem: Blocks and fragments. In this example, a hypothetical 25KB large file was located in the three 8 KB blocks and one 1 KB block fragment. Upon a change in the file size to 51 KB, the file will consume six 8 KB blocks and three block fragments. In both cases, the remaining block fragments will be used for other files, so the wasted space is minimized.

6.2.5.2 Reserved Free Space