1.SH 2Buffer Cache 3.PP 4When the file server is 5booted, 6all of the unused memory is allocated to 7a block buffer pool. 8There are two major operations on the buffer 9pool. 10.CW Getbuf 11will find the buffer associated with a 12particular block on a particular device. 13The returned buffer is locked so that the 14caller has exclusive use. 15If the requested buffer is not in the pool, 16some other buffer will be relabeled and 17the data will be read from the requested device. 18.CW Putbuf 19will unlock a buffer and 20if the contents are marked as modified, 21the buffer will be written to the device before 22the buffer is relabeled. 23If there is some special mapping 24or CPU cache flushing 25that must occur in order for the physical I/O 26device to access the buffers, 27this is done between 28.CW getbuf 29and 30.CW putbuf . 31The contents of a buffer is never touched 32except while it is locked between 33.CW getbuf 34and 35.CW putbuf 36calls. 37.PP 38The 39file system server processes 40prevent deadlock in the buffers by 41always locking parent and child 42directory entries in that order. 43Since the entire directory structure 44is a hierarchy, 45this makes the locking well-ordered, 46preventing deadlock. 47The major problem in the locking strategy is 48that locks are at a block level and there are many 49directory entries in a single block. 50There are unnecessary lock conflicts 51in the directory blocks. 52When one of these directory blocks is tied up 53accessing the very slow WORM, 54then all I/O to dozens of unrelated directories 55is blocked. 56