public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* Pretty-printing file.f_mode and file.f_flags in trace points
@ 2014-04-11 22:32 Theodore Ts'o
  2014-04-11 22:47 ` Trond Myklebust
  2014-04-12  1:42 ` Steven Rostedt
  0 siblings, 2 replies; 5+ messages in thread
From: Theodore Ts'o @ 2014-04-11 22:32 UTC (permalink / raw)
  To: linux-fsdevel, linux-ext4; +Cc: rostedt, trond.myklebust


I want to add some trace points which display f_mode and f_flags from
struct file in a human way.   I found the following handy macros defined
in fs/nfs/nfstrace.h:

#define show_open_flags(flags) \
	__print_flags((unsigned long)flags, "|", \
		{ O_CREAT, "O_CREAT" }, \
		{ O_EXCL, "O_EXCL" }, \
		{ O_TRUNC, "O_TRUNC" }, \
		{ O_APPEND, "O_APPEND" }, \
		{ O_DSYNC, "O_DSYNC" }, \
		{ O_DIRECT, "O_DIRECT" }, \
		{ O_DIRECTORY, "O_DIRECTORY" })

#define show_fmode_flags(mode) \
	__print_flags(mode, "|", \
		{ ((__force unsigned long)FMODE_READ), "READ" }, \
		{ ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
		{ ((__force unsigned long)FMODE_EXEC), "EXEC" })

I could just cut and paste these and drop them in
include/trace/events/ext4.h, but it would probably be better to have a
common header file.  The question is where to put them.  Does
include/trace/fs.h make sense to everyone?   Or should put them
somewhere else, such as linux/fs.h?

Cheers,

                                                - Ted

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

* Re: Pretty-printing file.f_mode and file.f_flags in trace points
  2014-04-11 22:32 Pretty-printing file.f_mode and file.f_flags in trace points Theodore Ts'o
@ 2014-04-11 22:47 ` Trond Myklebust
  2014-04-11 22:57   ` Theodore Ts'o
  2014-04-12  1:42 ` Steven Rostedt
  1 sibling, 1 reply; 5+ messages in thread
From: Trond Myklebust @ 2014-04-11 22:47 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-fsdevel, linux-ext4, rostedt

Hi Ted,

On Apr 11, 2014, at 18:32, Theodore Ts'o <tytso@mit.edu> wrote:

> 
> I want to add some trace points which display f_mode and f_flags from
> struct file in a human way.   I found the following handy macros defined
> in fs/nfs/nfstrace.h:
> 
> #define show_open_flags(flags) \
> 	__print_flags((unsigned long)flags, "|", \
> 		{ O_CREAT, "O_CREAT" }, \
> 		{ O_EXCL, "O_EXCL" }, \
> 		{ O_TRUNC, "O_TRUNC" }, \
> 		{ O_APPEND, "O_APPEND" }, \
> 		{ O_DSYNC, "O_DSYNC" }, \
> 		{ O_DIRECT, "O_DIRECT" }, \
> 		{ O_DIRECTORY, "O_DIRECTORY" })
> 
> #define show_fmode_flags(mode) \
> 	__print_flags(mode, "|", \
> 		{ ((__force unsigned long)FMODE_READ), "READ" }, \
> 		{ ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
> 		{ ((__force unsigned long)FMODE_EXEC), "EXEC" })
> 
> I could just cut and paste these and drop them in
> include/trace/events/ext4.h, but it would probably be better to have a
> common header file.  The question is where to put them.  Does
> include/trace/fs.h make sense to everyone?   Or should put them
> somewhere else, such as linux/fs.h?

I’d vote for creating a new file, rather than reusing include/linux/fs.h. The latter is included in way too many other headers... 

include/trace/fs.h sounds just fine to me if Steven and the other tracepoint gurus are OK with it.

Cheers
  Trond
_________________________________
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@primarydata.com

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Pretty-printing file.f_mode and file.f_flags in trace points
  2014-04-11 22:47 ` Trond Myklebust
@ 2014-04-11 22:57   ` Theodore Ts'o
  2014-04-11 23:00     ` Trond Myklebust
  0 siblings, 1 reply; 5+ messages in thread
From: Theodore Ts'o @ 2014-04-11 22:57 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-fsdevel, linux-ext4, rostedt

On Fri, Apr 11, 2014 at 06:47:52PM -0400, Trond Myklebust wrote:
> > I could just cut and paste these and drop them in
> > include/trace/events/ext4.h, but it would probably be better to have a
> > common header file.  The question is where to put them.  Does
> > include/trace/fs.h make sense to everyone?   Or should put them
> > somewhere else, such as linux/fs.h?
> 
> I’d vote for creating a new file, rather than reusing
> include/linux/fs.h. The latter is included in way too many other
> headers...

That was my preference as well.  Assuming Steve is OK with
include/trace/fs.h, any objections if I carry a patch in the ext4 tree
which moves these macros from fs/nfs/nfstrace.h into that new file?

Cheers,

					- Ted

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Pretty-printing file.f_mode and file.f_flags in trace points
  2014-04-11 22:57   ` Theodore Ts'o
@ 2014-04-11 23:00     ` Trond Myklebust
  0 siblings, 0 replies; 5+ messages in thread
From: Trond Myklebust @ 2014-04-11 23:00 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-fsdevel, linux-ext4, rostedt


On Apr 11, 2014, at 18:57, Theodore Ts'o <tytso@mit.edu> wrote:

> On Fri, Apr 11, 2014 at 06:47:52PM -0400, Trond Myklebust wrote:
>>> I could just cut and paste these and drop them in
>>> include/trace/events/ext4.h, but it would probably be better to have a
>>> common header file.  The question is where to put them.  Does
>>> include/trace/fs.h make sense to everyone?   Or should put them
>>> somewhere else, such as linux/fs.h?
>> 
>> I’d vote for creating a new file, rather than reusing
>> include/linux/fs.h. The latter is included in way too many other
>> headers...
> 
> That was my preference as well.  Assuming Steve is OK with
> include/trace/fs.h, any objections if I carry a patch in the ext4 tree
> which moves these macros from fs/nfs/nfstrace.h into that new file?

That would be fine by me.

Cheers
  Trond
_________________________________
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@primarydata.com

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Pretty-printing file.f_mode and file.f_flags in trace points
  2014-04-11 22:32 Pretty-printing file.f_mode and file.f_flags in trace points Theodore Ts'o
  2014-04-11 22:47 ` Trond Myklebust
@ 2014-04-12  1:42 ` Steven Rostedt
  1 sibling, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2014-04-12  1:42 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-fsdevel, linux-ext4, trond.myklebust

On Fri, 11 Apr 2014 18:32:27 -0400
Theodore Ts'o <tytso@mit.edu> wrote:

> 
> I want to add some trace points which display f_mode and f_flags from
> struct file in a human way.   I found the following handy macros defined
> in fs/nfs/nfstrace.h:
> 
> #define show_open_flags(flags) \
> 	__print_flags((unsigned long)flags, "|", \
> 		{ O_CREAT, "O_CREAT" }, \
> 		{ O_EXCL, "O_EXCL" }, \
> 		{ O_TRUNC, "O_TRUNC" }, \
> 		{ O_APPEND, "O_APPEND" }, \
> 		{ O_DSYNC, "O_DSYNC" }, \
> 		{ O_DIRECT, "O_DIRECT" }, \
> 		{ O_DIRECTORY, "O_DIRECTORY" })
> 
> #define show_fmode_flags(mode) \
> 	__print_flags(mode, "|", \
> 		{ ((__force unsigned long)FMODE_READ), "READ" }, \
> 		{ ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
> 		{ ((__force unsigned long)FMODE_EXEC), "EXEC" })
> 
> I could just cut and paste these and drop them in
> include/trace/events/ext4.h, but it would probably be better to have a
> common header file.  The question is where to put them.  Does
> include/trace/fs.h make sense to everyone?   Or should put them
> somewhere else, such as linux/fs.h?
> 

An include file for headers that are only in the include/trace/event
directory is fine to be in include/trace. That is, if you have a macro
used by multiple include/trace/events/*.h files, just put it in
include/trace. I don't even think it needs to be in the events part.

Oh, and I'm fine if it is used by TRACE_EVENT files that are in other
locations like fs/nfs/nfstrace.h.

For adding a helper include/trace/fs.h file used by files in
include/trace/events/ and other trace headers...

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

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

end of thread, other threads:[~2014-04-12  1:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-11 22:32 Pretty-printing file.f_mode and file.f_flags in trace points Theodore Ts'o
2014-04-11 22:47 ` Trond Myklebust
2014-04-11 22:57   ` Theodore Ts'o
2014-04-11 23:00     ` Trond Myklebust
2014-04-12  1:42 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox