public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* NFSD tapset: how can I get filename from filehandles ?
@ 2010-08-24 14:24 sbocahu
  2010-08-24 16:14 ` David Smith
  0 siblings, 1 reply; 6+ messages in thread
From: sbocahu @ 2010-08-24 14:24 UTC (permalink / raw)
  To: systemtap

Hi all,

I hope I'm not disturbing too much... I'm a new systemtap user without any
kernel knowledge, trying to write a few scripts.
Since I fail to write the second one, I would like to ask you for
pointers:

I would like to gather some stats from nfsd probes to know which files are
most accessed/written/read/etc...
This is pretty easy with the create(), remove() and lookup() nfsops as the
nfsd tapset exposes the filename variable (wich seems to be easy as well,
because the filename is given as argument to the call).

The problem is: I can't get the filename for other nfsops. The filename is
not given as argument.


I guess it is possible to get it from the filehandle, though:
(warning: I might be _totally_ wrong, I just tried to read the source and
understand things by myself...)


from the nfsd tapset, nfsd.proc3.write:

    fh = & @cast($argp, "nfsd3_writeargs", "kernel:nfsd")->fh

* fh seems to be of type of svc_fh:

linux/include/linux/nfsd/xdr3.h:

    struct nfsd3_writeargs {
            svc_fh                  fh;
            __u64                   offset;
            __u32                   count;
            int                     stable;
            __u32                   len;
            int                     vlen;
    };

* svc_fh seems to contain a dentry* member

linux/nfsd/nfsfh.h:

    typedef struct svc_fh {
            struct knfsd_fh         fh_handle;      /* FH data */
            struct dentry *         fh_dentry;      /* validated dentry */
            struct svc_export *     fh_export;      /* export pointer */

            ...

* there should be a qstr member in dentry...

linux/dcache.h:

    struct dentry {
            atomic_t d_count;
            ...
            struct qstr d_name;
            ...

* ... which contains the filename

linux/dcache.h:

    struct qstr {
            unsigned int hash;
            unsigned int len;
            const unsigned char *name;
    };


I've tried a few things without success... such as:


    filename = @cast($argp, "nfsd3_writeargs",
"kernel:nfsd")->fh->fh_dentry->d_name->name


which ended with a segfault.


Well, would you correct me and give me pointers on how achieving this,
please ?

Thanks a lot !
Best regards,

Sébastien

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-08-24 18:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-24 14:24 NFSD tapset: how can I get filename from filehandles ? sbocahu
2010-08-24 16:14 ` David Smith
2010-08-24 16:42   ` David Smith
2010-08-24 17:49     ` sbocahu
2010-08-24 18:29       ` David Smith
2010-08-24 17:39   ` sbocahu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).