This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Distinguishing network vs. local disk file I/O
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