2023-04-16 18:47:39

by Ritesh Harjani

[permalink] [raw]
Subject: [RFCv1 2/4] ext4: Change remaining tracepoints to use folio

est4_readpage() is converted to ext4_read_folio() hence change the
related tracepoint from trace_ext4_readpage(page) to
trace_ext4_read_folio(folio).

Do the same for trace_ext4_releasepage(page) to
trace_ext4_release_folio(folio)

Signed-off-by: Ritesh Harjani (IBM) <[email protected]>
---
fs/ext4/inode.c | 4 ++--
include/trace/events/ext4.h | 26 +++++++++++++-------------
2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 6d628d6c0847..5bb141288b1b 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3157,7 +3157,7 @@ static int ext4_read_folio(struct file *file, struct folio *folio)
int ret = -EAGAIN;
struct inode *inode = folio->mapping->host;

- trace_ext4_readpage(&folio->page);
+ trace_ext4_read_folio(folio);

if (ext4_has_inline_data(inode))
ret = ext4_readpage_inline(inode, folio);
@@ -3218,7 +3218,7 @@ static bool ext4_release_folio(struct folio *folio, gfp_t wait)
{
journal_t *journal = EXT4_JOURNAL(folio->mapping->host);

- trace_ext4_releasepage(&folio->page);
+ trace_ext4_release_folio(folio);

/* Page has dirty journalled data -> cannot release */
if (folio_test_checked(folio))
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index ebccf6a6aa1b..a9415f1c68ec 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -560,10 +560,10 @@ TRACE_EVENT(ext4_writepages_result,
(unsigned long) __entry->writeback_index)
);

-DECLARE_EVENT_CLASS(ext4__page_op,
- TP_PROTO(struct page *page),
+DECLARE_EVENT_CLASS(ext4__folio_op,
+ TP_PROTO(struct folio *folio),

- TP_ARGS(page),
+ TP_ARGS(folio),

TP_STRUCT__entry(
__field( dev_t, dev )
@@ -573,29 +573,29 @@ DECLARE_EVENT_CLASS(ext4__page_op,
),

TP_fast_assign(
- __entry->dev = page->mapping->host->i_sb->s_dev;
- __entry->ino = page->mapping->host->i_ino;
- __entry->index = page->index;
+ __entry->dev = folio->mapping->host->i_sb->s_dev;
+ __entry->ino = folio->mapping->host->i_ino;
+ __entry->index = folio->index;
),

- TP_printk("dev %d,%d ino %lu page_index %lu",
+ TP_printk("dev %d,%d ino %lu folio_index %lu",
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long) __entry->ino,
(unsigned long) __entry->index)
);

-DEFINE_EVENT(ext4__page_op, ext4_readpage,
+DEFINE_EVENT(ext4__folio_op, ext4_read_folio,

- TP_PROTO(struct page *page),
+ TP_PROTO(struct folio *folio),

- TP_ARGS(page)
+ TP_ARGS(folio)
);

-DEFINE_EVENT(ext4__page_op, ext4_releasepage,
+DEFINE_EVENT(ext4__folio_op, ext4_release_folio,

- TP_PROTO(struct page *page),
+ TP_PROTO(struct folio *folio),

- TP_ARGS(page)
+ TP_ARGS(folio)
);

DECLARE_EVENT_CLASS(ext4_invalidate_folio_op,
--
2.39.2


2023-04-16 19:45:31

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [RFCv1 2/4] ext4: Change remaining tracepoints to use folio

On Mon, Apr 17, 2023 at 12:01:51AM +0530, Ritesh Harjani (IBM) wrote:
> est4_readpage() is converted to ext4_read_folio() hence change the
> related tracepoint from trace_ext4_readpage(page) to
> trace_ext4_read_folio(folio).
>
> Do the same for trace_ext4_releasepage(page) to
> trace_ext4_release_folio(folio)

Thanks for doing this!

Reviewed-by: Matthew Wilcox (Oracle) <[email protected]>

One possible enhancement is that each fo these functions does
folio->mapping->host already. We could change ext4__folio_op
to take (inode, folio) instead of just folio and simplify/remove
some dereferences.

> Signed-off-by: Ritesh Harjani (IBM) <[email protected]>
> ---
> fs/ext4/inode.c | 4 ++--
> include/trace/events/ext4.h | 26 +++++++++++++-------------
> 2 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 6d628d6c0847..5bb141288b1b 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3157,7 +3157,7 @@ static int ext4_read_folio(struct file *file, struct folio *folio)
> int ret = -EAGAIN;
> struct inode *inode = folio->mapping->host;
>
> - trace_ext4_readpage(&folio->page);
> + trace_ext4_read_folio(folio);
>
> if (ext4_has_inline_data(inode))
> ret = ext4_readpage_inline(inode, folio);
> @@ -3218,7 +3218,7 @@ static bool ext4_release_folio(struct folio *folio, gfp_t wait)
> {
> journal_t *journal = EXT4_JOURNAL(folio->mapping->host);
>
> - trace_ext4_releasepage(&folio->page);
> + trace_ext4_release_folio(folio);
>
> /* Page has dirty journalled data -> cannot release */
> if (folio_test_checked(folio))
> diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
> index ebccf6a6aa1b..a9415f1c68ec 100644
> --- a/include/trace/events/ext4.h
> +++ b/include/trace/events/ext4.h
> @@ -560,10 +560,10 @@ TRACE_EVENT(ext4_writepages_result,
> (unsigned long) __entry->writeback_index)
> );
>
> -DECLARE_EVENT_CLASS(ext4__page_op,
> - TP_PROTO(struct page *page),
> +DECLARE_EVENT_CLASS(ext4__folio_op,
> + TP_PROTO(struct folio *folio),
>
> - TP_ARGS(page),
> + TP_ARGS(folio),
>
> TP_STRUCT__entry(
> __field( dev_t, dev )
> @@ -573,29 +573,29 @@ DECLARE_EVENT_CLASS(ext4__page_op,
> ),
>
> TP_fast_assign(
> - __entry->dev = page->mapping->host->i_sb->s_dev;
> - __entry->ino = page->mapping->host->i_ino;
> - __entry->index = page->index;
> + __entry->dev = folio->mapping->host->i_sb->s_dev;
> + __entry->ino = folio->mapping->host->i_ino;
> + __entry->index = folio->index;
> ),
>
> - TP_printk("dev %d,%d ino %lu page_index %lu",
> + TP_printk("dev %d,%d ino %lu folio_index %lu",
> MAJOR(__entry->dev), MINOR(__entry->dev),
> (unsigned long) __entry->ino,
> (unsigned long) __entry->index)
> );
>
> -DEFINE_EVENT(ext4__page_op, ext4_readpage,
> +DEFINE_EVENT(ext4__folio_op, ext4_read_folio,
>
> - TP_PROTO(struct page *page),
> + TP_PROTO(struct folio *folio),
>
> - TP_ARGS(page)
> + TP_ARGS(folio)
> );
>
> -DEFINE_EVENT(ext4__page_op, ext4_releasepage,
> +DEFINE_EVENT(ext4__folio_op, ext4_release_folio,
>
> - TP_PROTO(struct page *page),
> + TP_PROTO(struct folio *folio),
>
> - TP_ARGS(page)
> + TP_ARGS(folio)
> );
>
> DECLARE_EVENT_CLASS(ext4_invalidate_folio_op,
> --
> 2.39.2
>