Hi,
I'm working in a zfs_log monitor, mi idea is to create a backup fileserver, at 
first place the source server log each zfs syscall and then another server 
takes them and replicate the information copying each diference (via NFS),

My problem is that some transactions don't appear in the log, i've been reading 
a lot about it thinking about "drops" , then i changed  the swhitchrate and the 
buffersize but they didn't work.
i leave you mi d scritp:
Tanks!

#!/usr/sbin/dtrace -s               
#pragma D option bufsize=10m
#pragma D option switchrate=20hz
# pragma D option quiet

zfs_mkdir:entry
{
        self->ts = timestamp;
        self->filepath = args[0]->v_path;
        self->dirname = args[1];
        self->perms = args[2]->va_mode;

}
zfs_mkdir:return
/self->filepath && self->ts && args[1] == 0/

{
 
  printf("%s\t%s\t%d\n", probefunc, stringof(self->filepath), timestamp -  
self->ts);
  
    self->filepath = 0;
    self->dirname = 0; 
    self->ts = 0; 
    self->perms = 0; 

}
    
zfs_write:entry,
zfs_read:entry 
{
        self->ts = timestamp;
        self->filepath = args[0]->v_path;
}
zfs_write:return,
zfs_read:return
/self->filepath && self->ts && args[1] == 0/
{
    printf("%s\t%s\t%d\n", probefunc, stringof(self->filepath),timestamp );
    self->filepath = 0;
    self->ts = 0;

}

zfs_create:entry

{
        self->ts = timestamp;
        self->filepath = args[0]->v_path;
        self->filename = args[1];
        self->perms = args[2]->va_mode;
}
zfs_create:return
/self->ts && self->filepath && self->filename && self->perms && args[1] == 0/
{
    printf("%s\t%s/%s\t%o\t%d\n", probefunc, stringof(self->filepath), 
stringof(self->filename), self->perms,timestamp);
    self->filepath = 0;
    self->filename = 0;
    self->ts = 0;
    self->perms = 0; 
}   
 
zfs_rmdir:entry
{
        self->ts = timestamp;
        self->filepath = args[0]->v_path;
        self->dirname = args[1];
}
zfs_rmdir:return
/self->filepath && self->dirname && self->ts && args[1] == 0/
{       
    printf("%s\t%s/%s\t%d\n", probefunc, stringof(self->filepath), 
stringof(self->dirname), timestamp);
    self->filepath = 0;
    self->dirname = 0;
    self->ts = 0;
  
}

zfs_remove:entry
{
        self->ts = timestamp;
        self->filepath = args[0]->v_path;
        self->filename = args[1];
}
zfs_remove:return
/self->filepath && self->ts && self->filename && args[1] == 0/
{
     printf("%s\t%s/%s\t%d\n", probefunc, stringof(self->filepath), 
stringof(self->filename), timestamp);
    self->filepath = 0;
    self->filename = 0;
    self->ts = 0;
}   
zfs_rename:entry
{   

        self->ts = timestamp;
        self->filepathsource = args[0]->v_path;
        self->filenamesource = args[1];
        self->filepathdest = args[2]->v_path;
        self->filenamedest = args[3];
}   
zfs_rename:return
/self->ts && self->filepathsource && self->filenamesource && self->filepathdest 
&& self->filenamedest && args[1] == 0/
{ 
     printf("%s\t%s/%s\t%s/%s\t%d\n", probefunc, stringof(self->filepathsource),
     stringof(self->filenamesource),stringof(self->filepathdest), 
stringof(self->filenamedest), timestamp );
     self->filepathsource = 0;
     self->filenamesource = 0;
     self->filepathdest = 0;
     self->filenamedest = 0;
     self->ts = 0;
}
 
 
zfs_symlink:entry
{       
        self->ts = timestamp;
        self->filepathdest = args[0]->v_path;
        self->filenamedest = args[1];
        self->linkname = args[3];
        self->perms = args[2]->va_mode;
}

zfs_symlink:return
/self->filepathdest&& self->ts && self->filenamedest && self->linkname && 
args[1] == 0/
{
    
     printf("%s\t%s\t%s/%s\t%o\t%d\n", probefunc, stringof(self->linkname), 
stringof(self->filepathdest),     stringof(self->filenamedest),
     self->perms,timestamp );
     self->filepathsdest= 0;
     self->filenamesdest= 0;
     self->flinkname= 0;
     self->ts = 0;
     self->perms = 0;
}
zfs_link:entry
{    
        self->ts = timestamp;
        self->filepathdest = args[0]->v_path;
        self->filenamedest = args[2];
        self->filenamesource = args[1]->v_path;
}    
     
zfs_link:return
/self->ts && self->filepathdest && self->filenamedest && self->filenamesource 
&& args[1] == 0/
{    
     printf("%s\t%s\t%s/%s\t%d\n", probefunc, 
stringof(self->filenamesource),stringof(self->filepathdest),  
stringof(self->filenamedest), timestamp );
     self->filepathdest = 0;
     self->filenamesource = 0;
     self->filenamesource = 0;
     self->ts = 0;
}    
zfs_setattr:entry 
{    
        self->ts = timestamp;
        self->fileid = args[0]->v_path;
}    
     
zfs_setattr:return
/self->ts && self->fileid  && args[1] == 0/
{
     printf("%s\t%s\t%d\n", probefunc, stringof(self->fileid), timestamp );
     self->fileid = 0;
     self->ts = 0;
}    
zfs_readdir:entry
{    
        self->ts = timestamp;
        self->fileid = args[0]->v_path;
}
 
zfs_readdir:return
/self->ts && self->fileid  && args[1] == 0/
{
    printf("%s\t%s\t%d\n", probefunc, stringof(self->fileid), timestamp);
    self->fileid = 0;
    self->ts = 0;
}
-- 
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to