2012-01-03 21:20:23

by Sushil Mantri

[permalink] [raw]
Subject: A stackable filesystem to trace low level filesystem operations

Hi All,

Sorry but this isn't a ext4 specific question but a general filesystem question.

I am looking for a way to track filesystem level operation like
operation(read/write), filename, offset, size of read/write, pid of
the requesting process. The goal of my project is to collect such
traces and understand access usage of directories and more. I would
like to filter other operation like open,close, etc and requests to
procfs, etc. There was a stackable file system earlier called Tracefs.
It isn't supported anymore though. The original paper can be found
here: filesystems.org/docs/tracefs-fast04/tracefs.ps

Can you please suggest me what is the best option i have. I am
currently looking at SystemTap.

Thanks,
Sushil


2012-01-03 21:45:59

by Greg Freemyer

[permalink] [raw]
Subject: Re: A stackable filesystem to trace low level filesystem operations

On Tue, Jan 3, 2012 at 4:20 PM, Sushil Mantri <[email protected]> wrote:
> Hi All,
>
> Sorry but this isn't a ext4 specific question but a general filesystem question.
>
> I am looking for a way to track filesystem level operation like
> operation(read/write), filename, offset, size of read/write, pid of
> the requesting process. The goal of my project is to collect such
> traces and understand access usage of directories and more. I would
> like to filter other operation like open,close, etc and requests to
> procfs, etc. There was a stackable file system earlier called Tracefs.
> It isn't supported anymore though. The original paper can be found
> here: filesystems.org/docs/tracefs-fast04/tracefs.ps
>
> Can you please suggest me what is the best option i have. I am
> currently looking at SystemTap.
>
> Thanks,
> Sushil

I think you're looking for either inotify or fanotify.

You might have better luck asking in the vfs mailinglist.

([email protected])

Greg

2012-01-03 21:50:58

by Sushil Mantri

[permalink] [raw]
Subject: Re: A stackable filesystem to trace low level filesystem operations

Please read the following:

On Tue, Jan 3, 2012 at 4:45 PM, Greg Freemyer <[email protected]> wrote:
> On Tue, Jan 3, 2012 at 4:20 PM, Sushil Mantri <[email protected]> wrote:
>> Hi All,
>>
>> Sorry but this isn't a ext4 specific question but a general filesystem question.
>>
>> I am looking for a way to track filesystem level operation like
>> operation(read/write), filename, offset, size of read/write, pid of
>> the requesting process. The goal of my project is to collect such
>> traces and understand access usage of directories and more. I would
>> like to filter other operation like open,close, etc and requests to
>> procfs, etc. There was a stackable file system earlier called Tracefs.
>> It isn't supported anymore though. The original paper can be found
>> here: filesystems.org/docs/tracefs-fast04/tracefs.ps
>>
>> Can you please suggest me what is the best option i have. I am
>> currently looking at SystemTap.
>>
>> Thanks,
>> Sushil
>
> I think you're looking for either inotify or fanotify.
This will only notify me when an event occurs,but is doesn't provide
tracing information. Further i think it will be very slow if i have to
trace the whol filesystem
>
> You might have better luck asking in the vfs mailinglist.
>
> ([email protected])
>
> Greg

2012-01-03 22:53:44

by Greg Freemyer

[permalink] [raw]
Subject: Re: A stackable filesystem to trace low level filesystem operations

On Tue, Jan 3, 2012 at 4:50 PM, Sushil Mantri <[email protected]> wrote:
> Please read the following:
>
> On Tue, Jan 3, 2012 at 4:45 PM, Greg Freemyer <[email protected]> wrote:
>> On Tue, Jan 3, 2012 at 4:20 PM, Sushil Mantri <[email protected]> wrote:
>>> Hi All,
>>>
>>> Sorry but this isn't a ext4 specific question but a general filesystem question.
>>>
>>> I am looking for a way to track filesystem level operation like
>>> operation(read/write), filename, offset, size of read/write, pid of
>>> the requesting process. The goal of my project is to collect such
>>> traces and understand access usage of directories and more. I would
>>> like to filter other operation like open,close, etc and requests to
>>> procfs, etc. There was a stackable file system earlier called Tracefs.
>>> It isn't supported anymore though. The original paper can be found
>>> here: filesystems.org/docs/tracefs-fast04/tracefs.ps
>>>
>>> Can you please suggest me what is the best option i have. I am
>>> currently looking at SystemTap.
>>>
>>> Thanks,
>>> Sushil
>>
>> I think you're looking for either inotify or fanotify.
> This will only notify me when an event occurs,but is doesn't provide
> tracing information. Further i think it will be very slow if i have to
> trace the whol filesystem

inotify and fanotify can both be set to work one file at a time I'm
pretty sure.

ie. You can register to be notified only for specific files and their actions.

There are kernel space hooks for them both I think that allow your
kernel code to be called upon an event. So if you want to create a
basic kernel log tracing package it should be easy enough. (It may be
you need to use the fsnotify API directly for that.)

I don't know if patches for that are floating around. Again, you
should ask on fs-devel, not here.

Greg

2012-01-04 00:03:17

by Dave Chinner

[permalink] [raw]
Subject: Re: A stackable filesystem to trace low level filesystem operations

On Tue, Jan 03, 2012 at 04:20:21PM -0500, Sushil Mantri wrote:
> Hi All,
>
> Sorry but this isn't a ext4 specific question but a general filesystem question.
>
> I am looking for a way to track filesystem level operation like
> operation(read/write), filename, offset, size of read/write, pid of
> the requesting process. The goal of my project is to collect such
> traces and understand access usage of directories and more. I would
> like to filter other operation like open,close, etc and requests to
> procfs, etc. There was a stackable file system earlier called Tracefs.
> It isn't supported anymore though. The original paper can be found
> here: filesystems.org/docs/tracefs-fast04/tracefs.ps

Add your own trace points to the VFS and extract and filter them
with trace-cmd.

Cheers,

Dave.
--
Dave Chinner
[email protected]

2012-01-04 01:37:57

by Theodore Ts'o

[permalink] [raw]
Subject: Re: A stackable filesystem to trace low level filesystem operations


On Jan 3, 2012, at 7:03 PM, Dave Chinner wrote:
>
> Add your own trace points to the VFS and extract and filter them
> with trace-cmd.

Tracepoints are definitely the way to go, and I'd suggest moving this discussion to the [email protected] mailing list, and see if we can get a set of tracepoints that everyone would find useful and drop them into the VFS as standard tracepoints that people using SystemTap, or perf, or trace, other standardized tracing tools, can use.

Sushil, maybe you can learn about how tracepoints work and drive this effort?

Regards,

-- Ted