/*__________________________________________________________________________
  Trace level debug function
  ==========================================================================
  PARAMETERS:
  -
  RETURN: none
  ==========================================================================*/
void rozofs_tx_debug_show(uint32_t tcpRef, void *bufRef) {
    char *pChar = myBuf;

    pChar += sprintf(pChar, "number of transaction contexts (initial/allocated) : %u/%u\n", rozofs_tx_context_count, rozofs_tx_context_allocated);
    pChar += sprintf(pChar, "context size (bytes)                               : %u\n", (unsigned int) sizeof (rozofs_tx_ctx_t));
    ;
    pChar += sprintf(pChar, "Total memory size (bytes)                          : %u\n", (unsigned int) sizeof (rozofs_tx_ctx_t) * rozofs_tx_context_count);
    ;
    pChar += sprintf(pChar, "Statistics\n");
    pChar += sprintf(pChar, "TX_SEND           : %10llu\n", (unsigned long long int) rozofs_tx_stats[ROZOFS_TX_SEND]);
    pChar += sprintf(pChar, "TX_SEND_ERR       : %10llu\n", (unsigned long long int) rozofs_tx_stats[ROZOFS_TX_SEND_ERROR]);
    pChar += sprintf(pChar, "TX_RECV_OK        : %10llu\n", (unsigned long long int) rozofs_tx_stats[ROZOFS_TX_RECV_OK]);
    pChar += sprintf(pChar, "TX_RECV_OUT_SEQ   : %10llu\n", (unsigned long long int) rozofs_tx_stats[ROZOFS_TX_RECV_OUT_SEQ]);
    pChar += sprintf(pChar, "TX_TIMEOUT        : %10llu\n", (unsigned long long int) rozofs_tx_stats[ROZOFS_TX_TIMEOUT]);
    pChar += sprintf(pChar, "TX_ENCODING_ERROR : %10llu\n", (unsigned long long int) rozofs_tx_stats[ROZOFS_TX_ENCODING_ERROR]);
    pChar += sprintf(pChar, "TX_DECODING_ERROR : %10llu\n", (unsigned long long int) rozofs_tx_stats[ROZOFS_TX_DECODING_ERROR]);
    pChar += sprintf(pChar, "TX_CTX_MISMATCH   : %10llu\n", (unsigned long long int) rozofs_tx_stats[ROZOFS_TX_CTX_MISMATCH]);
    pChar += sprintf(pChar, "TX_NO_CTX_ERROR   : %10llu\n", (unsigned long long int) rozofs_tx_stats[ROZOFS_TX_NO_CTX_ERROR]);
    pChar += sprintf(pChar, "TX_NO_BUFFER_ERROR: %10llu\n", (unsigned long long int) rozofs_tx_stats[ROZOFS_TX_NO_BUFFER_ERROR]);
    pChar += sprintf(pChar, "\n");
    pChar += sprintf(pChar, "Buffer Pool (name[size] :initial/current\n");
    pChar += sprintf(pChar, "Xmit Buffer            \n");
    pChar += sprintf(pChar, "  small[%6d]  : %6d/%d\n", rozofs_small_tx_xmit_size, rozofs_small_tx_xmit_count,
                     ruc_buf_getFreeBufferCount(ROZOFS_TX_SMALL_TX_POOL));
    pChar += sprintf(pChar, "  large[%6d]  : %6d/%d\n", rozofs_large_tx_xmit_size, rozofs_large_tx_xmit_count,
                     ruc_buf_getFreeBufferCount(ROZOFS_TX_LARGE_TX_POOL));
    pChar += sprintf(pChar, "Recv Buffer            \n");
    pChar += sprintf(pChar, "  small[%6d]  : %6d/%d\n", rozofs_small_tx_recv_size, rozofs_small_tx_recv_count,
                     ruc_buf_getFreeBufferCount(ROZOFS_TX_SMALL_RX_POOL));
    pChar += sprintf(pChar, "  large[%6d]  : %6d/%d\n", rozofs_large_tx_recv_size, rozofs_large_tx_recv_count,
                     ruc_buf_getFreeBufferCount(ROZOFS_TX_LARGE_RX_POOL));
    uma_dbg_send(tcpRef, bufRef, TRUE, myBuf);

}
Exemple #2
0
/*__________________________________________________________________________
  Just display counts of context
  ==========================================================================*/
void af_unix_debug_show_no_param(char *pChar) {

    pChar += sprintf(pChar, "number of AF_UNIX contexts [size](initial/allocated) :[%u] %u/%u\n", (unsigned int) sizeof (af_unix_ctx_generic_t), (unsigned int) af_unix_context_count,
            (unsigned int) af_unix_context_allocated);
    pChar += sprintf(pChar, "Buffer Pool (name[size] :initial/current\n");
    pChar += sprintf(pChar, "Xmit Buffer ");
    pChar += sprintf(pChar, ":[%6d] %6d/%d\n", af_unix_xmit_buf_size, af_unix_xmit_buf_count,
            ruc_buf_getFreeBufferCount(af_unix_buffer_pool_tb[0]));
    pChar += sprintf(pChar, "Recv Buffer ");
    pChar += sprintf(pChar, ":[%6d] %6d/%d\n", af_unix_recv_buf_size, af_unix_recv_buf_count,
            ruc_buf_getFreeBufferCount(af_unix_buffer_pool_tb[1]));
    pChar += sprintf(pChar, "syntax is af_unix [first|next|<nickName>]\n");
}
Exemple #3
0
uint32_t rozofs_fuse_rcvMsgsock(void * rozofs_fuse_ctx_p,int socketId)
{
    rozofs_fuse_ctx_t  *ctx_p;
    int k;
    uint32_t            buffer_count;
    int empty = 0;
    uint32_t status;
    
    ctx_p = (rozofs_fuse_ctx_t*)rozofs_fuse_ctx_p;   
     
     for (k = 0; k < rozofs_fuse_loop_count; k++)
     {
       buffer_count = ruc_buf_getFreeBufferCount(ctx_p->fuseReqPoolRef);
       if (buffer_count < 2) 
       {
	 return TRUE;
       }
       /*
       ** check the number of requests towards the storcli
       */
       if (rozofs_storcli_pending_req_count >= rozofs_max_storcli_tx)
       {
	 status = rozofs_xoff();
	 if (status== FALSE) 
	 {
	   return TRUE;
	 }
       }   
       /*
       ** Check the amount of read buffer (shared pool)
       */
       buffer_count = rozofs_get_shared_storcli_buf_free(SHAREMEM_IDX_READ);
       if (buffer_count < 2) 
       {
	 status = rozofs_xoff();
	 if (status== FALSE) 
	 {
	   return TRUE;
	 }
       }           
       buffer_count = rozofs_get_shared_storcli_buf_free(SHAREMEM_IDX_WRITE);
       if (buffer_count < 2) 
       {
	 status = rozofs_xoff();
	 if (status== FALSE) 
	 {
	   return TRUE;
	 }
       }
       rozofs_fuse_session_loop(ctx_p,&empty);
       if (empty) return TRUE;
     }
    
    return TRUE;
}
Exemple #4
0
void rozofs_fuse_show(char * argv[], uint32_t tcpRef, void *bufRef) {
  uint32_t            buffer_count=0;
  char                status[16];
  char *pChar = localBuf;
  
  buffer_count      = ruc_buf_getFreeBufferCount(rozofs_fuse_ctx_p->fuseReqPoolRef);
  /*
  ** check if the session has been exited
  */
  if (fuse_session_exited(rozofs_fuse_ctx_p->se)) sprintf(status,"exited");
  else                                            sprintf(status,"running");
  
  pChar +=  sprintf(pChar,"FUSE %8s - %d/%d ctx remaining\n",
               status, buffer_count, rozofs_fuse_ctx_p->initBufCount);
  int i;
  for (i = 0; i < RZ_FUSE_WRITE_MAX; i++)
  {
     pChar +=sprintf(pChar,"cpt_%d: %8llu\n",i,(long long unsigned int)rozofs_write_merge_stats_tab[i]);  
  }
  /**
  * clear the stats
  */
  memset(rozofs_write_merge_stats_tab,0,sizeof(uint64_t)*RZ_FUSE_WRITE_MAX);
  /**
  *  read/write statistics
  */
  pChar +=sprintf(pChar,"flush buf. count: %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.flush_buf_cpt);  
  pChar +=sprintf(pChar,"readahead  count: %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.readahead_cpt);  
  pChar +=sprintf(pChar,"read req.  count: %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.read_req_cpt);  
  pChar +=sprintf(pChar,"read fuse  count: %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.read_fuse_cpt);  
  
  memset(&rozofs_fuse_read_write_stats_buf,0,sizeof(rozofs_fuse_read_write_stats));
  /*
  ** Per array statistics
  */
  pChar +=sprintf(pChar,"Per Read Array statitics:\n" );  
  for (i = 0; i < 32; i++)
  {
     if (rozofs_read_buf_section_table[i]!= 0)
       pChar +=sprintf(pChar,"  %6d: %8llu\n",(i+1)*ROZOFS_BSIZE,(long long unsigned int)rozofs_read_buf_section_table[i]);  
  }
  pChar +=sprintf(pChar,"Per Write Array statitics:\n" );  
  for (i = 0; i < 32; i++)
  {
     if (rozofs_write_buf_section_table[i]!= 0)
       pChar +=sprintf(pChar,"  %6d: %8llu\n",(i+1)*ROZOFS_BSIZE,(long long unsigned int)rozofs_write_buf_section_table[i]);  
  }
  memset (rozofs_write_buf_section_table,0,sizeof(uint64_t)*ROZOFS_FUSE_NB_OF_BUSIZE_SECTION_MAX);
  memset (rozofs_read_buf_section_table,0,sizeof(uint64_t)*ROZOFS_FUSE_NB_OF_BUSIZE_SECTION_MAX);
  
  uma_dbg_send(tcpRef, bufRef, TRUE, localBuf);
}
Exemple #5
0
uint32_t rozofs_fuse_rcvReadysock(void * rozofs_fuse_ctx_p,int socketId)
{
    rozofs_fuse_ctx_t  *ctx_p;
    uint32_t            buffer_count;
    
    
    ctx_p = (rozofs_fuse_ctx_t*)rozofs_fuse_ctx_p;
    
    /*
    ** check if the session has been exited
    */
    if (fuse_session_exited(ctx_p->se))
    {
      /*
      ** session is dead, so stop receiving fuse request
      */
      return FALSE;
    }
    /*
    ** There is no specific buffer pool needed for receiving the fuse request
    ** since the fuse library allocates memory to store the incoming request.
    ** The only element that can prevent a fuse request to be processed is the 
    ** amount of transaction context. So the system has to check how many transaction
    ** contexts are remaining in the transaction context buffer pool. 
    ** When there is no enough contexts, then the system stops looking at the 
    ** fuse "socket". 
    */
    buffer_count = ruc_buf_getFreeBufferCount(ctx_p->fuseReqPoolRef);
    /*
    ** 2 fuse contexts are required :
    ** - 1 to process the incoming request
    ** - 1 to eventualy process an internal asynchronous flush
    */
    if (buffer_count < 2) 
    {
      rozofs_fuse_buffer_depletion_count++;
      return FALSE;
    }

    return TRUE;
}
Exemple #6
0
uint32_t rozofs_fuse_rcvMsgsock(void * rozofs_fuse_ctx_p,int socketId)
{
    rozofs_fuse_ctx_t  *ctx_p;
    int k;
    uint32_t            buffer_count;
    
    ctx_p = (rozofs_fuse_ctx_t*)rozofs_fuse_ctx_p;   
     
     for (k = 0; k < rozofs_fuse_loop_count; k++)
     {
       buffer_count = ruc_buf_getFreeBufferCount(ctx_p->fuseReqPoolRef);
       if (buffer_count < 2) 
       {
	 rozofs_fuse_buffer_depletion_count++;
	 return TRUE;
       }    
       rozofs_fuse_session_loop(ctx_p);
     }
    
    return TRUE;
}
Exemple #7
0
void rozofs_fuse_show(char * argv[], uint32_t tcpRef, void *bufRef) {
  uint32_t            buffer_count=0;
  char                status[16];
  char *pChar = uma_dbg_get_buffer();
  
  buffer_count      = ruc_buf_getFreeBufferCount(rozofs_fuse_ctx_p->fuseReqPoolRef);
  /*
  ** check if the session has been exited
  */
  if (fuse_session_exited(rozofs_fuse_ctx_p->se)) sprintf(status,"exited");
  else                                            sprintf(status,"running");
  
  pChar +=  sprintf(pChar,"FUSE %8s - %d/%d ctx remaining\n",
               status, buffer_count, rozofs_fuse_ctx_p->initBufCount);
  /*
  ** display the cache mode
  */
  pChar +=  sprintf(pChar,"FS Mode    : "); 
  if (rozofs_mode== 0)
  {
    pChar +=  sprintf(pChar,"standard\n");    
  }
  else
  {
    pChar +=  sprintf(pChar,"Block\n");      
  }     
  pChar +=  sprintf(pChar,"cache Mode : ");      
    switch (rozofs_cache_mode)
  {
    default:
    case 0:
     pChar +=  sprintf(pChar,"default\n");  
     break;    
   case 1:
     pChar +=  sprintf(pChar,"direct_io\n");  
     break;    
   case 2:
     pChar +=  sprintf(pChar,"keep_cache\n");  
     break;    
  }
  int i;
  for (i = 0; i < RZ_FUSE_WRITE_MAX; i++)
  {
     pChar +=sprintf(pChar,"cpt_%d: %8llu\n",i,(long long unsigned int)rozofs_write_merge_stats_tab[i]);  
  }
  /**
  * clear the stats
  */
  memset(rozofs_write_merge_stats_tab,0,sizeof(uint64_t)*RZ_FUSE_WRITE_MAX);
  /**
  *  read/write statistics
  */
  pChar +=sprintf(pChar,"flush buf. count: %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.flush_buf_cpt);  
  pChar +=sprintf(pChar,"readahead  count: %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.readahead_cpt);  
  pChar +=sprintf(pChar,"read req.  count: %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.read_req_cpt);  
  pChar +=sprintf(pChar,"read fuse  count: %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.read_fuse_cpt);  
  
  memset(&rozofs_fuse_read_write_stats_buf,0,sizeof(rozofs_fuse_read_write_stats));
  /*
  ** Per array statistics
  */
  pChar +=sprintf(pChar,"Per Read Array statitics:\n" );  
  for (i = 0; i < 32; i++)
  {
     if (rozofs_read_buf_section_table[i]!= 0)
       pChar +=sprintf(pChar,"  %6d: %8llu\n",(i+1)*ROZOFS_PAGE_SZ,(long long unsigned int)rozofs_read_buf_section_table[i]);  
  }
  pChar +=sprintf(pChar,"Per Write Array statitics:\n" );  
  for (i = 0; i < 32; i++)
  {
     if (rozofs_write_buf_section_table[i]!= 0)
       pChar +=sprintf(pChar,"  %6d: %8llu\n",(i+1)*ROZOFS_PAGE_SZ,(long long unsigned int)rozofs_write_buf_section_table[i]);  
  }
  memset (rozofs_write_buf_section_table,0,sizeof(uint64_t)*ROZOFS_FUSE_NB_OF_BUSIZE_SECTION_MAX);
  memset (rozofs_read_buf_section_table,0,sizeof(uint64_t)*ROZOFS_FUSE_NB_OF_BUSIZE_SECTION_MAX);
  
  uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
}
Exemple #8
0
void rozofs_fuse_show(char * argv[], uint32_t tcpRef, void *bufRef) {
  uint32_t            buffer_count=0;
  char                status[16];
  int   new_val;   
  
  char *pChar = uma_dbg_get_buffer();

  if (argv[1] != NULL)
  {
      if (strcmp(argv[1],"loop")==0) 
      {
	 errno = 0;
	 if (argv[2] == NULL)
	 {
           pChar += sprintf(pChar, "argument is missing\n");
	   uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
	   return;	  	  
	 }
	 new_val = (int) strtol(argv[2], (char **) NULL, 10);   
	 if (errno != 0) {
           pChar += sprintf(pChar, "bad value %s\n",argv[2]);
	   uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
	   return;
	 }
	 /*
	 ** 
	 */
	 if (new_val == 0) {
           pChar += sprintf(pChar, "unsupported value %s\n",argv[2]);
	   uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
	   return;
	 }	 
	 rozofs_fuse_loop_count = new_val;
      }
  }
  uint64_t old_ticker = rozofs_fuse_req_tic;
  rozofs_fuse_get_ticker();  
  buffer_count      = ruc_buf_getFreeBufferCount(rozofs_fuse_ctx_p->fuseReqPoolRef);
  /*
  ** check if the session has been exited
  */
  if (fuse_session_exited(rozofs_fuse_ctx_p->se)) sprintf(status,"exited");
  else                                            sprintf(status,"running");
  
  pChar +=  sprintf(pChar,"FUSE %8s - %d/%d ctx remaining\n",
               status, buffer_count, rozofs_fuse_ctx_p->initBufCount);
  /*
  ** display the cache mode
  */
  pChar +=  sprintf(pChar,"poll count : %d\n",rozofs_fuse_loop_count); 
  pChar +=  sprintf(pChar,"FS Mode    : "); 
  if (rozofs_mode== 0)
  {
    pChar +=  sprintf(pChar,"standard\n");    
  }
  else
  {
    pChar +=  sprintf(pChar,"Block\n");      
  }  
  pChar +=  sprintf(pChar,"FS Xattr   : %s\n",(rozofs_xattr_disable==1)?"Disabled":"Enabled");   
  pChar +=  sprintf(pChar,"cache Mode : ");      
    switch (rozofs_cache_mode)
  {
    default:
    case 0:
     pChar +=  sprintf(pChar,"default\n");  
     break;    
   case 1:
     pChar +=  sprintf(pChar,"direct_io\n");  
     break;    
   case 2:
     pChar +=  sprintf(pChar,"keep_cache\n");  
     break;    
  }
  int i;
  for (i = 0; i < RZ_FUSE_WRITE_MAX; i++)
  {
     pChar +=sprintf(pChar,"cpt_%d: %8llu\n",i,(long long unsigned int)rozofs_write_merge_stats_tab[i]);  
  }
  /**
  * clear the stats
  */
  uint64_t  delay = rozofs_fuse_req_tic-old_ticker;

  memset(rozofs_write_merge_stats_tab,0,sizeof(uint64_t)*RZ_FUSE_WRITE_MAX);
  pChar +=sprintf(pChar,"fuse req_in (count/bytes): %8llu/%llu\n",(long long unsigned int)rozofs_fuse_req_count,
                                                    (long long unsigned int)rozofs_fuse_req_byte_in);  
  if (delay)
  {
  pChar +=sprintf(pChar,"fuse req_in/s            : %8llu/%llu\n",(long long unsigned int)(rozofs_fuse_req_count*1000000/delay),
                                                   (long long unsigned int)(rozofs_fuse_req_byte_in*1000000/delay));
  }

  pChar +=sprintf(pChar,"fuse req_in EAGAIN/ENOENT: %8llu/%llu\n",(long long unsigned int)rozofs_fuse_req_eagain_count,
                                                     (long long unsigned int)rozofs_fuse_req_enoent_count);  

  pChar +=sprintf(pChar,"fuse buffer depletion    : %8llu\n",(long long unsigned int)rozofs_fuse_buffer_depletion_count);
  rozofs_fuse_buffer_depletion_count =0;
  rozofs_fuse_req_count = 0;
  rozofs_fuse_req_byte_in = 0;
  rozofs_fuse_req_eagain_count = 0;
  rozofs_fuse_req_enoent_count = 0;
  /**
  *  read/write statistics
  */
  pChar +=sprintf(pChar,"flush buf. count          : %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.flush_buf_cpt);  
  pChar +=sprintf(pChar,"  start aligned/unaligned : %8llu/%llu\n",
                 (long long unsigned int)rozofs_aligned_write_start[0],
                 (long long unsigned int)rozofs_aligned_write_start[1]
		 );  
  pChar +=sprintf(pChar,"  end aligned/unaligned   : %8llu/%llu\n",
                (long long unsigned int)rozofs_aligned_write_end[0],
                (long long unsigned int)rozofs_aligned_write_end[1]
		);  
  pChar +=sprintf(pChar,"readahead count           : %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.readahead_cpt);  
  pChar +=sprintf(pChar,"read req. count           : %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.read_req_cpt);  
  pChar +=sprintf(pChar,"read fuse count           : %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.read_fuse_cpt);  
  
  memset(&rozofs_fuse_read_write_stats_buf,0,sizeof(rozofs_fuse_read_write_stats));
  {
    int k;
    for (k= 0;k< 2;k++)
    {
      rozofs_aligned_write_start[k] = 0;
      rozofs_aligned_write_end[k] = 0;
    }
  }
  /*
  ** Per array statistics
  */
  pChar +=sprintf(pChar,"Per Read Array statitics:\n" );  
  for (i = 0; i < 32; i++)
  {
     if (rozofs_read_buf_section_table[i]!= 0)
       pChar +=sprintf(pChar,"  %6d: %8llu\n",(i+1)*ROZOFS_PAGE_SZ,(long long unsigned int)rozofs_read_buf_section_table[i]);  
  }
  pChar +=sprintf(pChar,"Per Write Array statitics:\n" );  
  for (i = 0; i < 32; i++)
  {
     if (rozofs_write_buf_section_table[i]!= 0)
       pChar +=sprintf(pChar,"  %6d: %8llu\n",(i+1)*ROZOFS_PAGE_SZ,(long long unsigned int)rozofs_write_buf_section_table[i]);  
  }
  memset (rozofs_write_buf_section_table,0,sizeof(uint64_t)*ROZOFS_FUSE_NB_OF_BUSIZE_SECTION_MAX);
  memset (rozofs_read_buf_section_table,0,sizeof(uint64_t)*ROZOFS_FUSE_NB_OF_BUSIZE_SECTION_MAX);
  
  uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
}
Exemple #9
0
void rozofs_fuse_show(char * argv[], uint32_t tcpRef, void *bufRef) {
  uint32_t            buffer_count=0;
  char                status[16];
  int   new_val; 
  int   ret;
  
  char *pChar = uma_dbg_get_buffer();

  if (argv[1] != NULL)
  {
      if (strcmp(argv[1],"kernel")==0) 
      {
	 if (rozofs_fuse_ctx_p->ioctl_supported)
	 {
	   ioctl(rozofs_fuse_ctx_p->fd,100,NULL);  
           pChar += sprintf(pChar, "check result in dmesg: ROZOFS_FUSE...\n");
	 } 
	 else
	 { 
           pChar += sprintf(pChar, "ioctl not supported with that fuse kernel version\n");
	 }

	 uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
	 return;
      }
      if (strcmp(argv[1],"loop")==0) 
      {
	 errno = 0;
	 if (argv[2] == NULL)
	 {
           pChar += sprintf(pChar, "argument is missing\n");
	   rozofs_fuse_show_usage(pChar);
	   uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
	   return;	  	  
	 }
	 new_val = (int) strtol(argv[2], (char **) NULL, 10);   
	 if (errno != 0) {
           pChar += sprintf(pChar, "bad value %s\n",argv[2]);
	   rozofs_fuse_show_usage(pChar);
	   uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
	   return;
	 }
	 /*
	 ** 
	 */
	 if (new_val == 0) {
           pChar += sprintf(pChar, "unsupported value %s\n",argv[2]);
	   rozofs_fuse_show_usage(pChar);
	   uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
	   return;
	 }	 
	 rozofs_fuse_loop_count = new_val;
         pChar += sprintf(pChar, "new polling request count %d\n",rozofs_fuse_loop_count);
	 uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
	 return;
      }
      if (strcmp(argv[1],"dir")==0) 
      {
	 if (rozofs_fuse_ctx_p->ioctl_supported==0)
	 {
           pChar += sprintf(pChar, "ioctl not supported with that fuse kernel version\n");
	   uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
	   return;
	 }
	 errno = 0;
	 if (argv[2] == NULL)
	 {
           pChar += sprintf(pChar, "argument is missing\n");
	   rozofs_fuse_show_usage(pChar);
	   uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
	   return;	  	  
	 }
	 if (strcmp(argv[2],"enable")==0) 
	 {
	   ret = ioctl(rozofs_fuse_ctx_p->fd,4,NULL);  
	   if (ret < 0) 
	   {
            pChar += sprintf(pChar, "ioctl failed %s\n",strerror(errno));
	   }
	   else
	   {
             pChar += sprintf(pChar, "directory attributes are invalidated on mknod/rmdir/unlink...\n");
	     rozofs_fuse_ctx_p->dir_attr_invalidate = 1;
	   }
	   uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
	   return;
         }
	 if (strcmp(argv[2],"disable")==0) 
	 {
	   ret = ioctl(rozofs_fuse_ctx_p->fd,3,NULL);  
	   if (ret < 0) 
	   {
            pChar += sprintf(pChar, "ioctl failed %s\n",strerror(errno));
	   }
	   else
	   {
             pChar += sprintf(pChar, "directory attributes are not invalidated on mknod/rmdir/unlink...\n");
	     rozofs_fuse_ctx_p->dir_attr_invalidate = 0;
	   }
	   uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
	   return;
         }
         pChar += sprintf(pChar, "unsupported argument %s\n",argv[2]);
	 rozofs_fuse_show_usage(pChar);
	 uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
	 return;
      }
      pChar += sprintf(pChar, "unsupported command %s\n",argv[1]);
      rozofs_fuse_show_usage(pChar);
      uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
      return;
  }
  uint64_t old_ticker = rozofs_fuse_req_tic;
  rozofs_fuse_get_ticker();  
  buffer_count      = ruc_buf_getFreeBufferCount(rozofs_fuse_ctx_p->fuseReqPoolRef);
  /*
  ** check if the session has been exited
  */
  if (fuse_session_exited(rozofs_fuse_ctx_p->se)) sprintf(status,"exited");
  else                                            sprintf(status,"running");
  
  pChar +=  sprintf(pChar,"FUSE %8s - %d/%d ctx remaining\n",
               status, buffer_count, rozofs_fuse_ctx_p->initBufCount);
  /*
  ** display the cache mode
  */
  pChar +=  sprintf(pChar,"buffer sz  : %d\n",rozofs_fuse_ctx_p->bufsize); 
  pChar +=  sprintf(pChar,"poll count : %d\n",rozofs_fuse_loop_count); 
  pChar +=  sprintf(pChar,"dir attr   : %s\n",(rozofs_fuse_ctx_p->dir_attr_invalidate)?"INVALIDATE":"KEEP"); 
  pChar +=  sprintf(pChar,"FS Mode    : "); 
  if (rozofs_mode== 0)
  {
    pChar +=  sprintf(pChar,"standard\n");    
  }
  else
  {
    pChar +=  sprintf(pChar,"Block\n");      
  }  
  pChar +=  sprintf(pChar,"FS Xattr   : %s\n",(rozofs_xattr_disable==1)?"Disabled":"Enabled");   
  pChar +=  sprintf(pChar,"cache Mode : ");      
    switch (rozofs_cache_mode)
  {
    default:
    case 0:
     pChar +=  sprintf(pChar,"default\n");  
     break;    
   case 1:
     pChar +=  sprintf(pChar,"direct_io\n");  
     break;    
   case 2:
     pChar +=  sprintf(pChar,"keep_cache\n");  
     break;    
  }
  int i;
  for (i = 0; i < RZ_FUSE_WRITE_MAX; i++)
  {
     pChar +=sprintf(pChar,"cpt_%d: %8llu\n",i,(long long unsigned int)rozofs_write_merge_stats_tab[i]);  
  }
  /**
  * clear the stats
  */
  uint64_t  delay = rozofs_fuse_req_tic-old_ticker;

  memset(rozofs_write_merge_stats_tab,0,sizeof(uint64_t)*RZ_FUSE_WRITE_MAX);
  pChar +=sprintf(pChar,"fuse req_in (count/bytes): %8llu/%llu\n",(long long unsigned int)rozofs_fuse_req_count,
                                                    (long long unsigned int)rozofs_fuse_req_byte_in);  
  pChar +=sprintf(pChar,"fuse time                :%8llu (%llu)\n",
          (long long unsigned int)(fuse_profile[P_COUNT]?fuse_profile[P_ELAPSE]/fuse_profile[P_COUNT]:0),
          (long long unsigned int)fuse_profile[P_COUNT]);

  if (delay)
  {
  pChar +=sprintf(pChar,"fuse req_in/s            : %8llu/%llu\n",(long long unsigned int)(rozofs_fuse_req_count*1000000/delay),
                                                   (long long unsigned int)(rozofs_fuse_req_byte_in*1000000/delay));
  }

  pChar +=sprintf(pChar,"fuse req_in EAGAIN/ENOENT: %8llu/%llu\n",(long long unsigned int)rozofs_fuse_req_eagain_count,
                                                     (long long unsigned int)rozofs_fuse_req_enoent_count);  

  pChar +=sprintf(pChar,"fuse buffer depletion    : %8llu\n",(long long unsigned int)rozofs_fuse_buffer_depletion_count);  
  pChar +=sprintf(pChar,"storcli buffer depletion : %8llu\n",(long long unsigned int)rozofs_storcli_buffer_depletion_count);
  pChar +=sprintf(pChar,"pending storcli requests : %8d\n",rozofs_storcli_pending_req_count);
  pChar +=sprintf(pChar,"fuse kernel xoff/xon     : %8llu/%llu\n",(long long unsigned int)rozofs_storcli_xoff_count,
                                                                   (long long unsigned int)rozofs_storcli_xon_count);

  rozofs_storcli_buffer_depletion_count =0;
  rozofs_fuse_buffer_depletion_count =0;
  rozofs_fuse_req_count = 0;
  rozofs_fuse_req_byte_in = 0;
  rozofs_fuse_req_eagain_count = 0;
  rozofs_fuse_req_enoent_count = 0;
  rozofs_storcli_xoff_count = 0;
  rozofs_storcli_xon_count = 0;
  /**
  *  read/write statistics
  */
  pChar +=sprintf(pChar,"big write count           : %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.big_write_cpt);  
  pChar +=sprintf(pChar,"flush buf. count          : %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.flush_buf_cpt);  
  pChar +=sprintf(pChar,"  start aligned/unaligned : %8llu/%llu\n",
                 (long long unsigned int)rozofs_aligned_write_start[0],
                 (long long unsigned int)rozofs_aligned_write_start[1]
		 );  
  pChar +=sprintf(pChar,"  end aligned/unaligned   : %8llu/%llu\n",
                (long long unsigned int)rozofs_aligned_write_end[0],
                (long long unsigned int)rozofs_aligned_write_end[1]
		);  
  pChar +=sprintf(pChar,"readahead count           : %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.readahead_cpt);  
  pChar +=sprintf(pChar,"read req. count           : %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.read_req_cpt);  
  pChar +=sprintf(pChar,"read fuse count           : %8llu\n",(long long unsigned int)rozofs_fuse_read_write_stats_buf.read_fuse_cpt);  
  
  memset(&rozofs_fuse_read_write_stats_buf,0,sizeof(rozofs_fuse_read_write_stats));
  {
    int k;
    for (k= 0;k< 2;k++)
    {
      rozofs_aligned_write_start[k] = 0;
      rozofs_aligned_write_end[k] = 0;
    }
  }
  /*
  ** Per array statistics
  */
  pChar +=sprintf(pChar,"Per Read Array statitics:\n" );  
  for (i = 0; i < ROZOFS_FUSE_NB_OF_BUSIZE_SECTION_MAX; i++)
  {
     if (rozofs_read_buf_section_table[i]!= 0)
       pChar +=sprintf(pChar,"  %6d: %8llu\n",(i+1)*ROZOFS_PAGE_SZ,(long long unsigned int)rozofs_read_buf_section_table[i]);  
  }
  pChar +=sprintf(pChar,"Per Write Array statitics:\n" );  
  for (i = 0; i < ROZOFS_FUSE_NB_OF_BUSIZE_SECTION_MAX; i++)
  {
     if (rozofs_write_buf_section_table[i]!= 0)
       pChar +=sprintf(pChar,"  %6d: %8llu\n",(i+1)*ROZOFS_PAGE_SZ,(long long unsigned int)rozofs_write_buf_section_table[i]);  
  }
  memset (rozofs_write_buf_section_table,0,sizeof(uint64_t)*ROZOFS_FUSE_NB_OF_BUSIZE_SECTION_MAX);
  memset (rozofs_read_buf_section_table,0,sizeof(uint64_t)*ROZOFS_FUSE_NB_OF_BUSIZE_SECTION_MAX);
  
  uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
}
Exemple #10
0
uint32_t rozofs_fuse_rcvReadysock(void * rozofs_fuse_ctx_p,int socketId)
{
    rozofs_fuse_ctx_t  *ctx_p;
    uint32_t            buffer_count;
    uint32_t            status;
    
    
    ctx_p = (rozofs_fuse_ctx_t*)rozofs_fuse_ctx_p;
    
    /*
    ** check if the session has been exited
    */
    if (fuse_session_exited(ctx_p->se))
    {
      /*
      ** session is dead, so stop receiving fuse request
      */
      return FALSE;
    }
    /*
    ** There is no specific buffer pool needed for receiving the fuse request
    ** since the fuse library allocates memory to store the incoming request.
    ** The only element that can prevent a fuse request to be processed is the 
    ** amount of transaction context. So the system has to check how many transaction
    ** contexts are remaining in the transaction context buffer pool. 
    ** When there is no enough contexts, then the system stops looking at the 
    ** fuse "socket". 
    */
    buffer_count = ruc_buf_getFreeBufferCount(ctx_p->fuseReqPoolRef);
    /*
    ** 2 fuse contexts are required :
    ** - 1 to process the incoming request
    ** - 1 to eventualy process an internal asynchronous flush
    */
    if (buffer_count < 2) 
    {
      rozofs_fuse_buffer_depletion_count++;
      return FALSE;
    }
    
    /*
    ** check the number of requests towards the storcli
    */
    if (rozofs_storcli_pending_req_count >= rozofs_max_storcli_tx)
    {
      status = rozofs_xoff();
      rozofs_storcli_buffer_depletion_count++;
      return status;
    }   
    /*
    ** Check the amount of read buffer (shared pool)
    */
    buffer_count = rozofs_get_shared_storcli_buf_free(SHAREMEM_IDX_READ);
    if (buffer_count < 2) 
    {
      status = rozofs_xoff();
      rozofs_storcli_buffer_depletion_count++;
      return status;
    }          
    /*
    ** Check the amount of read buffer (shared pool)
    */
    buffer_count = rozofs_get_shared_storcli_buf_free(SHAREMEM_IDX_WRITE);
    if (buffer_count < 2) 
    {
      status = rozofs_xoff();
      rozofs_storcli_buffer_depletion_count++;
      return status;
    }
    rozofs_xon();   
    return TRUE;
}