To accomplish this, we have a background kernel thread called nfsfillind which looks for partially cached files and attempts to take advantage of idle time to fill them in. When network traffic is low, this thread periodically looks at the set of partially cached files. It chooses one that would benefit from being filled-in (the simple metric we use is fewest-remaining pages first, with ties broken by total file size) and reads in an unread page, saving it to the local disk cache. In this way, we avoid insisting that the first read of a file get all the pages from the server immediately, but instead choose to get the rest of a file when the system is idle.
This ``fill-in'' process will continue as long as there are partially cached files.13 In order to allow partially cached files to be kept and filled in even if the original user process which read the file has closed it, the inode for the local cache file is augmented with the NFS file handle for the file. Using this handle, the nfsfillind process can read pages from the server even if the inode representing the NFS version of the file has left memory.14