Changeset 433 for trunk/kernel/fs/vfs.c
- Timestamp:
- Feb 14, 2018, 3:40:19 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/fs/vfs.c
r430 r433 157 157 error_t error; 158 158 159 vfs_dmsg("\n[DBG] %s : core[%x,%d] enter / dentry = %x in cluster %x\n", 160 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, GET_PTR(dentry_xp), GET_CXY(dentry_xp) ); 159 #if CONFIG_DEBUG_VFS_INODE_CREATE 160 uint32_t cycle = (uint32_t)hal_get_cycles(); 161 if( CONFIG_DEBUG_VFS_INODE_CREATE < cycle ) 162 printk("\n[DBG] %s : thread %x enter / dentry = %x in cluster %x / cycle %d\n", 163 __FUNCTION__, CURRENT_THREAD, GET_PTR(dentry_xp), GET_CXY(dentry_xp), cycle ); 164 #endif 161 165 162 166 // check fs type and get pointer on context … … 230 234 remote_spinlock_init( XPTR( local_cxy , &inode->main_lock ) ); 231 235 232 vfs_dmsg("\n[DBG] %s : core[%x,%d] exit / inode = %x in cluster %x\n", 233 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, inode , local_cxy ); 236 #if CONFIG_DEBUG_VFS_INODE_CREATE 237 uint32_t cycle = (uint32_t)hal_get_cycles(); 238 if( CONFIG_DEBUG_VFS_INODE_CREATE < cycle ) 239 printk("\n[DBG] %s : thread %x exit / inode = %x in cluster %x / cycle %d\n", 240 __FUNCTION__, CURRENT_THREAD, inode, local_cxy, cycle ); 241 #endif 234 242 235 243 // return extended pointer on inode … … 263 271 xptr_t child_xp ) 264 272 { 265 vfs_dmsg("\n[DBG] %s : core[%x,%d] enter for <%s> / cycle %d\n", 266 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , name , hal_time_stamp() ); 273 274 #if CONFIG_DEBUG_VFS_INODE_LOAD 275 uint32_t cycle = (uint32_t)hal_get_cycles(); 276 if( CONFIG_DEBUG_VFS_INODE_LOAD < cycle ) 277 printk("\n[DBG] %s : thread %x enter for <%s> / cycle %d\n", 278 __FUNCTION__, CURRENT_THREAD , name , cycle ); 279 #endif 267 280 268 281 error_t error = 0; … … 293 306 } 294 307 295 vfs_dmsg("\n[DBG] %s : core[%x,%d] exit for <%s> / cycle %d\n", 296 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , name , hal_time_stamp() ); 308 #if CONFIG_DEBUG_VFS_INODE_LOAD 309 cycle = (uint32_t)hal_get_cycles(); 310 if( CONFIG_DEBUG_VFS_INODE_LOAD < cycle ) 311 printk("\n[DBG] %s : thread %x exit for <%s> / cycle %d\n", 312 __FUNCTION__, CURRENT_THREAD , name , cycle ); 313 #endif 297 314 298 315 return error; … … 416 433 kmem_req_t req; // request to kernel memory allocator 417 434 418 vfs_dmsg("\n[DBG] %s : core[%x,%d] enter for <%s> / parent inode = %x / cycle %d\n", 419 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, name, parent, hal_time_stamp() ); 435 #if CONFIG_DEBUG_VFS_DENTRY_CREATE 436 uint32_t cycle = (uint32_t)hal_get_cycles(); 437 if( CONFIG_DEBUG_VFS_DENTRY_CREATE < cycle ) 438 printk("\n[DBG] %s : thread %x enter for <%s> / parent_inode %x / cycle %d\n", 439 __FUNCTION__, CURRENT_THREAD , name , parent , cycle ); 440 #endif 420 441 421 442 // get pointer on context … … 465 486 *dentry_xp = XPTR( local_cxy , dentry ); 466 487 467 vfs_dmsg("\n[DBG] %s : core[%x,%d] exit for <%s> / dentry = %x in cluster %x / cycle %d\n", 468 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, name, dentry, local_cxy , hal_time_stamp() ); 488 #if CONFIG_DEBUG_VFS_DENTRY_CREATE 489 cycle = (uint32_t)hal_get_cycles(); 490 if( CONFIG_DEBUG_VFS_DENTRY_CREATE < cycle ) 491 printk("\n[DBG] %s : thread %x exit for <%s> / dentry %x / cycle %d\n", 492 __FUNCTION__, CURRENT_THREAD , name , dentry , cycle ); 493 #endif 469 494 470 495 return 0; … … 584 609 uint32_t file_id; // created file descriptor index in reference fd_array 585 610 586 vfs_dmsg("\n[DBG] %s : core[%x,%d] enter for <%s> / cycle %d\n", 587 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, path, (uint32_t)hal_time_stamp() ); 611 #if CONFIG_DEBUG_VFS_OPEN 612 uint32_t cycle = (uint32_t)hal_get_cycles(); 613 if( CONFIG_DEBUG_VFS_OPEN < cycle ) 614 printk("\n[DBG] %s : thread %x enter for <%s> / cycle %d\n", 615 __FUNCTION__, CURRENT_THREAD, path, cycle ); 616 #endif 588 617 589 618 // compute lookup working mode … … 610 639 inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp ); 611 640 612 vfs_dmsg("\n[DBG] %s : core[%x,%d] found inode for <%s> in cluster %x / cycle %d\n",613 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, path, inode_cxy , (uint32_t)hal_time_stamp() );614 615 641 // create a new file descriptor in cluster containing inode 616 642 if( inode_cxy == local_cxy ) // target cluster is local … … 630 656 if( error ) return error; 631 657 632 vfs_dmsg("\n[DBG] %s : core[%x,%d] exit for <%s> / file = %x in cluster %x / cycle %d\n", 633 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, path, 634 GET_PTR(file_xp), GET_CXY(file_xp), hal_time_stamp() ); 658 #if CONFIG_DEBUG_VFS_OPEN 659 cycle = (uint32_t)hal_get_cycles(); 660 if( CONFIG_DEBUG_VFS_OPEN < cycle ) 661 printk("\n[DBG] %s : thread %x exit for <%s> / file %x in cluster %x / cycle %d\n", 662 __FUNCTION__, CURRENT_THREAD, path, GET_PTR(file_xp), GET_CXY(file_xp), cycle ); 663 #endif 635 664 636 665 // success … … 647 676 uint32_t size ) 648 677 { 649 assert( ( file_xp != XPTR_NULL ) , __FUNCTION__ , 650 "file_xp == XPTR_NULL" ); 678 assert( ( file_xp != XPTR_NULL ) , __FUNCTION__ , "file_xp == XPTR_NULL" ); 651 679 652 680 cxy_t file_cxy; // remote file descriptor cluster … … 1319 1347 process = this->process; 1320 1348 1321 vfs_dmsg("\n[DBG] %s : core[%x,%d] enter for <%s> / cycle %d\n", 1322 __FUNCTION__ , local_cxy , this->core->lid , pathname , hal_time_stamp() ); 1349 #if CONFIG_DEBUG_VFS_LOOKUP 1350 uint32_t cycle = (uint32_t)hal_get_cycles(); 1351 if( CONFIG_DEBUG_VFS_LOOKUP < cycle ) 1352 printk("\n[DBG] %s : thread %x enter for <%s> / cycle %d\n", 1353 __FUNCTION__, CURRENT_THREAD, path, cycle ); 1354 #endif 1323 1355 1324 1356 // get extended pointer on first inode to search … … 1343 1375 vfs_get_name_from_path( current , name , &next , &last ); 1344 1376 1345 vfs_dmsg("\n[DBG] %s : core[%x,%d] look for <%s> / last = %d\n", 1346 __FUNCTION__ , local_cxy , this->core->lid , name , last ); 1377 #if (CONFIG_DEBUG_VFS_LOOKUP & 1) 1378 if( CONFIG_DEBUG_VFS_LOOKUP < cycle ) 1379 printk("\n[DBG] %s : look for <%s> / last = %d\n", __FUNCTION__ , name , last ); 1380 #endif 1347 1381 1348 1382 // search a child dentry matching name in parent inode … … 1362 1396 { 1363 1397 1364 vfs_dmsg("\n[DBG] %s : core[%x,%d] miss <%s> => load it\n", 1365 __FUNCTION__ , local_cxy , this->core->lid , name ); 1398 #if (CONFIG_DEBUG_VFS_LOOKUP & 1) 1399 if( CONFIG_DEBUG_VFS_LOOKUP < cycle ) 1400 printk("\n[DBG] %s : miss <%s> => load it\n", __FUNCTION__ , name ); 1401 #endif 1366 1402 1367 1403 // release lock on parent inode … … 1446 1482 vfs_inode_lock( parent_xp ); 1447 1483 1448 vfs_dmsg("\n[DBG] %s : core[%x,%d] created node <%s>\n", 1449 __FUNCTION__ , local_cxy , this->core->lid , name ); 1484 #if (CONFIG_DEBUG_VFS_LOOKUP & 1) 1485 if( CONFIG_DEBUG_VFS_LOOKUP < cycle ) 1486 printk("\n[DBG] %s : created node <%s>\n", __FUNCTION__ , name ); 1487 #endif 1450 1488 1451 1489 } 1452 1490 1453 vfs_dmsg("\n[DBG] %s : core[%x,%d] found <%s> / inode = %x in cluster %x\n", 1454 __FUNCTION__ , local_cxy , this->core->lid , name , GET_PTR(child_xp) , GET_CXY(child_xp) ); 1491 #if (CONFIG_DEBUG_VFS_LOOKUP & 1) 1492 if( CONFIG_DEBUG_VFS_LOOKUP < cycle ) 1493 printk("\n[DBG] %s : found <%s> / inode %x in cluster %x\n", 1494 __FUNCTION__ , name , GET_PTR(child_xp) , GET_CXY(child_xp) ); 1495 #endif 1455 1496 1456 1497 // TODO check access rights here [AG] … … 1477 1518 vfs_inode_unlock( parent_xp ); 1478 1519 1479 vfs_dmsg("\n[DBG] %s : core[%x,%d] exit for <%s> / inode = %x in cluster %x\n", 1480 __FUNCTION__,local_cxy,this->core->lid,pathname,GET_PTR(child_xp),GET_CXY(child_xp) ); 1520 #if CONFIG_DEBUG_VFS_LOOKUP 1521 cycle = (uint32_t)hal_get_cycles(); 1522 if( CONFIG_DEBUG_VFS_LOOKUP < cycle ) 1523 printk("\n[DBG] %s : thread %x exit for <%s> / inode %x in cluster %x / cycle %d\n", 1524 __FUNCTION__, CURRENT_THREAD, path, GET_PTR(child_xp), GET_CXY(child_xp), cycle ); 1525 #endif 1481 1526 1482 1527 // return searched pointer … … 1502 1547 // we use two variables "index" and "count" because the buffer 1503 1548 // is written in decreasing index order (from leaf to root) 1504 // TODO : handle conflict with a concurrent rename [AG]1505 // TODO: handle synchro in the loop [AG]1549 // TODO : handle conflict with a concurrent rename [AG] 1550 // FIXME : handle synchro in the loop [AG] 1506 1551 1507 1552 // set the NUL character in buffer / initialise buffer index and count … … 1576 1621 parent_ptr = (vfs_inode_t *)GET_PTR( parent_xp ); 1577 1622 1578 vfs_dmsg("\n[DBG] %s : core[%x,%d] enter for <%s> / child_cxy = %x / parent_cxy = %x\n", 1579 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , name , child_cxy , parent_cxy ); 1623 #if CONFIG_DEBUG_VFS_ADD_CHILD 1624 uint32_t cycle = (uint32_t)hal_get_cycles(); 1625 if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle ) 1626 printk("\n[DBG] %s : thread %x enter for <%s> / child_cxy = %x / parent_cxy = %x\n", 1627 __FUNCTION__ , CURRENT_THREAD , name , child_cxy , parent_cxy ); 1628 #endif 1580 1629 1581 1630 // 1. create dentry … … 1587 1636 &dentry_xp ); 1588 1637 1589 vfs_dmsg("\n[DBG] %s : dentry <%s> created in local cluster %x\n", 1590 __FUNCTION__ , name , local_cxy ); 1638 #if (CONFIG_DEBUG_VFS_ADD_CHILD & 1) 1639 if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle ) 1640 printk("\n[DBG] %s : dentry <%s> created in cluster %x\n", __FUNCTION__, name, local_cxy ); 1641 #endif 1591 1642 1592 1643 } … … 1600 1651 &error ); 1601 1652 1602 vfs_dmsg("\n[DBG] %s : dentry <%s> created in remote cluster %x\n", 1603 __FUNCTION__ , name , parent_cxy ); 1653 #if (CONFIG_DEBUG_VFS_ADD_CHILD & 1) 1654 if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle ) 1655 printk("\n[DBG] %s : dentry <%s> created in cluster %x\n", __FUNCTION__, name, parent_cxy ); 1656 #endif 1604 1657 1605 1658 } … … 1629 1682 gid, 1630 1683 &inode_xp ); 1684 1685 #if (CONFIG_DEBUG_VFS_ADD_CHILD & 1) 1686 if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle ) 1687 printk("\n[DBG] %s : inode <%x> created in cluster %x\n", 1688 __FUNCTION__ , GET_PTR(inode_xp) , local_cxy ); 1689 #endif 1631 1690 1632 1691 vfs_dmsg("\n[DBG] %s : inode %x created in local cluster %x\n", … … 1648 1707 &error ); 1649 1708 1650 vfs_dmsg("\n[DBG] %s : inode %x created in remote cluster %x\n", 1709 #if (CONFIG_DEBUG_VFS_ADD_CHILD & 1) 1710 if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle ) 1711 printk("\n[DBG] %s : inode <%s> created in cluster %x\n", 1651 1712 __FUNCTION__ , GET_PTR(inode_xp) , child_cxy ); 1713 #endif 1652 1714 1653 1715 } … … 1669 1731 hal_remote_swd( XPTR( dentry_cxy , &dentry_ptr->child_xp ) , inode_xp ); 1670 1732 1671 vfs_dmsg("\n[DBG] %s : exit in cluster %x for <%s>\n", 1672 __FUNCTION__ , local_cxy , name ); 1733 #if CONFIG_DEBUG_VFS_ADD_CHILD 1734 cycle = (uint32_t)hal_get_cycles(); 1735 if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle ) 1736 printk("\n[DBG] %s : thread %x exit for <%s>\n", 1737 __FUNCTION__ , CURRENT_THREAD , name ); 1738 #endif 1673 1739 1674 1740 // success : return extended pointer on child inode … … 1694 1760 assert( (mapper != NULL) , __FUNCTION__ , "no mapper for page\n" ); 1695 1761 1696 vfs_dmsg("\n[DBG] %s : core[%x,%d] enters for page %d / mapper = %x / inode = %x\n", 1697 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid , page->index , mapper, mapper->inode ); 1762 #if CONFIG_DEBUG_VFS_MAPPER_MOVE 1763 uint32_t cycle = (uint32_t)hal_get_cycles(); 1764 if( CONFIG_DEBUG_VFS_MAPPER_MOVE < cycle ) 1765 printk("\n[DBG] %s : thread %x enter for page %d / mapper %x / inode %x / cycle %d\n", 1766 __FUNCTION__, CURRENT_THREAD, page->index, mapper, mapper->inode, cycle ); 1767 #endif 1698 1768 1699 1769 // get FS type … … 1720 1790 } 1721 1791 1722 vfs_dmsg("\n[DBG] %s : core[%x,%d] exit for page %d / mapper = %x / inode = %x\n", 1723 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, page->index, mapper, mapper->inode ); 1792 #if CONFIG_DEBUG_VFS_MAPPER_MOVE 1793 cycle = (uint32_t)hal_get_cycles(); 1794 if( CONFIG_DEBUG_VFS_MAPPER_MOVE < cycle ) 1795 printk("\n[DBG] %s : thread %x exit for page %d / mapper %x / inode %x / cycle %d\n", 1796 __FUNCTION__, CURRENT_THREAD, page->index, mapper, mapper->inode, cycle ); 1797 #endif 1724 1798 1725 1799 return error; … … 1740 1814 assert( (mapper != NULL) , __FUNCTION__ , "mapper pointer is NULL\n" ); 1741 1815 1742 vfs_dmsg("\n[DBG] %s : core[%x,%d] enter for inode %x in cluster %x/ cycle %d\n", 1743 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, inode , local_cxy , hal_time_stamp() ); 1816 #if CONFIG_DEBUG_VFS_MAPPER_LOAD 1817 uint32_t cycle = (uint32_t)hal_get_cycles(); 1818 if( CONFIG_DEBUG_VFS_MAPPER_MOVE < cycle ) 1819 printk("\n[DBG] %s : thread %x enter for inode %x in cluster %x / cycle %d\n", 1820 __FUNCTION__, CURRENT_THREAD, inode, local_cxy, cycle ); 1821 #endif 1744 1822 1745 1823 // compute number of pages … … 1757 1835 } 1758 1836 1759 vfs_dmsg("\n[DBG] %s : core[%x,%d] exit for inode %x in cluster %x / cycle %d\n", 1760 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, inode , local_cxy , hal_time_stamp() ); 1837 #if CONFIG_DEBUG_VFS_MAPPER_LOAD 1838 cycle = (uint32_t)hal_get_cycles(); 1839 if( CONFIG_DEBUG_VFS_MAPPER_MOVE < cycle ) 1840 printk("\n[DBG] %s : thread %x exit for inode %x in cluster %x / cycle %d\n", 1841 __FUNCTION__, CURRENT_THREAD, inode, local_cxy, cycle ); 1842 #endif 1761 1843 1762 1844 return 0;
Note: See TracChangeset
for help on using the changeset viewer.