If the amount of main memory used to store files exceeds a tunable threshold, the pack_files_daemon() uses the file LRU list to create a cluster of files and write the cluster to disk. The daemon packs the files using the information from the collocate_file() calls, attempting to pack files from the same locality set in the same cluster. If a file is larger than the cluster size, it is split between multiple clusters.
This daemon uses the disk data layout policy to decide which cluster to pack next. Implemented policies include: closest cluster, which picks the closest free cluster to the previous cluster on disk accessed, closest cluster to previous write, which picks the closest free cluster to the previous cluster written to on disk, and overwrite, which overwrites the next cluster. All of these policies tend to write files accessed within a short time to clusters close together on disk. Thus, long-term fragmentation does not occur.