Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Jun 2012 10:48:17 +0300
From:      Sergey Slobodyanyuk <ssv.lkml@gmail.com>
To:        killing@multiplay.co.uk
Cc:        freebsd-hackers@freebsd.org
Subject:   Re:dtrace filename lookups from fd (Serg Slobodyanyuk)
Message-ID:  <CALx9bBqmvHnUGqFnXAK%2B3B2Rbc4kjs_TCrEyw9VbJTjUXAa2%2Bw@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
>
>
> Date: Fri, 1 Jun 2012 17:00:20 +0100
> From: "Steven Hartland" <killing@multiplay.co.uk>
>
> As a first foray into dtrace I wanted to create a little
> script which shows the amount of disk read / write activity.
>
> Now the DtraceToolkit includes rwsnoop but this uses Solaris
> specific requests and on looking around it seems like
> using rwsnoop vn_fullpath may be the way to go.
>
> Has anyone done anything similar to this before or has any
> tips on going about this?
>
>    Regards
>    Steve
>


HI,
Some times ago I decided to do the same - port rwsnoop to FreeBSD(8.2 R).
FreeBSD vfs code quiet different from solaris code so I asked for help
Kostik and he directed me to vn_fullpath() routine after that I wrote
working port of rwsnoop.
But script generate alot of errors like "invalid address (0x....) in
action" even on data that should be there(from my point of view). After
several tries to debug it I left it as is.
You can run it with "| grep -v invalid" or direct STDERR to /dev/null.

Maybe Hackers could look at it and say what's wrong :-)

Changed part of code:

        this->fp = &(curthread->td_proc->p_fd->fd_ofiles[self->fd]);
this->vp = (struct vnode *)((*(this->fp))->f_vnode);
this->cache_dst = &((this->vp)->v_cache_dst);
this->ncp = (&((this->vp)->v_cache_dst)) != NULL ?
(&((this->vp)->v_cache_dst))->tqh_first : 0;
self->ncname = this->ncp ? (this->ncp->nc_name != 0 ?
 stringof(this->ncp->nc_name) : "<unknown>") : "<unknown>"

Link to script:
https://docs.google.com/open?id=0B7olr28SbDyNZktLMG51UHVxNW8


//Br. Serg



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALx9bBqmvHnUGqFnXAK%2B3B2Rbc4kjs_TCrEyw9VbJTjUXAa2%2Bw>