Limiting string key size (with str() ??)


brad.lewis@...
 

Hi all, 

 

I'm trying to trace zfs reads and writes and collect statistics for different pools using the pool name.  

Here is a simplified version that just has a call count. 

kprobe:zfs_read,kprobe:zfs_write
{
$spa_name = ((struct zfsvfs *) ((struct inode *)arg0)->i_sb->s_fs_info)->z_os->os_spa->spa_name;
@zfs_count[$spa_name] = count();
}

I'm hitting the stack limit due to two large strings of length 256 being allocated on the stack: 

  %"@zfs_count_key" = alloca [256 x i8]
%"$spa_name" = alloca [256 x i8]


It seems that str( ) should be my friend here but so far no luck:  

: ERROR: str() only supports integer arguments (string provided)

 

        $spa_name = str((((struct zfsvfs *) ((struct inode *)arg0)->i_sb->s_fs_info)->z_os->os_spa->spa_name));

                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

In this case I could use the os_spa pointer instead of the name to differentiate between the pools. 

I'd like to use the string for display purposes and I'd like to understand the issues.  

 

 

Thanks in advance for any insight.  

Join iovisor-dev@lists.iovisor.org to automatically receive all group messages.