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


Ignore:
Timestamp:
Feb 14, 2018, 3:40:19 PM (4 years ago)
Author:
alain
Message:

blip

File:
1 edited

Legend:

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

    r430 r433  
    157157    error_t            error;
    158158
    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
     160uint32_t cycle = (uint32_t)hal_get_cycles();
     161if( CONFIG_DEBUG_VFS_INODE_CREATE < cycle )
     162printk("\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
    161165 
    162166    // check fs type and get pointer on context
     
    230234    remote_spinlock_init( XPTR( local_cxy , &inode->main_lock ) );
    231235
    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
     237uint32_t cycle = (uint32_t)hal_get_cycles();
     238if( CONFIG_DEBUG_VFS_INODE_CREATE < cycle )
     239printk("\n[DBG] %s : thread %x exit / inode = %x in cluster %x / cycle %d\n",
     240__FUNCTION__, CURRENT_THREAD, inode, local_cxy, cycle );
     241#endif
    234242 
    235243    // return extended pointer on inode
     
    263271                        xptr_t        child_xp )
    264272{
    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
     275uint32_t cycle = (uint32_t)hal_get_cycles();
     276if( CONFIG_DEBUG_VFS_INODE_LOAD < cycle )
     277printk("\n[DBG] %s : thread %x enter for <%s> / cycle %d\n",
     278__FUNCTION__, CURRENT_THREAD , name , cycle );
     279#endif
    267280
    268281    error_t error = 0;
     
    293306    }
    294307
    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
     309cycle = (uint32_t)hal_get_cycles();
     310if( CONFIG_DEBUG_VFS_INODE_LOAD < cycle )
     311printk("\n[DBG] %s : thread %x exit for <%s> / cycle %d\n",
     312__FUNCTION__, CURRENT_THREAD , name , cycle );
     313#endif
    297314
    298315    return error;
     
    416433        kmem_req_t       req;        // request to kernel memory allocator
    417434
    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
     436uint32_t cycle = (uint32_t)hal_get_cycles();
     437if( CONFIG_DEBUG_VFS_DENTRY_CREATE < cycle )
     438printk("\n[DBG] %s : thread %x enter for <%s> / parent_inode %x / cycle %d\n",
     439__FUNCTION__, CURRENT_THREAD , name , parent , cycle );
     440#endif
    420441
    421442    // get pointer on context
     
    465486    *dentry_xp = XPTR( local_cxy , dentry );
    466487
    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
     489cycle = (uint32_t)hal_get_cycles();
     490if( CONFIG_DEBUG_VFS_DENTRY_CREATE < cycle )
     491printk("\n[DBG] %s : thread %x exit for <%s> / dentry %x / cycle %d\n",
     492__FUNCTION__, CURRENT_THREAD , name , dentry , cycle );
     493#endif
    469494
    470495    return 0;
     
    584609    uint32_t      file_id;      // created file descriptor index in reference fd_array
    585610
    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
     612uint32_t cycle = (uint32_t)hal_get_cycles();
     613if( CONFIG_DEBUG_VFS_OPEN < cycle )
     614printk("\n[DBG] %s :  thread %x enter for <%s> / cycle %d\n",
     615__FUNCTION__, CURRENT_THREAD, path, cycle );
     616#endif
    588617
    589618    // compute lookup working mode
     
    610639    inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );
    611640   
    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 
    615641    // create a new file descriptor in cluster containing inode
    616642    if( inode_cxy == local_cxy )      // target cluster is local
     
    630656    if( error ) return error;
    631657
    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
     659cycle = (uint32_t)hal_get_cycles();
     660if( CONFIG_DEBUG_VFS_OPEN < cycle )
     661printk("\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
    635664
    636665    // success
     
    647676                   uint32_t size )
    648677{
    649     assert( ( file_xp != XPTR_NULL ) , __FUNCTION__ ,
    650     "file_xp == XPTR_NULL" );
     678    assert( ( file_xp != XPTR_NULL ) , __FUNCTION__ , "file_xp == XPTR_NULL" );
    651679
    652680    cxy_t              file_cxy;     // remote file descriptor cluster
     
    13191347    process = this->process;
    13201348
    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
     1350uint32_t cycle = (uint32_t)hal_get_cycles();
     1351if( CONFIG_DEBUG_VFS_LOOKUP < cycle )
     1352printk("\n[DBG] %s : thread %x enter for <%s> / cycle %d\n",
     1353__FUNCTION__, CURRENT_THREAD, path, cycle );
     1354#endif
    13231355
    13241356    // get extended pointer on first inode to search
     
    13431375        vfs_get_name_from_path( current , name , &next , &last );
    13441376
    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)
     1378if( CONFIG_DEBUG_VFS_LOOKUP < cycle )
     1379printk("\n[DBG] %s : look for <%s> / last = %d\n", __FUNCTION__ , name , last );
     1380#endif
    13471381
    13481382        // search a child dentry matching name in parent inode
     
    13621396        {
    13631397
    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)
     1399if( CONFIG_DEBUG_VFS_LOOKUP < cycle )
     1400printk("\n[DBG] %s : miss <%s> => load it\n", __FUNCTION__ , name );
     1401#endif
    13661402
    13671403            // release lock on parent inode
     
    14461482            vfs_inode_lock( parent_xp );
    14471483
    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)
     1485if( CONFIG_DEBUG_VFS_LOOKUP < cycle )
     1486printk("\n[DBG] %s : created node <%s>\n", __FUNCTION__ , name );
     1487#endif
    14501488
    14511489        }
    14521490
    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)
     1492if( CONFIG_DEBUG_VFS_LOOKUP < cycle )
     1493printk("\n[DBG] %s : found <%s> / inode %x in cluster %x\n",
     1494__FUNCTION__ , name , GET_PTR(child_xp) , GET_CXY(child_xp) );
     1495#endif
    14551496
    14561497        // TODO check access rights here [AG]
     
    14771518    vfs_inode_unlock( parent_xp );
    14781519
    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
     1521cycle = (uint32_t)hal_get_cycles();
     1522if( CONFIG_DEBUG_VFS_LOOKUP < cycle )
     1523printk("\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
    14811526
    14821527    // return searched pointer
     
    15021547    // we use two variables "index" and "count" because the buffer
    15031548    // 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]
    15061551
    15071552        // set the NUL character in buffer / initialise buffer index and count
     
    15761621    parent_ptr = (vfs_inode_t *)GET_PTR( parent_xp );
    15771622
    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
     1624uint32_t cycle = (uint32_t)hal_get_cycles();
     1625if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle )
     1626printk("\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
    15801629
    15811630    // 1. create dentry
     
    15871636                                   &dentry_xp );
    15881637
    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)
     1639if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle )
     1640printk("\n[DBG] %s : dentry <%s> created in cluster %x\n", __FUNCTION__, name, local_cxy );
     1641#endif
    15911642
    15921643    }
     
    16001651                                      &error );
    16011652
    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)
     1654if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle )
     1655printk("\n[DBG] %s : dentry <%s> created in cluster %x\n", __FUNCTION__, name, parent_cxy );
     1656#endif
    16041657
    16051658    }
     
    16291682                                  gid,
    16301683                                  &inode_xp );
     1684
     1685#if (CONFIG_DEBUG_VFS_ADD_CHILD & 1)
     1686if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle )
     1687printk("\n[DBG] %s : inode <%x> created in cluster %x\n",
     1688__FUNCTION__ , GET_PTR(inode_xp) , local_cxy );
     1689#endif
    16311690
    16321691vfs_dmsg("\n[DBG] %s : inode %x created in local cluster %x\n",
     
    16481707                                     &error );
    16491708
    1650 vfs_dmsg("\n[DBG] %s : inode %x created in remote cluster %x\n",
     1709#if (CONFIG_DEBUG_VFS_ADD_CHILD & 1)
     1710if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle )
     1711printk("\n[DBG] %s : inode <%s> created in cluster %x\n",
    16511712__FUNCTION__ , GET_PTR(inode_xp) , child_cxy );
     1713#endif
    16521714
    16531715    }
     
    16691731    hal_remote_swd( XPTR( dentry_cxy , &dentry_ptr->child_xp ) , inode_xp );
    16701732
    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
     1734cycle = (uint32_t)hal_get_cycles();
     1735if( CONFIG_DEBUG_VFS_ADD_CHILD < cycle )
     1736printk("\n[DBG] %s : thread %x exit for <%s>\n",
     1737__FUNCTION__ , CURRENT_THREAD , name );
     1738#endif
    16731739
    16741740    // success : return extended pointer on child inode
     
    16941760    assert( (mapper != NULL) , __FUNCTION__ , "no mapper for page\n" );
    16951761
    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
     1763uint32_t cycle = (uint32_t)hal_get_cycles();
     1764if( CONFIG_DEBUG_VFS_MAPPER_MOVE < cycle )
     1765printk("\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
    16981768
    16991769    // get FS type
     
    17201790    }
    17211791
    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
     1793cycle = (uint32_t)hal_get_cycles();
     1794if( CONFIG_DEBUG_VFS_MAPPER_MOVE < cycle )
     1795printk("\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
    17241798
    17251799    return error;
     
    17401814    assert( (mapper != NULL) , __FUNCTION__ , "mapper pointer is NULL\n" );
    17411815
    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
     1817uint32_t cycle = (uint32_t)hal_get_cycles();
     1818if( CONFIG_DEBUG_VFS_MAPPER_MOVE < cycle )
     1819printk("\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
    17441822
    17451823    // compute number of pages
     
    17571835    }
    17581836
    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
     1838cycle = (uint32_t)hal_get_cycles();
     1839if( CONFIG_DEBUG_VFS_MAPPER_MOVE < cycle )
     1840printk("\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
    17611843
    17621844    return 0;
Note: See TracChangeset for help on using the changeset viewer.