diff mbox series

[RFCv3,06/10] fs.h: Add TRACE_IOCB_STRINGS for use in trace points

Message ID 1b57f3a973377392df1f1d02442675ac5fd0c115.1681365596.git.ritesh.list@gmail.com
State Not Applicable
Headers show
Series ext2: DIO to use iomap | expand

Commit Message

Ritesh Harjani (IBM) April 13, 2023, 8:40 a.m. UTC
Add TRACE_IOCB_STRINGS macro which can be used in the trace point patch to
print different flag values with meaningful string output.

Tested-by: Disha Goel <disgoel@linux.ibm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
 include/linux/fs.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Christian Brauner April 13, 2023, 9:54 a.m. UTC | #1
On Thu, Apr 13, 2023 at 02:10:28PM +0530, Ritesh Harjani (IBM) wrote:
> Add TRACE_IOCB_STRINGS macro which can be used in the trace point patch to
> print different flag values with meaningful string output.
> 
> Tested-by: Disha Goel <disgoel@linux.ibm.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
> ---

Fine, but fs.h is such a dumping ground already I hope we can split more
stuff out of it going forward...

>  include/linux/fs.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 9ca3813f43e2..6903fc15987a 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -340,6 +340,20 @@ enum rw_hint {
>  /* can use bio alloc cache */
>  #define IOCB_ALLOC_CACHE	(1 << 21)
>  
> +/* for use in trace events */
> +#define TRACE_IOCB_STRINGS \
> +	{ IOCB_HIPRI, "HIPRI"	}, \
> +	{ IOCB_DSYNC, "DSYNC"	}, \
> +	{ IOCB_SYNC, "SYNC"	}, \
> +	{ IOCB_NOWAIT, "NOWAIT" }, \
> +	{ IOCB_APPEND, "APPEND" }, \
> +	{ IOCB_EVENTFD, "EVENTD"}, \

s/EVENTD/EVENTFD/
Ritesh Harjani (IBM) April 13, 2023, 10:15 a.m. UTC | #2
Christian Brauner <brauner@kernel.org> writes:

Hi Christian

Thanks for your review!

> On Thu, Apr 13, 2023 at 02:10:28PM +0530, Ritesh Harjani (IBM) wrote:
>> Add TRACE_IOCB_STRINGS macro which can be used in the trace point patch to
>> print different flag values with meaningful string output.
>>
>> Tested-by: Disha Goel <disgoel@linux.ibm.com>
>> Reviewed-by: Christoph Hellwig <hch@lst.de>
>> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
>> ---
>
> Fine, but fs.h is such a dumping ground already

Ok, 3205 lines in fs.h.

> I hope we can split more stuff out of it going forward...

Any first thoughts/suggestions like what?

>>  include/linux/fs.h | 14 ++++++++++++++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/include/linux/fs.h b/include/linux/fs.h
>> index 9ca3813f43e2..6903fc15987a 100644
>> --- a/include/linux/fs.h
>> +++ b/include/linux/fs.h
>> @@ -340,6 +340,20 @@ enum rw_hint {
>>  /* can use bio alloc cache */
>>  #define IOCB_ALLOC_CACHE	(1 << 21)
>>
>> +/* for use in trace events */
>> +#define TRACE_IOCB_STRINGS \
>> +	{ IOCB_HIPRI, "HIPRI"	}, \
>> +	{ IOCB_DSYNC, "DSYNC"	}, \
>> +	{ IOCB_SYNC, "SYNC"	}, \
>> +	{ IOCB_NOWAIT, "NOWAIT" }, \
>> +	{ IOCB_APPEND, "APPEND" }, \
>> +	{ IOCB_EVENTFD, "EVENTD"}, \
>
> s/EVENTD/EVENTFD/

Oops an oversight. Thanks for catching it.

-ritesh
diff mbox series

Patch

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 9ca3813f43e2..6903fc15987a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -340,6 +340,20 @@  enum rw_hint {
 /* can use bio alloc cache */
 #define IOCB_ALLOC_CACHE	(1 << 21)
 
+/* for use in trace events */
+#define TRACE_IOCB_STRINGS \
+	{ IOCB_HIPRI, "HIPRI"	}, \
+	{ IOCB_DSYNC, "DSYNC"	}, \
+	{ IOCB_SYNC, "SYNC"	}, \
+	{ IOCB_NOWAIT, "NOWAIT" }, \
+	{ IOCB_APPEND, "APPEND" }, \
+	{ IOCB_EVENTFD, "EVENTD"}, \
+	{ IOCB_DIRECT, "DIRECT" }, \
+	{ IOCB_WRITE, "WRITE"	}, \
+	{ IOCB_WAITQ, "WAITQ"	}, \
+	{ IOCB_NOIO, "NOIO"	}, \
+	{ IOCB_ALLOC_CACHE, "ALLOC_CACHE" }
+
 struct kiocb {
 	struct file		*ki_filp;
 	loff_t			ki_pos;