Skip to contentSkip to conversation

erofs: refine readahead tracepoint

PATCH Superseded Gao Xiang 2 participants 3 messages May 14, 2025 – May 15, 2025

Subsystems (2)
lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs: refine readahead tracepoint

- trace_erofs_readpages => trace_erofs_readahead;

- Rename a redundant statement nrpages = readahead_count(rac);;

- Move the tracepoint to the beginning of z_erofs_readahead().

---
 fs/erofs/zdata.c             | 5 ++---
 include/trace/events/erofs.h | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)
fs/erofs/zdata.c +2 -3
index b8e6b76c23d5..29541e0787b8 100644
@@ -1855,13 +1855,12 @@ static void z_erofs_readahead(struct readahead_control *rac)
 {
 	struct inode *const inode = rac->mapping->host;
 	Z_EROFS_DEFINE_FRONTEND(f, inode, readahead_pos(rac));
-	struct folio *head = NULL, *folio;
 	unsigned int nrpages = readahead_count(rac);
+	struct folio *head = NULL, *folio;
 	int err;
 
+	trace_erofs_readahead(inode, readahead_index(rac), nrpages, false);
 	z_erofs_pcluster_readmore(&f, rac, true);
-	nrpages = readahead_count(rac);
-	trace_erofs_readpages(inode, readahead_index(rac), nrpages, false);
 	while ((folio = readahead_folio(rac))) {
 		folio->private = head;
 		head = folio;
include/trace/events/erofs.h +2 -2
index c69c7b1e41d1..644d4cbd3d80 100644
@@ -113,7 +113,7 @@ TRACE_EVENT(erofs_read_folio,
 		__entry->raw)
 );
 
-TRACE_EVENT(erofs_readpages,
+TRACE_EVENT(erofs_readahead,
 
 	TP_PROTO(struct inode *inode, pgoff_t start, unsigned int nrpage,
 		bool raw),
@@ -138,7 +138,7 @@ TRACE_EVENT(erofs_readpages,
 
 	TP_printk("dev = (%d,%d), nid = %llu, start = %lu nrpage = %u raw = %d",
 		show_dev_nid(__entry),
-		(unsigned long)__entry->start,
+		(unsigned long)__entry->start,`
 		__entry->nrpage,
 		__entry->raw)
 );
Signature · 1 line
2.43.5
author
#1 lore raw

PATCH RESEND 1/1 erofs: refine readahead tracepoint

- trace_erofs_readpages => trace_erofs_readahead;

- Rename a redundant statement nrpages = readahead_count(rac);;

- Move the tracepoint to the beginning of z_erofs_readahead().

---
replace a stale version..

 fs/erofs/fileio.c            | 2 +-
 fs/erofs/zdata.c             | 5 ++---
 include/trace/events/erofs.h | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)
fs/erofs/fileio.c +1 -1
index 60c7cc4c105c..94fff404db81 100644
@@ -180,7 +180,7 @@ static void erofs_fileio_readahead(struct readahead_control *rac)
 	struct folio *folio;
 	int err;
 
-	trace_erofs_readpages(inode, readahead_index(rac),
+	trace_erofs_readahead(inode, readahead_index(rac),
 			      readahead_count(rac), true);
 	while ((folio = readahead_folio(rac))) {
 		err = erofs_fileio_scan_folio(&io, folio);
fs/erofs/zdata.c +2 -3
index b8e6b76c23d5..29541e0787b8 100644
@@ -1855,13 +1855,12 @@ static void z_erofs_readahead(struct readahead_control *rac)
 {
 	struct inode *const inode = rac->mapping->host;
 	Z_EROFS_DEFINE_FRONTEND(f, inode, readahead_pos(rac));
-	struct folio *head = NULL, *folio;
 	unsigned int nrpages = readahead_count(rac);
+	struct folio *head = NULL, *folio;
 	int err;
 
+	trace_erofs_readahead(inode, readahead_index(rac), nrpages, false);
 	z_erofs_pcluster_readmore(&f, rac, true);
-	nrpages = readahead_count(rac);
-	trace_erofs_readpages(inode, readahead_index(rac), nrpages, false);
 	while ((folio = readahead_folio(rac))) {
 		folio->private = head;
 		head = folio;
include/trace/events/erofs.h +1 -1
index c69c7b1e41d1..a5f4b9234f46 100644
@@ -113,7 +113,7 @@ TRACE_EVENT(erofs_read_folio,
 		__entry->raw)
 );
 
-TRACE_EVENT(erofs_readpages,
+TRACE_EVENT(erofs_readahead,
 
 	TP_PROTO(struct inode *inode, pgoff_t start, unsigned int nrpage,
 		bool raw),
Signature · 1 line
2.43.5
Reviewed-by on v1 1/1
#2 lore raw
Quoted 7 lines · Gao Xiang

- trace_erofs_readpages => trace_erofs_readahead;

- Rename a redundant statement nrpages = readahead_count(rac);;

- Move the tracepoint to the beginning of z_erofs_readahead().

Thanks,
Hongbo

Quoted 54 lines

---
replace a stale version..

  fs/erofs/fileio.c            | 2 +-
  fs/erofs/zdata.c             | 5 ++---
  include/trace/events/erofs.h | 2 +-
  3 files changed, 4 insertions(+), 5 deletions(-)
fs/erofs/fileio.c +1 -1
index 60c7cc4c105c..94fff404db81 100644
@@ -180,7 +180,7 @@ static void erofs_fileio_readahead(struct readahead_control *rac)
  	struct folio *folio;
  	int err;
 
-	trace_erofs_readpages(inode, readahead_index(rac),
+	trace_erofs_readahead(inode, readahead_index(rac),
  			      readahead_count(rac), true);
  	while ((folio = readahead_folio(rac))) {
  		err = erofs_fileio_scan_folio(&io, folio);
fs/erofs/zdata.c +2 -3
index b8e6b76c23d5..29541e0787b8 100644
@@ -1855,13 +1855,12 @@ static void z_erofs_readahead(struct readahead_control *rac)
  {
  	struct inode *const inode = rac->mapping->host;
  	Z_EROFS_DEFINE_FRONTEND(f, inode, readahead_pos(rac));
-	struct folio *head = NULL, *folio;
  	unsigned int nrpages = readahead_count(rac);
+	struct folio *head = NULL, *folio;
  	int err;
 
+	trace_erofs_readahead(inode, readahead_index(rac), nrpages, false);
  	z_erofs_pcluster_readmore(&f, rac, true);
-	nrpages = readahead_count(rac);
-	trace_erofs_readpages(inode, readahead_index(rac), nrpages, false);
  	while ((folio = readahead_folio(rac))) {
  		folio->private = head;
  		head = folio;
include/trace/events/erofs.h +1 -1
index c69c7b1e41d1..a5f4b9234f46 100644
@@ -113,7 +113,7 @@ TRACE_EVENT(erofs_read_folio,
  		__entry->raw)
  );
 
-TRACE_EVENT(erofs_readpages,
+TRACE_EVENT(erofs_readahead,
 
  	TP_PROTO(struct inode *inode, pgoff_t start, unsigned int nrpage,
  		bool raw),