User Tools

Site Tools


developersguide:vmcalls

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
developersguide:vmcalls [2014/11/18 17:50]
dcvmoole [C Interface] update for interface change in git-e321f65
developersguide:vmcalls [2015/09/19 16:46] (current)
dcvmoole [Logical Interface] update this part as well, why is it even here?
Line 20: Line 20:
 is informational,​ they needn'​t be unique in the VM cache. is informational,​ they needn'​t be unique in the VM cache.
  
-Logically there are three operations:+Logically there are four operations:
  
   - Set a block. The caller passes the virtual address of the block, its length, and its identification to VM. VM will keep that block and the metadata in its cache. This is the way to indicate a new cache block to VM, for possible later retrieval. The ''​(dev,​ dev_off)''​ pair is required and is unique; a possible existing block with that ID will be removed from the cache.   - Set a block. The caller passes the virtual address of the block, its length, and its identification to VM. VM will keep that block and the metadata in its cache. This is the way to indicate a new cache block to VM, for possible later retrieval. The ''​(dev,​ dev_off)''​ pair is required and is unique; a possible existing block with that ID will be removed from the cache.
   - Map a block. The caller passes the ''​(dev,​ dev_off)''​ pair to VM, together with further metadata. If the block exists, VM maps the cache block in and returns the address to the caller. VM updates its notion of the inode and inode offset of the block.   - Map a block. The caller passes the ''​(dev,​ dev_off)''​ pair to VM, together with further metadata. If the block exists, VM maps the cache block in and returns the address to the caller. VM updates its notion of the inode and inode offset of the block.
 +  - Forget a block. The caller passes a ''​(dev,​ dev_off)''​ pair to VM, along with a block size. If the block exists, VM throws it out of the cache.
   - Clear blocks. The caller passes a ''​dev''​ device identifier to VM, and VM removes all blocks associated with that device from its cache.   - Clear blocks. The caller passes a ''​dev''​ device identifier to VM, and VM removes all blocks associated with that device from its cache.
  
 ==== C Interface ==== ==== C Interface ====
  
-There are three calls, ''​vm_set_cacheblock'',​ ''​vm_map_cacheblock'',​ and ''​vm_clear_cache''​.+There are four calls, ''​vm_set_cacheblock'',​ ''​vm_map_cacheblock'',​ ''​vm_forget_cacheblock'',​ and ''​vm_clear_cache''​.
  
 <​code>​ <​code>​
-int vm_set_cacheblock(void *block, ​u32_t dev, u64_t dev_offset,​ +int vm_set_cacheblock(void *block, ​dev_t dev, off_t dev_offset,​ 
-u64_t ino, u64_t ino_offset, u32_t *flags, int blocksize, int setflags);+ino_t ino, off_t ino_offset, u32_t *flags, int blocksize, int setflags);
 </​code>​ </​code>​
  
Line 49: Line 50:
  
 <​code>​ <​code>​
-void *vm_map_cacheblock(u32_t dev, u64_t dev_offset,​ +void *vm_map_cacheblock(dev_t dev, off_t dev_offset,​ 
-        ​u64_t ino, u64_t ino_offset, u32_t *flags, int blocksize);+        ​ino_t ino, off_t ino_offset, u32_t *flags, int blocksize);
 </​code>​ </​code>​
  
Line 59: Line 60:
  
 <​code>​ <​code>​
-int vm_clear_cache(u32_t dev);+int vm_forget_cacheblock(dev_t dev, off_t dev_offset, int blocksize);​ 
 +</​code>​ 
 + 
 +This call requests that the block identified by the device number and offset be thrown out of the VM cache. Any previous inode association for this block is therefore broken as well. The call returns OK on success, even if no matching block was found. An error code is returned if the given parameter are invalid. 
 + 
 +<​code>​ 
 +int vm_clear_cache(dev_t dev);
 </​code>​ </​code>​
  
 This call requests that VM forget all blocks associated with the given device. This call should be used (directly or indirectly) by file systems when 1) they get a <fs small>​REQ_FLUSH</​fs>​ request from VFS, and 2) when they successfully unmount. This ensures that no stale blocks remain in VM, which could cause corruption upon recall later. This call requests that VM forget all blocks associated with the given device. This call should be used (directly or indirectly) by file systems when 1) they get a <fs small>​REQ_FLUSH</​fs>​ request from VFS, and 2) when they successfully unmount. This ensures that no stale blocks remain in VM, which could cause corruption upon recall later.
  
developersguide/vmcalls.1416329425.txt.gz · Last modified: 2015/09/19 16:44 (external edit)