Este conteúdo não está disponível no idioma selecionado.
10.3. Using the Cache With NFS
			NFS will not use the cache unless explicitly instructed. To configure an NFS mount to use FS-Cache, include the 
-o fsc option to the mount command:
		mount nfs-share:/ /mount/point -o fsc
# mount nfs-share:/ /mount/point -o fsc
			All access to files under 
/mount/point will go through the cache, unless the file is opened for direct I/O or writing (refer to Section 10.3.2, “Cache Limitations With NFS” for more information). NFS indexes cache contents using NFS file handle, not the file name; this means that hard-linked files share the cache correctly.
		
			Caching is supported in version 2, 3, and 4 of NFS. However, each version uses different branches for caching.
		
10.3.1. Cache Sharing Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
				There are several potential issues to do with NFS cache sharing. Because the cache is persistent, blocks of data in the cache are indexed on a sequence of four keys:
			
- Level 1: Server details
 - Level 2: Some mount options; security type; FSID; uniquifier
 - Level 3: File Handle
 - Level 4: Page number in file
 
				To avoid coherency management problems between superblocks, all NFS superblocks that wish to cache data have unique Level 2 keys. Normally, two NFS mounts with same source volume and options will share a superblock, and thus share the caching, even if they mount different directories within that volume.
			
Example 10.1. Cache sharing
					Take the following two 
mount commands:
				mount home0:/disk0/fred /home/fred -o fsc
				mount home0:/disk0/jim /home/jim -o fsc
				
					Here, 
/home/fred and /home/jim will likely share the superblock as they have the same options, especially if they come from the same volume/partition on the NFS server (home0). Now, consider the next two subsequent mount commands:
				mount home0:/disk0/fred /home/fred -o fsc,rsize=230
				mount home0:/disk0/jim /home/jim -o fsc,rsize=231
				
					In this case, 
/home/fred and /home/jim will not share the superblock as they have different network access parameters, which are part of the Level 2 key. The same goes for the following mount sequence:
				mount home0:/disk0/fred /home/fred1 -o fsc,rsize=230
				mount home0:/disk0/fred /home/fred2 -o fsc,rsize=231
				
					Here, the contents of the two subtrees (
/home/fred1 and /home/fred2) will be cached twice.
				
					Another way to avoid superblock sharing is to suppress it explicitly with the 
nosharecache parameter. Using the same example:
				mount home0:/disk0/fred /home/fred -o nosharecache,fsc
				mount home0:/disk0/jim /home/jim -o nosharecache,fsc
				
					However, in this case only one of the superblocks will be permitted to use cache since there is nothing to distinguish the Level 2 keys of 
home0:/disk0/fred and home0:/disk0/jim. To address this, add a unique identifier on at least one of the mounts, i.e. fsc=unique-identifier. For example:
				mount home0:/disk0/fred /home/fred -o nosharecache,fsc
				mount home0:/disk0/jim /home/jim -o nosharecache,fsc=jim
				
					Here, the unique identifier 
jim will be added to the Level 2 key used in the cache for /home/jim.