diff mbox series

[PATCHv6,6/9] fs.h: Add TRACE_IOCB_STRINGS for use in trace points

Message ID 12576fb7b6a9720cc1d5659e95beea948c27907b.1682069716.git.ritesh.list@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series ext2: DIO to use iomap | expand

Commit Message

Ritesh Harjani (IBM) April 21, 2023, 9:46 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

Darrick J. Wong April 21, 2023, 3:56 p.m. UTC | #1
On Fri, Apr 21, 2023 at 03:16:16PM +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>

Looks good, will fix the indentation problems on commit.
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  include/linux/fs.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index c85916e9f7db..bdc1f7ed2aba 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, "EVENTFD"}, \
> +	{ 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;
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/include/linux/fs.h b/include/linux/fs.h
index c85916e9f7db..bdc1f7ed2aba 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, "EVENTFD"}, \
+	{ 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;