Changeset 657 for trunk/kernel/mm/mapper.h
- Timestamp:
- Mar 18, 2020, 11:16:59 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/mapper.h
r656 r657 61 61 * - In the present implementation the cache size for a given file increases on demand, 62 62 * and the allocated memory is only released when the mapper/inode is destroyed. 63 *64 * TODO the "type" field in mapper descriptor is redundant and probably unused.65 63 ******************************************************************************************/ 66 64 … … 73 71 { 74 72 struct vfs_inode_s * inode; /*! owner inode */ 75 uint32_t type;/*! file system type */73 uint32_t fs_type; /*! file system type */ 76 74 grdxt_t rt; /*! embedded pages cache descriptor (radix tree) */ 77 75 remote_rwlock_t lock; /*! several readers / only one writer */ … … 84 82 85 83 /******************************************************************************************* 86 * This function allocates physical memory for a mapper descriptor, and initializes it 87 * (refcount <= 0) / inode <= NULL). 88 * It must be executed by a thread running in the cluster containing the mapper. 89 ******************************************************************************************* 90 * @ type : type of the mapper to create. 91 * @ return : pointer on created mapper if success / return NULL if no memory 92 ******************************************************************************************/ 93 mapper_t * mapper_create( vfs_fs_type_t type ); 94 95 /******************************************************************************************* 96 * This function releases all physical memory allocated for a mapper. 97 * Both the mapper descriptor and the radix tree are released. 84 * This function allocates physical memory for a mapper descriptor, in cluster 85 * identified by the <cxy> argument. It initializes it (refcount <= 0) / inode <= NULL). 86 * It can be executed by any thread running in any cluster. 87 ******************************************************************************************* 88 * @ cxy : target cluster identifier. 89 * @ type : FS type. 90 * @ return an extended pointer on created mapper if success / return NULL if no memory 91 ******************************************************************************************/ 92 xptr_t mapper_create( cxy_t cxy, 93 uint32_t type ); 94 95 /******************************************************************************************* 96 * This function releases all physical memory allocated for a mapper, identified 97 * by the <mapper_xp> argument. Both the mapper descriptor and the radix tree are released. 98 98 * It does NOT synchronize dirty pages. Use the vfs_sync_inode() function if required. 99 * It must be executed by a thread running in the cluster containing the mapper.100 ******************************************************************************************* 101 * @ mapper :target mapper.102 ******************************************************************************************/ 103 void mapper_destroy( mapper_t * mapper);99 * It can be executed by any thread running in any cluster. 100 ******************************************************************************************* 101 * @ mapper_xp : extended pointer on target mapper. 102 ******************************************************************************************/ 103 void mapper_destroy( xptr_t mapper_xp ); 104 104 105 105 /******************************************************************************************* … … 117 117 * @ return 0 if success / return -1 if IOC cannot be accessed. 118 118 ******************************************************************************************/ 119 error_t mapper_ remote_handle_miss( xptr_t mapper_xp,120 121 119 error_t mapper_handle_miss( xptr_t mapper_xp, 120 uint32_t page_id, 121 xptr_t * page_xp ); 122 122 123 123 /******************************************************************************************* … … 180 180 181 181 /******************************************************************************************* 182 * This function returns an extended pointer on a page descriptor .183 * The - possibly remote - mapper isidentified by the <mapper_xp> argument.182 * This function returns an extended pointer on a page descriptor for a regular mapper 183 * (i.e. this mapper is NOT the FAT mapper), identified by the <mapper_xp> argument. 184 184 * The page is identified by <page_id> argument (page index in the file). 185 185 * It can be executed by a thread running in any cluster, as it uses remote … … 193 193 * @ returns extended pointer on page descriptor if success / return XPTR_NULL if error. 194 194 ******************************************************************************************/ 195 xptr_t mapper_remote_get_page( xptr_t mapper_xp, 196 uint32_t page_id ); 195 xptr_t mapper_get_page( xptr_t mapper_xp, 196 uint32_t page_id ); 197 198 /******************************************************************************************* 199 * This function returns an extended pointer on a page descriptor for the FAT mapper. 200 * The page is identified by <page_id> argument (page index in the FAT mapper). 201 * It can be executed by a thread running in any cluster, as it uses remote 202 * access primitives to scan the mapper. 203 * In case of miss, this function takes the mapper lock in WRITE_MODE, and call the 204 * mapper_handle_miss() to load the missing page from device to mapper, using an RPC 205 * when the mapper is remote. 206 ******************************************************************************************* 207 * @ mapper_xp : extended pointer on the mapper. 208 * @ page_id : page index in file 209 * @ returns extended pointer on page descriptor if success / return XPTR_NULL if error. 210 ******************************************************************************************/ 211 xptr_t mapper_get_fat_page( xptr_t mapper_xp, 212 uint32_t page_id ); 197 213 198 214 /******************************************************************************************* … … 234 250 235 251 /******************************************************************************************* 236 * This function scan all pages present in the mapper identified by the <mapper > argument,237 * a nd synchronize all pages marked as "dirty" on disk.252 * This function scan all pages present in the mapper identified by the <mapper_xp> 253 * argument, and synchronize all pages marked as "dirty" on disk. 238 254 * These pages are unmarked and removed from the local PPM dirty_list. 239 * This function must be called by a local thread running in same cluster as the mapper. 240 * A remote thread must call the RPC_MAPPER_SYNC function. 241 ******************************************************************************************* 242 * @ mapper : [in] local pointer on local mapper. 243 * @ returns 0 if success / return -1 if error. 244 ******************************************************************************************/ 245 error_t mapper_sync( mapper_t * mapper ); 255 * It can be called by any thread running in any cluster. 256 ******************************************************************************************* 257 * @ mapper_xp : [in] extended pointer on local mapper. 258 * @ returns 0 if success / return -1 if error. 259 ******************************************************************************************/ 260 error_t mapper_sync( xptr_t mapper_xp ); 246 261 247 262 /******************************************************************************************* 248 263 * This debug function displays the content of a given page of a given mapper, identified 249 * by the <mapper_xp> and <page_ xp> arguments.264 * by the <mapper_xp> and <page_id> arguments. 250 265 * The number of bytes to display in page is defined by the <nbytes> argument. 251 266 * The format is eigth (32 bits) words per line in hexadecimal. … … 253 268 ******************************************************************************************* 254 269 * @ mapper_xp : [in] extended pointer on the mapper. 255 * @ page_ xp : [in] extended pointer on page descriptor.270 * @ page_id : [in] page_index in mapper. 256 271 * @ nbytes : [in] number of bytes in page. 257 272 * @ returns 0 if success / return -1 if error. 258 273 ******************************************************************************************/ 259 274 void mapper_display_page( xptr_t mapper_xp, 260 xptr_t page_xp,275 uint32_t page_id, 261 276 uint32_t nbytes ); 262 277
Note: See TracChangeset
for help on using the changeset viewer.