Changeset 561 for trunk/kernel
- Timestamp:
- Sep 21, 2018, 10:26:47 PM (6 years ago)
- Location:
- trunk/kernel
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/fs/ramfs.c
r457 r561 38 38 xptr_t root_inode_xp; // unused 39 39 40 cxy_t cxy = vfs_cluster_random_select();40 cxy_t cxy = cluster_random_select(); 41 41 42 42 // create VFS dentry and VFS inode for RAMFS root directory -
trunk/kernel/fs/vfs.c
r530 r561 1124 1124 ////////////////////////////////////////////////////////////////////////////////////////// 1125 1125 1126 /////////////////////////////////1127 cxy_t vfs_cluster_random_select( void )1128 {1129 uint32_t x_max = LOCAL_CLUSTER->x_max; // [FIXME]1130 uint32_t y_max = LOCAL_CLUSTER->y_max; // [FIXME]1131 uint32_t y_width = LOCAL_CLUSTER->y_width;1132 uint32_t index = ( hal_get_cycles() + hal_get_gid() ) % (x_max * y_max); // [FIXME]1133 uint32_t x = index / y_max; // [FIXME]1134 uint32_t y = index % y_max; // [FIXME]1135 1136 return (x<<y_width) + y;1137 }1138 1139 1126 1140 1127 ////////////////////////////////////////////////////////////////////////// … … 1512 1499 1513 1500 // select a cluster for missing inode 1514 child_cxy = vfs_cluster_random_select();1501 child_cxy = cluster_random_select(); 1515 1502 1516 1503 // insert a new child dentry/inode in inode tree -
trunk/kernel/fs/vfs.h
r484 r561 517 517 518 518 /****************************************************************************************** 519 * This function randomly selects a cluster for a new inode.520 ******************************************************************************************521 * @ returns the selected cluster identifier.522 *****************************************************************************************/523 cxy_t vfs_cluster_random_select( void );524 525 /******************************************************************************************526 519 * This function returns in a kernel buffer allocated by the caller function, 527 520 * the pathname of a file/dir identified by an extended pointer on the inode. -
trunk/kernel/kern/cluster.c
r557 r561 45 45 #include <process.h> 46 46 #include <dqdt.h> 47 #include <cluster_info.h> 47 48 48 49 ///////////////////////////////////////////////////////////////////////////////////// … … 212 213 } // end cluster_init() 213 214 215 ///////////////////////////////// 216 cxy_t cluster_random_select( void ) 217 { 218 uint32_t x_size; 219 uint32_t y_size; 220 uint32_t y_width; 221 uint32_t index; 222 uint32_t x; 223 uint32_t y; 224 225 do { 226 x_size = LOCAL_CLUSTER->x_size; 227 y_size = LOCAL_CLUSTER->y_size; 228 y_width = LOCAL_CLUSTER->y_width; 229 index = ( hal_get_cycles() + hal_get_gid() ) % (x_size * y_size); 230 x = index / y_size; 231 y = index % y_size; 232 } while ( cluster_info_is_active( LOCAL_CLUSTER->cluster_info[x][y] ) == 0 ); 233 234 return (x<<y_width) + y; 235 } 236 214 237 //////////////////////////////////////// 215 238 bool_t cluster_is_undefined( cxy_t cxy ) -
trunk/kernel/kern/cluster.h
r557 r561 176 176 error_t cluster_init( boot_info_t * info ); 177 177 178 /****************************************************************************************** 179 * This function randomly selects a cluster. 180 ****************************************************************************************** 181 * @ returns the selected cluster identifier. 182 *****************************************************************************************/ 183 cxy_t cluster_random_select( void ); 184 178 185 /****************************************************************************************** 179 186 * This function checks the validity of a cluster identifier. -
trunk/kernel/kern/kernel_init.c
r560 r561 621 621 622 622 // compute target cluster for chdev[func,channel,direction] 623 uint32_t offset = ext_chdev_gid % ( info->x_size * (info->y_max) ); // [FIXME] 624 uint32_t cx = offset / (info->y_max); // [FIXME] 625 uint32_t cy = offset % (info->y_max); // [FIXME] 626 uint32_t target_cxy = (cx<<info->y_width) + cy; 627 623 uint32_t offset; 624 uint32_t cx; 625 uint32_t cy; 626 uint32_t target_cxy; 627 while (1) { 628 offset = ext_chdev_gid % ( info->x_size * (info->y_size) ); 629 cx = offset / (info->y_size); 630 cy = offset % (info->y_size); 631 target_cxy = (cx<<info->y_width) + cy; 632 // ext_chdev_gid that results in empty target clusters are skipped 633 if ( cluster_info_is_active( LOCAL_CLUSTER->cluster_info[cx][cy] ) == 0 ) { 634 ext_chdev_gid++; 635 } else { // The ext_chdev_gid resulted in a full target cluster 636 break; 637 } 638 } 628 639 // allocate and initialize a local chdev 629 640 // when local cluster matches target cluster -
trunk/kernel/mm/vmm.c
r530 r561 45 45 #include <kmem.h> 46 46 #include <vmm.h> 47 #include <cluster_info.h> 47 48 48 49 ////////////////////////////////////////////////////////////////////////////////// … … 1384 1385 if( flags & VSEG_DISTRIB ) // distributed => cxy depends on vpn LSB 1385 1386 { 1386 uint32_t x_ max = LOCAL_CLUSTER->x_max; // [FIXME]1387 uint32_t y_ max = LOCAL_CLUSTER->y_max; // [FIXME]1387 uint32_t x_size = LOCAL_CLUSTER->x_size; 1388 uint32_t y_size = LOCAL_CLUSTER->y_size; 1388 1389 uint32_t y_width = LOCAL_CLUSTER->y_width; 1389 uint32_t index = vpn & ((x_max * y_max) - 1); // [FIXME] 1390 uint32_t x = index / y_max; // [FIXME] 1391 uint32_t y = index % y_max; // [FIXME] 1392 page_cxy = (x<<y_width) + y; 1390 uint32_t index = vpn & ((x_size * y_size) - 1); 1391 uint32_t x = index / y_size; 1392 uint32_t y = index % y_size; 1393 1394 // If the cluster selected from VPN's LSBs is empty, then we select one randomly 1395 // cluster_random_select() ensures that its randomly selected cluster is not empty 1396 if ( cluster_info_is_active( LOCAL_CLUSTER->cluster_info[x][y] ) == 0 ) { 1397 cxy_t cxy = cluster_random_select(); 1398 x = ( ( cxy >> y_width ) & 0xF); 1399 y = ( cxy & 0xF ); 1400 } 1401 page_cxy = ( x << y_width ) + y; 1393 1402 } 1394 1403 else // other cases => cxy specified in vseg 1395 1404 { 1396 page_cxy 1405 page_cxy = vseg->cxy; 1397 1406 } 1398 1407
Note: See TracChangeset
for help on using the changeset viewer.