public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Distinguishing network vs. local disk file I/O
@ 2009-01-29 20:25 Matt Walsh
  2009-01-29 21:34 ` Matt Walsh
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Walsh @ 2009-01-29 20:25 UTC (permalink / raw)
  To: systemtap

All:

I'm using SystemTap to track file I/O operations.

I've been experimenting with read/read and vfs.read/vfs.write - is
there a convenient way to flag whether the operation was to a network
or local file?

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

* Distinguishing network vs. local disk file I/O
  2009-01-29 20:25 Distinguishing network vs. local disk file I/O Matt Walsh
@ 2009-01-29 21:34 ` Matt Walsh
  2009-01-29 22:55   ` Frank Ch. Eigler
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Walsh @ 2009-01-29 21:34 UTC (permalink / raw)
  To: systemTAP

All:

I'm using SystemTap to track file I/O operations.

I've been experimenting with read/read and vfs.read/vfs.write - is
there a convenient way to flag whether the operation was to a network
or local file?

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

* Re: Distinguishing network vs. local disk file I/O
  2009-01-29 21:34 ` Matt Walsh
@ 2009-01-29 22:55   ` Frank Ch. Eigler
  0 siblings, 0 replies; 3+ messages in thread
From: Frank Ch. Eigler @ 2009-01-29 22:55 UTC (permalink / raw)
  To: Matt Walsh; +Cc: systemTAP

Matt Walsh <walshes@gmail.com> writes:

> [...]  I've been experimenting with read/read and vfs.read/vfs.write
> - is there a convenient way to flag whether the operation was to a
> network or local file?

One way seems to be to get at the file's mount entry's device name.

probe vfs.read { mntname = kernel_string($file->f_path->mnt->mnt_devname)
                 if (isinstr(mntname,":") { /* probable NFS */ } }

In practice, due to a bug (PR6739 and related), the mnt->mnt_devname
part can't be resolved directly.  So we can resort to embedded-C:

# cat foobar.stp
%{ #include <linux/mount.h> %}
function mntname:long (ptr:long) %{
   THIS->__retvalue = ((intptr_t)((struct vfsmount*)THIS->ptr)->mnt_devname; 
%}
probe vfs.read { mntname = kernel_string(mntname($file->f_path->mnt))
                 if (isinstr(mntname,":") { /* probable NFS */ } }
# stap -g foobar.stp
...


We could put this mntname helper widget into the vfs tapset so that a
"mntname" variable is automagically available for vfs.* probes.


- FChE

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

end of thread, other threads:[~2009-01-29 21:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-29 20:25 Distinguishing network vs. local disk file I/O Matt Walsh
2009-01-29 21:34 ` Matt Walsh
2009-01-29 22:55   ` Frank Ch. Eigler

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).