Changeset 438 for trunk/kernel/fs/vfs.c


Ignore:
Timestamp:
Apr 4, 2018, 2:49:02 PM (4 years ago)
Author:
alain
Message:

Fix a bug in scheduler related to RPC blocking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/fs/vfs.c

    r437 r438  
    157157    error_t            error;
    158158
    159 #if CONFIG_DEBUG_VFS_INODE_CREATE
     159#if DEBUG_VFS_INODE_CREATE
    160160uint32_t cycle = (uint32_t)hal_get_cycles();
    161 if( CONFIG_DEBUG_VFS_INODE_CREATE < cycle )
     161if( DEBUG_VFS_INODE_CREATE < cycle )
    162162printk("\n[DBG] %s : thread %x enter / dentry = %x in cluster %x / cycle %d\n",
    163163__FUNCTION__, CURRENT_THREAD, GET_PTR(dentry_xp), GET_CXY(dentry_xp), cycle );
     
    234234    remote_spinlock_init( XPTR( local_cxy , &inode->main_lock ) );
    235235
    236 #if CONFIG_DEBUG_VFS_INODE_CREATE
     236#if DEBUG_VFS_INODE_CREATE
    237237cycle = (uint32_t)hal_get_cycles();
    238 if( CONFIG_DEBUG_VFS_INODE_CREATE < cycle )
     238if( DEBUG_VFS_INODE_CREATE < cycle )
    239239printk("\n[DBG] %s : thread %x exit / inode = %x in cluster %x / cycle %d\n",
    240240__FUNCTION__, CURRENT_THREAD, inode, local_cxy, cycle );
     
    272272{
    273273
    274 #if CONFIG_DEBUG_VFS_INODE_LOAD
     274#if DEBUG_VFS_INODE_LOAD
    275275uint32_t cycle = (uint32_t)hal_get_cycles();
    276 if( CONFIG_DEBUG_VFS_INODE_LOAD < cycle )
     276if( DEBUG_VFS_INODE_LOAD < cycle )
    277277printk("\n[DBG] %s : thread %x enter for <%s> / cycle %d\n",
    278278__FUNCTION__, CURRENT_THREAD , name , cycle );
     
    306306    }
    307307
    308 #if CONFIG_DEBUG_VFS_INODE_LOAD
     308#if DEBUG_VFS_INODE_LOAD
    309309cycle = (uint32_t)hal_get_cycles();
    310 if( CONFIG_DEBUG_VFS_INODE_LOAD < cycle )
     310if( DEBUG_VFS_INODE_LOAD < cycle )
    311311printk("\n[DBG] %s : thread %x exit for <%s> / cycle %d\n",
    312312__FUNCTION__, CURRENT_THREAD , name , cycle );
     
    433433        kmem_req_t       req;        // request to kernel memory allocator
    434434
    435 #if CONFIG_DEBUG_VFS_DENTRY_CREATE
     435#if DEBUG_VFS_DENTRY_CREATE
    436436uint32_t cycle = (uint32_t)hal_get_cycles();
    437 if( CONFIG_DEBUG_VFS_DENTRY_CREATE < cycle )
     437if( DEBUG_VFS_DENTRY_CREATE < cycle )
    438438printk("\n[DBG] %s : thread %x enter for <%s> / parent_inode %x / cycle %d\n",
    439439__FUNCTION__, CURRENT_THREAD , name , parent , cycle );
     
    456456    {
    457457
    458 #if CONFIG_DEBUG_SYSCALLS_ERROR
     458#if DEBUG_SYSCALLS_ERROR
    459459printk("\n[ERROR] in %s : name <name> too long\n", __FUNCTION__ , name );
    460460#endif
     
    471471    {
    472472
    473 #if CONFIG_DEBUG_SYSCALLS_ERROR
     473#if DEBUG_SYSCALLS_ERROR
    474474printk("\n[ERROR] in %s : cannot allocate dentry\n", __FUNCTION__ );
    475475#endif
     
    484484    strcpy( dentry->name , name );
    485485
    486 #if( CONFIG_DEBUG_VFS_DENTRY_CREATE & 1 )
     486#if( DEBUG_VFS_DENTRY_CREATE & 1 )
    487487cycle = (uint32_t)hal_get_cycles();
    488 if( CONFIG_DEBUG_VFS_DENTRY_CREATE < cycle )
     488if( DEBUG_VFS_DENTRY_CREATE < cycle )
    489489printk("\n[DBG] %s : dentry initialised\n", __FUNCTION__ );
    490490#endif
     
    495495                  XPTR( local_cxy , &dentry->list ) );
    496496
    497 #if( CONFIG_DEBUG_VFS_DENTRY_CREATE & 1 )
     497#if( DEBUG_VFS_DENTRY_CREATE & 1 )
    498498cycle = (uint32_t)hal_get_cycles();
    499 if( CONFIG_DEBUG_VFS_DENTRY_CREATE < cycle )
     499if( DEBUG_VFS_DENTRY_CREATE < cycle )
    500500printk("\n[DBG] %s : dentry registerd in htab\n", __FUNCTION__ );
    501501#endif
     
    504504    *dentry_xp = XPTR( local_cxy , dentry );
    505505
    506 #if CONFIG_DEBUG_VFS_DENTRY_CREATE
     506#if DEBUG_VFS_DENTRY_CREATE
    507507cycle = (uint32_t)hal_get_cycles();
    508 if( CONFIG_DEBUG_VFS_DENTRY_CREATE < cycle )
     508if( DEBUG_VFS_DENTRY_CREATE < cycle )
    509509printk("\n[DBG] %s : thread %x exit for <%s> / dentry %x / cycle %d\n",
    510510__FUNCTION__, CURRENT_THREAD , name , dentry , cycle );
     
    627627    uint32_t      file_id;      // created file descriptor index in reference fd_array
    628628
    629 #if CONFIG_DEBUG_VFS_OPEN
     629#if DEBUG_VFS_OPEN
    630630uint32_t cycle = (uint32_t)hal_get_cycles();
    631 if( CONFIG_DEBUG_VFS_OPEN < cycle )
     631if( DEBUG_VFS_OPEN < cycle )
    632632printk("\n[DBG] %s :  thread %x enter for <%s> / cycle %d\n",
    633633__FUNCTION__, CURRENT_THREAD, path, cycle );
     
    674674    if( error ) return error;
    675675
    676 #if CONFIG_DEBUG_VFS_OPEN
     676#if DEBUG_VFS_OPEN
    677677cycle = (uint32_t)hal_get_cycles();
    678 if( CONFIG_DEBUG_VFS_OPEN < cycle )
     678if( DEBUG_VFS_OPEN < cycle )
    679679printk("\n[DBG] %s : thread %x exit for <%s> / file %x in cluster %x / cycle %d\n",
    680680__FUNCTION__, CURRENT_THREAD, path, GET_PTR(file_xp), GET_CXY(file_xp), cycle );
     
    13651365    process = this->process;
    13661366
    1367 #if CONFIG_DEBUG_VFS_LOOKUP
     1367#if DEBUG_VFS_LOOKUP
    13681368uint32_t cycle = (uint32_t)hal_get_cycles();
    1369 if( CONFIG_DEBUG_VFS_LOOKUP < cycle )
     1369if( DEBUG_VFS_LOOKUP < cycle )
    13701370printk("\n[DBG] %s : thread %x enter for <%s> / cycle %d\n",
    13711371__FUNCTION__, CURRENT_THREAD, pathname, cycle );
     
    13931393        vfs_get_name_from_path( current , name , &next , &last );
    13941394
    1395 #if (CONFIG_DEBUG_VFS_LOOKUP & 1)
    1396 if( CONFIG_DEBUG_VFS_LOOKUP < cycle )
     1395#if (DEBUG_VFS_LOOKUP & 1)
     1396if( DEBUG_VFS_LOOKUP < cycle )
    13971397printk("\n[DBG] %s : look for <%s> / last = %d\n", __FUNCTION__ , name , last );
    13981398#endif
     
    14141414        {
    14151415
    1416 #if (CONFIG_DEBUG_VFS_LOOKUP & 1)
    1417 if( CONFIG_DEBUG_VFS_LOOKUP < cycle )
     1416#if (DEBUG_VFS_LOOKUP & 1)
     1417if( DEBUG_VFS_LOOKUP < cycle )
    14181418printk("\n[DBG] %s : miss <%s> => load it\n", __FUNCTION__ , name );
    14191419#endif
     
    15001500            vfs_inode_lock( parent_xp );
    15011501
    1502 #if (CONFIG_DEBUG_VFS_LOOKUP & 1)
    1503 if( CONFIG_DEBUG_VFS_LOOKUP < cycle )
     1502#if (DEBUG_VFS_LOOKUP & 1)
     1503if( DEBUG_VFS_LOOKUP < cycle )
    15041504printk("\n[DBG] %s : created node <%s>\n", __FUNCTION__ , name );
    15051505#endif
     
    15071507        }
    15081508
    1509 #if (CONFIG_DEBUG_VFS_LOOKUP & 1)
    1510 if( CONFIG_DEBUG_VFS_LOOKUP < cycle )
     1509#if (DEBUG_VFS_LOOKUP & 1)
     1510if( DEBUG_VFS_LOOKUP < cycle )
    15111511printk("\n[DBG] %s : found <%s> / inode %x in cluster %x\n",
    15121512__FUNCTION__ , name , GET_PTR(child_xp) , GET_CXY(child_xp) );
     
    15361536    vfs_inode_unlock( parent_xp );
    15371537
    1538 #if CONFIG_DEBUG_VFS_LOOKUP
     1538#if DEBUG_VFS_LOOKUP
    15391539cycle = (uint32_t)hal_get_cycles();
    1540 if( CONFIG_DEBUG_VFS_LOOKUP < cycle )
     1540if( DEBUG_VFS_LOOKUP < cycle )
    15411541printk("\n[DBG] %s : thread %x exit for <%s> / inode %x in cluster %x / cycle %d\n",
    15421542__FUNCTION__, CURRENT_THREAD, pathname, GET_PTR(child_xp), GET_CXY(child_xp), cycle );
     
    16391639    parent_ptr = (vfs_inode_t *)GET_PTR( parent_xp );
    16401640
    1641 #if CONFIG_DEBUG_VFS_ADD_CHILD
     1641#if DEBUG_VFS_ADD_CHILD
    16421642uint32_t cycle = (uint32_t)hal_get_cycles();
    1643 if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle )
     1643if( DEBUG_VFS_ADD_CHILD < cycle )
    16441644printk("\n[DBG] %s : thread %x enter for <%s> / child_cxy = %x / parent_cxy = %x\n",
    16451645__FUNCTION__ , CURRENT_THREAD , name , child_cxy , parent_cxy );
     
    16541654                                   &dentry_xp );
    16551655
    1656 #if (CONFIG_DEBUG_VFS_ADD_CHILD & 1)
    1657 if( (CONFIG_DEBUG_VFS_ADD_CHILD < cycle) && (error == 0) )
     1656#if (DEBUG_VFS_ADD_CHILD & 1)
     1657if( (DEBUG_VFS_ADD_CHILD < cycle) && (error == 0) )
    16581658printk("\n[DBG] %s : dentry <%s> created in cluster %x\n", __FUNCTION__, name, local_cxy );
    16591659#endif
     
    16691669                                      &error );
    16701670
    1671 #if (CONFIG_DEBUG_VFS_ADD_CHILD & 1)
    1672 if( (CONFIG_DEBUG_VFS_ADD_CHILD < cycle) && (error == 0) )
     1671#if (DEBUG_VFS_ADD_CHILD & 1)
     1672if( (DEBUG_VFS_ADD_CHILD < cycle) && (error == 0) )
    16731673printk("\n[DBG] %s : dentry <%s> created in cluster %x\n", __FUNCTION__, name, parent_cxy );
    16741674#endif
     
    17011701                                  &inode_xp );
    17021702
    1703 #if (CONFIG_DEBUG_VFS_ADD_CHILD & 1)
    1704 if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle )
     1703#if (DEBUG_VFS_ADD_CHILD & 1)
     1704if( DEBUG_VFS_ADD_CHILD < cycle )
    17051705printk("\n[DBG] %s : inode <%x> created in cluster %x\n",
    17061706__FUNCTION__ , GET_PTR(inode_xp) , local_cxy );
     
    17221722                                     &error );
    17231723
    1724 #if (CONFIG_DEBUG_VFS_ADD_CHILD & 1)
    1725 if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle )
     1724#if (DEBUG_VFS_ADD_CHILD & 1)
     1725if( DEBUG_VFS_ADD_CHILD < cycle )
    17261726printk("\n[DBG] %s : inode <%s> created in cluster %x\n",
    17271727__FUNCTION__ , GET_PTR(inode_xp) , child_cxy );
     
    17461746    hal_remote_swd( XPTR( dentry_cxy , &dentry_ptr->child_xp ) , inode_xp );
    17471747
    1748 #if CONFIG_DEBUG_VFS_ADD_CHILD
     1748#if DEBUG_VFS_ADD_CHILD
    17491749cycle = (uint32_t)hal_get_cycles();
    1750 if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle )
     1750if( DEBUG_VFS_ADD_CHILD < cycle )
    17511751printk("\n[DBG] %s : thread %x exit for <%s>\n",
    17521752__FUNCTION__ , CURRENT_THREAD , name );
     
    17751775    assert( (mapper != NULL) , __FUNCTION__ , "no mapper for page\n" );
    17761776
    1777 #if CONFIG_DEBUG_VFS_MAPPER_MOVE
     1777#if DEBUG_VFS_MAPPER_MOVE
    17781778uint32_t cycle = (uint32_t)hal_get_cycles();
    1779 if( CONFIG_DEBUG_VFS_MAPPER_MOVE < cycle )
     1779if( DEBUG_VFS_MAPPER_MOVE < cycle )
    17801780printk("\n[DBG] %s : thread %x enter for page %d / mapper %x / inode %x / cycle %d\n",
    17811781__FUNCTION__, CURRENT_THREAD, page->index, mapper, mapper->inode, cycle );
     
    18051805    }
    18061806
    1807 #if CONFIG_DEBUG_VFS_MAPPER_MOVE
     1807#if DEBUG_VFS_MAPPER_MOVE
    18081808cycle = (uint32_t)hal_get_cycles();
    1809 if( CONFIG_DEBUG_VFS_MAPPER_MOVE < cycle )
     1809if( DEBUG_VFS_MAPPER_MOVE < cycle )
    18101810printk("\n[DBG] %s : thread %x exit for page %d / mapper %x / inode %x / cycle %d\n",
    18111811__FUNCTION__, CURRENT_THREAD, page->index, mapper, mapper->inode, cycle );
     
    18291829    assert( (mapper != NULL) , __FUNCTION__ , "mapper pointer is NULL\n" );
    18301830
    1831 #if CONFIG_DEBUG_VFS_MAPPER_LOAD
     1831#if DEBUG_VFS_MAPPER_LOAD
    18321832uint32_t cycle = (uint32_t)hal_get_cycles();
    1833 if( CONFIG_DEBUG_VFS_MAPPER_MOVE < cycle )
     1833if( DEBUG_VFS_MAPPER_MOVE < cycle )
    18341834printk("\n[DBG] %s : thread %x enter for inode %x in cluster %x / cycle %d\n",
    18351835__FUNCTION__, CURRENT_THREAD, inode, local_cxy, cycle );
     
    18501850    }
    18511851
    1852 #if CONFIG_DEBUG_VFS_MAPPER_LOAD
     1852#if DEBUG_VFS_MAPPER_LOAD
    18531853cycle = (uint32_t)hal_get_cycles();
    1854 if( CONFIG_DEBUG_VFS_MAPPER_MOVE < cycle )
     1854if( DEBUG_VFS_MAPPER_MOVE < cycle )
    18551855printk("\n[DBG] %s : thread %x exit for inode %x in cluster %x / cycle %d\n",
    18561856__FUNCTION__, CURRENT_THREAD, inode, local_cxy, cycle );
Note: See TracChangeset for help on using the changeset viewer.